MGDataHandler.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "MGWSServer.h"
  3. class CMGDataHandler :
  4. public IMGWSHandler
  5. {
  6. public:
  7. CMGDataHandler();
  8. ~CMGDataHandler();
  9. public:
  10. virtual size_t HandlerData(struct mg_connection* c, struct mg_ws_message* wm, char** json) override;
  11. virtual BOOL HandlerData(const char* ptr, size_t len, char** json) override;
  12. public:
  13. //读取配置
  14. int HandleConfRead(string tag, string type, yyjson_mut_doc* doc, yyjson_mut_val* root);
  15. //写入配置
  16. int HandleConfWrite(string tag, string type, string name, yyjson_val* conf, yyjson_mut_doc* doc, yyjson_mut_val* root);
  17. //读取历史
  18. int HandleQueryHist(string tag, string time, uint32_t subsection, struct mg_connection* c, mg_per_session_data* pInfo, yyjson_mut_doc* doc, yyjson_mut_val* root);
  19. //报警受理
  20. int HandleAlarmAck(uint32_t alarm_id, string ack_name, yyjson_mut_doc* doc, yyjson_mut_val* root);
  21. //报警处理
  22. int HandleAlarmHandle(uint32_t alarm_id, string handle_name, string handle_info, yyjson_mut_doc* doc, yyjson_mut_val* root);
  23. //发送未处理报警数据
  24. int SendUnAckAlarm(mg_connection* c);
  25. //发送数据给所有客户端
  26. bool SendToAllClient(struct mg_connection* c, const char* ptr, size_t len);
  27. private:
  28. static void ThreadProcForQueryHist(LPMGHISTORY_QUERY);
  29. static void ThreadProcForQueryHistDB(LPMGHISTORY_QUERY);
  30. };