#include "module_mgr.h" #include "module_web.h" #include "module_call_help.h" #include "module_call.h" #include "area_business_speed_checker.h" #include "module_other_alarm.h" #include "area_business_car_attendance.h" #include "area_business_motionless_persion.h" #include "area_business_geofault.h" #include "log.h" #include "common_tool.h" #include "config_file.h" #include "module_screen.h" /** * @brief 注册web回调函数,读配置文件,启动向web发送线程 * @param config_file& config * @param std::map& MsgFuncList * @return * @note * @warning * @bug */ void module_mgr::init(config_file& config, std::map& MsgFuncList) { module_web::instance()->init(config, MsgFuncList); module_call::instance()->init(config); area_business_motionless_persion::init(config); area_business_geofault::init(config); module_screen::instance()->start(); } /* * @brief 启动线程start:向web发送事件 * @param * @return * @note * @warning * @bug * */ void module_mgr::start() { area_business_geofault::init_geofault_from_db(); area_business_car_attendance::init_attendance_area_from_db(); module_web::instance()->start(); module_call::instance()->start(); //module_motionless_persion::instance()->start(); } /* * @brief 结束线程stop * @param * @return * @note * @warning * @bug * */ void module_mgr::stop() { module_web::instance()->stop(); module_call::instance()->stop(); //module_motionless_persion::instance()->stop(); module_screen::instance()->stop(); } /* * @brief 1.电量告警逻辑处理 * 2.呼叫呼救状态检查 * * @param STATUS_CARD st * @param uint32_t card_id * @param int32_t type * @return * @note * @warning * @bug * */ void module_mgr::do_status(STATUS_CARD st, uint32_t card_id, int32_t type) { auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id)); if(!card_ptr) { log_error("卡不存在card_id=%d", card_id); return; } log_info("[help-battery] card_id=%d, status=%d", card_id, st); // 人员呼救 if((STATUS_HELP & st) != 0) { // STATUS_HELP 0x80 module_call_help::instance()->rev_from_card_help(card_ptr); } // 人员呼叫 if((STATUS_CALL & st) != 0) { module_call::instance()->rev_from_card_resp(card_ptr); } log_info("[help-battery] event, card_id=%d, status=%d", card_id, st); // 电量极低 // 0000 0010 if((STATUS_POWER_LOWER_SERIOUS & st) != 0) { if(!card_ptr->get_event_flag(ET_CARD_LOW_POWER_SERIOUS)) { card_ptr->set_event_flag(ET_CARD_LOW_POWER_SERIOUS); module_other_alarm::power_lower_serious(card_ptr); } } // 电量正常 // 0000 0001 if((STATUS_POWER_NORMAL & st) != 0) { if(card_ptr->get_event_flag(ET_CARD_LOW_POWER_SERIOUS)) { card_ptr->set_event_flag(ET_CARD_LOW_POWER_SERIOUS, 0); module_other_alarm::power_normal(card_ptr); } } }