1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef MODULE_WEB_H
- #define MODULE_WEB_H
- #include <memory>
- #include <string>
- #include <vector>
- #include "rapidjson/prettywriter.h"
- #include "rapidjson/document.h"
- #include "config_file.h"
- #include "module_singleton_base.h"
- #include "module_i_thread.h"
- #include "websocket/wsClientMgr.h"
- struct ya_event;
- class module_web : public i_thread, public singleton_base<module_web>
- {
- private:
- friend class singleton_base<module_web>;
- module_web()
- {
- }
- public:
-
- static void accept( int ID, std::string const& name,
- sio::message::ptr const& data, bool need_ack, sio::message::list &ack_resp );
-
- void init(config_file& config, std::map<std::string, sys::MSG_HANDLE_FUNC_TYPE>& MsgFuncList)
- {
- sleep_ms = std::stoi(config.get("service.interval_send_json_alarm_ms","10000"));
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_META_DATA_CHANGED, &module_web::accept ) );
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_REQUEST_ALL_DATA, &module_web::accept ) );
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_DEAL_HELP, &module_web::accept ) );
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_CALL_CARD_REQUEST, &module_web::accept ) );
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_CALL_CARD_CANCEL_REQUEST, &module_web::accept ) );
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_CLEAR_CARD, &module_web::accept ) );
- MsgFuncList.insert( std::make_pair( JSON_CMD_REQ_ALL_PERSON_ON_CAR,&module_web::accept));
- MsgFuncList.insert( std::make_pair( JSON_CMD_VALUE_LIGHTS_CTRL_REQUEST, &module_web::accept));
- }
-
- void response_login();
- private:
-
- void run();
-
- void _get_all_events(std::vector<std::shared_ptr<ya_event>>& arr,bool f=false);
-
- void _delete_end(std::vector<std::shared_ptr<ya_event>>& arr);
- };
- #endif
|