TerminalInfoQueryConn.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /***********************************//**
  2. * @file TerminalInfoQueryConn.h
  3. * @author Gifur
  4. * @email guifaliao@gmail.com
  5. * @version 1.0.0.0
  6. * @date 2021-08-21
  7. * @copyright China Merchants Bank Co.,Ltd All rights reserved
  8. *
  9. * @brief
  10. * @details
  11. **************************************/
  12. #pragma once
  13. #ifndef RVC_TERMINAL_QUERY_INFO_HEADER
  14. #define RVC_TERMINAL_QUERY_INFO_HEADER
  15. #include "SpSecureClient.h"
  16. #pragma pack(1)
  17. typedef struct _DevInfoReq
  18. {
  19. char TerminalNo[16];
  20. } TerminalRegistReq;
  21. typedef struct _DevInfoRcv
  22. {
  23. char TerminalNo[16];
  24. char DeviceNo[16];
  25. char OutletNo[6];
  26. char Initializer[32];
  27. BYTE InitIP[4];
  28. BYTE CreateTime[4];
  29. char PadDeviceID[32];
  30. char MachineType[16];
  31. BYTE MachineVersion[4];
  32. char Sites[16];
  33. BYTE EnrolGPS[8];
  34. char EnrolAddr[512];
  35. BYTE AuthorizedTime[4];
  36. BYTE BusinessStructID[8];
  37. BYTE StructID[8];
  38. char Editor[32];
  39. BYTE EditTime[4];
  40. char State;
  41. char PublicKey[512];
  42. char FingerPrint[512];
  43. } TerminalRegistRet;
  44. typedef struct _md5_req
  45. {
  46. char filePath[128];
  47. }MD5_REQ;
  48. typedef struct _RegisteQuery_
  49. {
  50. char UkeyID[16];
  51. } RegisteQuery;
  52. typedef struct _RegisteQueryReply_
  53. {
  54. char IPAddress[512];
  55. } RegisteQueryReply;
  56. typedef struct _InstallQuery_
  57. {
  58. char MType[16];
  59. } InstallQuery;
  60. typedef struct _InstallReply_
  61. {
  62. char InsStep[60000];
  63. } InstallReply;
  64. typedef struct
  65. {
  66. char curVersion[16];
  67. } SoftwareVerReq;
  68. typedef struct
  69. {
  70. int isForce;
  71. char updataVer[16];
  72. } SoftwareVerRet;
  73. typedef struct _FILE_REQ
  74. {
  75. int pos; //ask for which piece
  76. } FILE_REQ;
  77. typedef struct _FILE_RCV
  78. {
  79. int pos; //rev which piece
  80. int totalPiece; //total pieces
  81. int length; //piece length
  82. char dataPiece[10240]; //piece
  83. } FILE_RCV;
  84. typedef struct _FILE_PUBLIC_REQ
  85. {
  86. int pos;
  87. char filePath[128];
  88. } FILE_PUBLIC_REQ;
  89. typedef struct _FILE_PUBLIC_RVC
  90. {
  91. int pos; //rev which piece
  92. int totalPiece; //total pieces
  93. int length; //piece length
  94. char dataPiece[50000]; //piece
  95. } FILE_PUBLIC_RVC;
  96. typedef struct _STR_REQ
  97. {
  98. char machineNo[16];
  99. char deviceNo[16];
  100. BYTE initIp[4];
  101. char AgentID[32];
  102. char sites[16];
  103. } STR_REQ;
  104. #pragma pack()
  105. /*!
  106. * @class classname
  107. * @brief
  108. *
  109. * @note matters needing attention
  110. */
  111. class CTerminalInfoQuery : public SpSecureClient
  112. {
  113. public:
  114. CTerminalInfoQuery(CEntityBase* pEntity);
  115. bool ConnectServer(const std::string& serverAddr, int port);
  116. ErrorCodeEnum GetTerminalInfo(const std::string& terminalNo, TerminalRegistRet* terminalInfo);
  117. private:
  118. virtual ~CTerminalInfoQuery(void) {}
  119. void StoreErrorMsg(const std::string& msg) { Dbg(msg.c_str()); }
  120. ErrorCodeEnum SendSayHelloReq(const std::string& terminalNo);
  121. ErrorCodeEnum DealSayHelloRet(const CSmartPointer<IPackage>& pRecvPkg);
  122. virtual void OnDisconnect();
  123. virtual void OnPkgAnswer(const CSmartPointer<IPackage>& pRecvPkg);
  124. private:
  125. TerminalRegistRet terminalAns;
  126. };
  127. #endif //RVC_TERMINAL_QUERY_INFO_HEADER