Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PMSSERVICECLIENT_H
- #define PMSSERVICECLIENT_H
- #include "QtCore/QtCore"
- #ifdef __linux__
- typedef int64_t msec_t;
- #endif
- #ifdef _WIN32
- typedef long long msec_t;
- #endif
- // Get current time in milliseconds from the Epoch (Unix)
- // or the time the system started (Windows).
- void clientSleep(int millis);
- class PMSServiceClient
- {
- msec_t m_serverTimeOffset;
- msec_t m_lowestTimeDiff;
- bool m_dataSent = false;
- bool m_dataRecieved = false;
- public:
- PMSServiceClient();
- virtual ~PMSServiceClient();
- QJsonObject getGameState();
- void setGameState(QJsonObject);
- void setClientState(QJsonObject*);
- void startUpdating();
- void stopUpdating();
- char* getClientData(long &len);
- bool lockClientState();
- void unlockClientState();
- bool getDataSent() ;
- void setDataSent(bool value);
- bool getDataRecieved() ;
- void setDataRecieved(bool value);
- msec_t getCurrentServerTime();
- msec_t getServerTimeOffset();
- int getLowerstTimeDiff() { return (int)m_lowestTimeDiff; }
- protected:
- private:
- QJsonObject m_gameState;
- QJsonObject* m_clientState;
- bool setGameStateMutex = false;
- msec_t time_ms(void);
- msec_t getServerTime();
- //public slots:
- //void replyFinished(QNetworkReply * reply);
- };
- #endif // PMSSERVICECLIENT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement