tcp_model.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*
  2. * tcp_model.h
  3. *
  4. * Created on: 2022年10月6日
  5. * Author: Allen
  6. */
  7. #ifndef JNI_NET_TCP_MODEL_H_
  8. #define JNI_NET_TCP_MODEL_H_
  9. #include <string>
  10. #include "net.h"
  11. #include "json/json.h"
  12. class TcpType{
  13. public:
  14. inline static std::string OTHER = "OTHER";
  15. inline static std::string VOICE = "VOICE";
  16. inline static std::string SOS = "SOS";
  17. inline static std::string REINFORCE = "REINFORCE";
  18. inline static std::string EVENT = "EVENT";
  19. inline static std::string DEVICE = "DEVICE";
  20. inline static std::string DATA = "DATA";
  21. inline static std::string TIME = "TIME";
  22. inline static std::string SIDE = "SIDE";
  23. inline static std::string BLUE_CODE = "BLUE_CODE";
  24. inline static std::string CALLBACK = "CALLBACK";
  25. /** 新增床旁交互Tcp类型 **/
  26. inline static std::string SIGN_IN = "SIGN_IN";
  27. inline static std::string POSITION = "POSITION";
  28. inline static std::string COUNTDOWN = "COUNTDOWN";
  29. inline static std::string ROOMCHECK = "ROOMCHECK";
  30. inline static std::string SCREEN_TIP = "SCREEN_TIP";
  31. inline static std::string AUTH = "AUTH";
  32. };
  33. class VoiceAction {
  34. public:
  35. inline static std::string CALL = "CALL";
  36. inline static std::string ACCEPT = "ACCEPT";
  37. inline static std::string REJECT = "REJECT";
  38. inline static std::string CALLING = "CALLING";
  39. inline static std::string TRANSFER = "TRANSFER";
  40. inline static std::string HANDOFF = "HANDOFF";
  41. inline static std::string CANCEL = "CANCEL";
  42. inline static std::string HCALL = "HCALL";
  43. inline static std::string HRESPONSE = "HRESPONSE";
  44. inline static std::string HRESPONSED = "HRESPONSED";
  45. inline static std::string SUCCESS = "SUCCESS";
  46. inline static std::string FAILED = "FAILED";
  47. inline static std::string CANCEL_BY_DOOR = "CANCEL_BY_DOOR";
  48. inline static std::string SIP_RECONNECT = "SIP_RECONNECT";
  49. inline static std::string GAIN_OK = "GAIN_OK";
  50. inline static std::string GAIN_CALL = "GAIN_CALL";
  51. inline static std::string GAIN_FAIL = "GAIN_FAIL";
  52. };
  53. class SosAction {
  54. public:
  55. inline static std::string CALL = "CALL";
  56. inline static std::string CANCEL = "CANCEL";
  57. };
  58. class EventAction {
  59. public:
  60. inline static std::string KEY_CLICK = "KEY_CLICK"; // 按键事件
  61. inline static std::string RESPONSE = "RESPONSE"; // 响应
  62. inline static std::string RECEIVED = "RECEIVED";
  63. inline static std::string CANCEL = "CANCEL";
  64. inline static std::string CANCEL_CONFIRM = "CANCEL_CONFIRM";
  65. inline static std::string COMPLETED = "COMPLETED";
  66. inline static std::string NO_TARGET = "NO_TARGET";
  67. inline static std::string NO_MATCH = "NO_MATCH";
  68. };
  69. class DeviceAction {
  70. public:
  71. inline static std::string RESTART = "RESTART";
  72. inline static std::string REBOOT = "REBOOT";
  73. inline static std::string CONNECT = "CONNECT";
  74. inline static std::string APP_UPDATE = "APP_UPDATE";
  75. inline static std::string DEVICE_REFRESH = "DEVICE_REFRESH";
  76. inline static std::string SYSTEM_SETTING = "SYSTEM_SETTING";
  77. inline static std::string SERVER_CHANGE = "SERVER_CHANGE";
  78. inline static std::string POWER_RESET = "POWER_RESET";
  79. };
  80. class DataAction {
  81. public:
  82. inline static std::string REFRESH = "REFRESH";
  83. inline static std::string REMIND = "REMIND";
  84. inline static std::string REMIND_OTHER = "REMIND_OTHER";
  85. };
  86. class ReinforceAction {
  87. public:
  88. inline static std::string CALL="CALL";
  89. inline static std::string RESPONSED="RESPONSED";
  90. };
  91. class TimeAction {
  92. public:
  93. inline static std::string SYNC = "SYNC";
  94. };
  95. class SideAction {
  96. public:
  97. inline static std::string CALL = "CALL"; // 呼叫
  98. inline static std::string ACCEPT = "ACCEPT"; // 接听
  99. inline static std::string CANCEL = "CANCEL"; // 取消
  100. inline static std::string SOS_CALL = "SOS_CALL"; // sos呼叫
  101. inline static std::string SOS_CANCEL = "SOS_CANCEL"; // sos取消
  102. inline static std::string NURSING = "NURSING"; // 护理
  103. inline static std::string NURSING_END = "NURSING_END"; // 护理结束
  104. inline static std::string SHOW = "SHOW"; // 护理结束
  105. inline static std::string CLEAR = "CLEAR"; // 护理结束
  106. };
  107. class BlueCodeAction {
  108. public:
  109. inline static std::string CALL = "CALL"; // 呼叫
  110. inline static std::string SUCCESS = "SUCCESS"; // 成功
  111. inline static std::string RESPONSE = "RESPONSE"; // 响应
  112. inline static std::string RESPONDED = "RESPONDED"; // 已响应
  113. };
  114. class CallbackAction {
  115. public:
  116. inline static std::string ACK = "ACK"; // 反馈
  117. inline static std::string SUCCESS = "SUCCESS"; // 同步
  118. inline static std::string FAILED = "FAILED"; // 失败
  119. };
  120. class SignInAction {
  121. public:
  122. inline static std::string SIGN_IN = "SIGN_IN"; // 发起签到
  123. inline static std::string SIGN_IN_SUCCESS = "SIGN_IN_SUCCESS"; // 签到成功
  124. inline static std::string SIGN_IN_FAILED = "SIGN_IN_FAILED"; // 签到失败
  125. };
  126. class PositionAction {
  127. public:
  128. inline static std::string POSITION_START = "POSITION_START"; // 定位开始
  129. inline static std::string POSITION_END = "POSITION_END"; // 结束定位
  130. };
  131. class CountdownAction {
  132. public:
  133. inline static std::string START = "START"; // 倒计时开始
  134. inline static std::string END = "END"; // 倒计时结束
  135. inline static std::string CANCEL = "CANCEL"; // 倒计时取消
  136. };
  137. class RoomCheckAction {
  138. public:
  139. inline static std::string START = "START"; // 巡房开始
  140. inline static std::string END = "END"; // 巡房结束
  141. };
  142. class ScreenTipAction {
  143. public:
  144. inline static std::string START = "START"; // 提示语开始
  145. inline static std::string QUIT = "QUIT"; // 提示语退出
  146. };
  147. class AuthAction {
  148. public:
  149. inline static std::string LOGIN = "LOGIN"; // 登录
  150. inline static std::string LOGOUT = "LOGOUT"; // 退出登录
  151. };
  152. class TcpAction{
  153. VoiceAction voiceAction;
  154. };
  155. struct TcpModel{
  156. std::string tid;
  157. std::string type;
  158. std::string action;
  159. int from_id;
  160. int to_id;
  161. std::string data = "";
  162. Json::Value json = NULL;
  163. };
  164. std::string getTcpModelString(TcpModel model);
  165. TcpModel getTcpModel(byte* inBytes);
  166. void sendTcpModel(TcpModel tcpModel);
  167. #endif /* JNI_NET_TCP_MODEL_H_ */