Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r39a9d9b3930ab483df75da6c2e7bf8838fa8ff5e -r0552e825eebff72cbfd7f4f2fbb74b46c80f1e21 --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 39a9d9b3930ab483df75da6c2e7bf8838fa8ff5e) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 0552e825eebff72cbfd7f4f2fbb74b46c80f1e21) @@ -68,6 +68,13 @@ quint64 _seq = 0; + const qint8 _deviceInfoStop = -1; // -1 is don't wait. + const qint8 _deviceInfoSecs = 1; // in seconds is used for the DG serial response message, if DG is detached UI will timeout after a second and will send the message regardless. + qint8 _deviceInfoWait = _deviceInfoStop; + QString _deviceInfoHD = ""; + QString _deviceInfoDG = ""; + QString _deviceInfoUI = ""; + enum Errors_Enum { eError_Unknown = 500, // Unknown error, initial error before error check @@ -76,6 +83,7 @@ eError_Sequence , eError_CRC , eError_MessageID , + eError_InvalidID , eError_ParamCount , eError_Parameter , @@ -88,7 +96,7 @@ }; typedef QHash MessageList; - MessageList _lastReceivedData ; // sent message history for later send upon request. + MessageList _uiHistory ; // sent message history for later send upon request. enum Message_Enum { eMessage_Timestamp , @@ -115,6 +123,7 @@ }; enum MessageID_Enum { + eMessageID_Start = 0, // [ #1( ID ) <-> #2( ID ) ] Description ( #1 Requests and #2 responses ) // Manufacturing eMessageID_Error = 0, // [ CS(2000) <-> UI(1000) ] Error Report @@ -135,8 +144,17 @@ // eMessageID_PatientID = 202, // [No CS req defined] UI sends the patient ID // eMessageID_DeviceReport = 204, // [No CS req defined] UI sends the device report // eMessageID_HeartBeat = 900, // CS sends the periodic Hb and UI can set the interval + + eMessageID_Count }; + enum DeviceInfo_Enum { + eDeviceInfo_Ix = 0, // received message data index of each HD, DG. Data index 0 is always the info. + eDeviceInfo_HD = 0, // stored index in the UI history. + eDeviceInfo_DG = 1, // stored index in the UI history. + eDeviceInfo_UI = 2, // stored index in the UI history. + }; + protected: void timerEvent(QTimerEvent *event) override; @@ -162,17 +180,44 @@ quint8 generateCRC () { return 0; } // has not been implemented/decided yet bool validateCRC () { return true; } // has not been implemented/decided yet - void checkDate (); + void testWatchBuffDate (); + bool interpret (const QString &vContent, Message &vMessage); + bool addCSBuffWatch (); - bool sendUIResponse (const QString &vContent); - bool sendUIBuff (const QString &vData ); - bool sendUIHistory (const qint32 vAction, const QVariantList &vData = {}); - bool interpret(const QString &vContent, Message &vMessage); + QString makeUIBuff (const qint32 vMessageID ); + + bool sendUIResponse (const QString &vContent ); + bool sendUIBuff (const QString &vData ); + bool saveUIHistory (const qint32 vAction, const QVariantList &vData); + bool sendUIHistory (const qint32 vAction ); + bool sendMessage (const qint32 vAction ); + + bool writeInpFile (const QString &vInpBuff ); + QString toText (Errors_Enum vErrorID); QString toInfo (Errors_Enum vErrorID, const QVariantList &vInfoItems); void toLog (Errors_Enum vErrorID, const QVariantList &vInfoItems); qint32 UI2CS (MessageID_Enum vID) { return vID + eUI; } qint32 CS2UI (MessageID_Enum vID) { return vID - eCS; } + + bool sendError (); // eMessageID_Error + + bool saveDeviceInfo (GuiActionType vAction, const QVariantList &vData); // eMessageID_DeviceInfo + bool saveDeviceInfoTimeOut (); // eMessageID_DeviceInfo + bool sendDeviceInfo (); // eMessageID_DeviceInfo + void testDeviceInfoWait (); + void stopDeviceInfoWait (); + void initDeviceInfoWait (); + + + + bool sendDeviceState (); // eMessageID_DeviceState + bool sendDeviceRegister (); // eMessageID_DeviceRegister + bool sendSaveCredentials (); // eMessageID_SaveCredentials + bool sendSendCredentials (); // eMessageID_SendCredentials + bool sendResetFactory (); // eMessageID_ResetFactory + bool sendTxReport (); // eMessageID_TxReport + };