tcp_model.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 CALLBACK = "CALLBACK";
  24. };
  25. class VoiceAction {
  26. public:
  27. inline static std::string CALL = "CALL";
  28. inline static std::string ACCEPT = "ACCEPT";
  29. inline static std::string REJECT = "REJECT";
  30. inline static std::string CALLING = "CALLING";
  31. inline static std::string TRANSFER = "TRANSFER";
  32. inline static std::string HANDOFF = "HANDOFF";
  33. inline static std::string CANCEL = "CANCEL";
  34. inline static std::string SUCCESS = "SUCCESS";
  35. inline static std::string FAILED = "FAILED";
  36. inline static std::string CANCEL_BY_DOOR = "CANCEL_BY_DOOR";
  37. };
  38. class SosAction {
  39. public:
  40. inline static std::string CALL = "CALL";
  41. inline static std::string CANCEL = "CANCEL";
  42. };
  43. class EventAction {
  44. public:
  45. inline static std::string KEY_CLICK = "KEY_CLICK"; // 按键事件
  46. inline static std::string RESPONSE = "RESPONSE"; // 响应
  47. inline static std::string RECEIVED = "RECEIVED";
  48. inline static std::string CANCEL = "CANCEL";
  49. inline static std::string CANCEL_CONFIRM = "CANCEL_CONFIRM";
  50. inline static std::string COMPLETED = "COMPLETED";
  51. inline static std::string NO_TARGET = "NO_TARGET";
  52. inline static std::string NO_MATCH = "NO_MATCH";
  53. };
  54. class DeviceAction {
  55. public:
  56. inline static std::string RESTART = "RESTART";
  57. inline static std::string CONNECT = "CONNECT";
  58. inline static std::string APP_UPDATE = "APP_UPDATE";
  59. inline static std::string DEVICE_REFRESH = "DEVICE_REFRESH";
  60. inline static std::string SYSTEM_SETTING = "SYSTEM_SETTING";
  61. };
  62. class DataAction {
  63. public:
  64. inline static std::string REFRESH = "REFRESH";
  65. };
  66. class ReinforceAction {
  67. public:
  68. inline static std::string CALL="CALL";
  69. inline static std::string RESPONSED="RESPONSED";
  70. };
  71. class TimeAction {
  72. public:
  73. inline static std::string SYNC = "SYNC";
  74. };
  75. class SideAction {
  76. public:
  77. inline static std::string CALL = "CALL"; // 护理
  78. inline static std::string ACCEPT = "ACCEPT"; // 护理
  79. inline static std::string CANCEL = "CANCEL"; // 护理
  80. inline static std::string SOS_CALL = "SOS_CALL"; // 护理
  81. inline static std::string SOS_CANCEL = "SOS_CANCEL"; // 护理
  82. inline static std::string NURSING = "NURSING"; // 护理
  83. inline static std::string NURSING_END = "NURSING_END"; // 护理结束
  84. };
  85. class CallbackAction {
  86. public:
  87. inline static std::string ACK = "ACK"; // 反馈
  88. inline static std::string SUCCESS = "SUCCESS"; // 同步
  89. inline static std::string FAILED = "FAILED"; // 失败
  90. };
  91. class TcpAction{
  92. VoiceAction voiceAction;
  93. };
  94. struct TcpModel{
  95. std::string tid;
  96. std::string type;
  97. std::string action;
  98. int from_id;
  99. int to_id;
  100. std::string data = "";
  101. Json::Value json = NULL;
  102. };
  103. std::string getTcpModelString(TcpModel model);
  104. TcpModel getTcpModel(byte* inBytes);
  105. #endif /* JNI_NET_TCP_MODEL_H_ */