Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #ifndef PMSSERVICECLIENT_H
  2. #define PMSSERVICECLIENT_H
  3.  
  4. #include "QtCore/QtCore"
  5.  
  6. #ifdef __linux__
  7. typedef int64_t msec_t;
  8. #endif
  9. #ifdef _WIN32
  10. typedef long long msec_t;
  11. #endif
  12.  
  13.  
  14. // Get current time in milliseconds from the Epoch (Unix)
  15. // or the time the system started (Windows).
  16.  
  17. void clientSleep(int millis);
  18.  
  19. class PMSServiceClient
  20. {
  21. msec_t m_serverTimeOffset;
  22. msec_t m_lowestTimeDiff;
  23. bool m_dataSent = false;
  24. bool m_dataRecieved = false;
  25. public:
  26. PMSServiceClient();
  27. virtual ~PMSServiceClient();
  28. QJsonObject getGameState();
  29. void setGameState(QJsonObject);
  30. void setClientState(QJsonObject*);
  31. void startUpdating();
  32. void stopUpdating();
  33. char* getClientData(long &len);
  34. bool lockClientState();
  35. void unlockClientState();
  36. bool getDataSent() ;
  37. void setDataSent(bool value);
  38. bool getDataRecieved() ;
  39. void setDataRecieved(bool value);
  40. msec_t getCurrentServerTime();
  41. msec_t getServerTimeOffset();
  42. int getLowerstTimeDiff() { return (int)m_lowestTimeDiff; }
  43. protected:
  44.  
  45. private:
  46. QJsonObject m_gameState;
  47. QJsonObject* m_clientState;
  48. bool setGameStateMutex = false;
  49. msec_t time_ms(void);
  50. msec_t getServerTime();
  51. //public slots:
  52. //void replyFinished(QNetworkReply * reply);
  53. };
  54.  
  55. #endif // PMSSERVICECLIENT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement