|
|
@ -23,44 +23,63 @@ void MainControlService::dosystem(string order) { |
|
|
|
void MainControlService::initialize() { |
|
|
|
GET_TO_SERVICE(m_zconfig); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DBService); |
|
|
|
GET_SERVICE(DBService)->initialize(); |
|
|
|
GET_TO_SERVICE(m_dbService); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 构造系统中的单例服务 |
|
|
|
*/ |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DBService); |
|
|
|
GET_SERVICE(DBService)->initialize(); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DeviceStateService); |
|
|
|
GET_SERVICE(DeviceStateService)->initialize(); |
|
|
|
GET_TO_SERVICE(m_deviceStateService); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(ZCanHost); |
|
|
|
GET_SERVICE(ZCanHost)->initialize(m_zconfig->get_iflytopSubDeviceCanIFName(), m_zconfig->get_iflytopSubDeviceCanBitrate(), false); |
|
|
|
GET_TO_SERVICE(m_zcanhost); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DisinfectionLogsManager); |
|
|
|
GET_SERVICE(DisinfectionLogsManager)->initialize(); |
|
|
|
GET_TO_SERVICE(m_disinfectionLogsManager); |
|
|
|
|
|
|
|
//DeviceIOInit
|
|
|
|
if (!g_in_test) { |
|
|
|
BUILD_AND_REG_SERRVICE(DeviceIoControlService); |
|
|
|
|
|
|
|
} else { |
|
|
|
REG_SERRVICE(DeviceIoControlService, new DeviceIoControlServiceTest()); |
|
|
|
} |
|
|
|
|
|
|
|
GET_SERVICE(DeviceIoControlService)->initialize(); |
|
|
|
GET_TO_SERVICE(m_deviceIoControlService); |
|
|
|
|
|
|
|
m_deviceIoControlService->startScan(); |
|
|
|
GET_SERVICE(DeviceIoControlService)->startScan(); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DataExportService); |
|
|
|
GET_SERVICE(DataExportService)->initialize(); |
|
|
|
GET_TO_SERVICE(m_dataExportService); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(FrontMsgProcesser); |
|
|
|
GET_SERVICE(FrontMsgProcesser)->initialize(); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(IflytopFrontEndService); |
|
|
|
GET_SERVICE(IflytopFrontEndService)->initialize("0.0.0.0"); |
|
|
|
GET_SERVICE(IflytopFrontEndService)->onMessage.connect([this](weak_ptr<WebSocket> webSocket, json& cmd, json& receipt) { |
|
|
|
string cmdstr = cmd["command"]; |
|
|
|
if (cmdstr != "getState") { |
|
|
|
logger->info("rx:{}", cmd.dump()); |
|
|
|
} |
|
|
|
m_frontMsgProcesser->processMsg(cmd, receipt); |
|
|
|
if (cmdstr != "getState") { |
|
|
|
logger->info("tx:{}", receipt.dump()); |
|
|
|
} |
|
|
|
}); |
|
|
|
GET_SERVICE(IflytopFrontEndService)->startListen(); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DisinfectionCtrlService); |
|
|
|
GET_SERVICE(DisinfectionCtrlService)->initialize(); |
|
|
|
|
|
|
|
GET_TO_SERVICE(m_dbService); |
|
|
|
GET_TO_SERVICE(m_deviceStateService); |
|
|
|
GET_TO_SERVICE(m_zcanhost); |
|
|
|
GET_TO_SERVICE(m_disinfectionLogsManager); |
|
|
|
GET_TO_SERVICE(m_deviceIoControlService); |
|
|
|
GET_TO_SERVICE(m_dataExportService); |
|
|
|
GET_TO_SERVICE(m_frontMsgProcesser); |
|
|
|
GET_TO_SERVICE(m_iflytopwsService); |
|
|
|
GET_TO_SERVICE(m_disinfectionCtrlService); |
|
|
|
|
|
|
|
BUILD_AND_REG_SERRVICE(DeviceStateCmdImpl); |
|
|
|
BUILD_AND_REG_SERRVICE(DisinfectionCmdImpl); |
|
|
@ -69,6 +88,7 @@ void MainControlService::initialize() { |
|
|
|
BUILD_AND_REG_SERRVICE(SystemOperateCmdImpl); |
|
|
|
BUILD_AND_REG_SERRVICE(TestPageCmdImpl); |
|
|
|
BUILD_AND_REG_SERRVICE(UserCmdImpl); |
|
|
|
BUILD_AND_REG_SERRVICE(SelfTestCmdImpl); |
|
|
|
|
|
|
|
GET_SERVICE(DeviceStateCmdImpl)->initialize(); |
|
|
|
GET_SERVICE(DisinfectionCmdImpl)->initialize(); |
|
|
@ -77,25 +97,5 @@ void MainControlService::initialize() { |
|
|
|
GET_SERVICE(SystemOperateCmdImpl)->initialize(); |
|
|
|
GET_SERVICE(TestPageCmdImpl)->initialize(); |
|
|
|
GET_SERVICE(UserCmdImpl)->initialize(); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the to service object |
|
|
|
*/ |
|
|
|
|
|
|
|
m_disinfectionCtrlService.reset(new DisinfectionCtrlService()); |
|
|
|
m_disinfectionCtrlService->initialize(); |
|
|
|
|
|
|
|
m_iflytopwsService.reset(new IflytopFrontEndService()); |
|
|
|
m_iflytopwsService->initialize("0.0.0.0"); |
|
|
|
m_iflytopwsService->onMessage.connect([this](weak_ptr<WebSocket> webSocket, json& cmd, json& receipt) { |
|
|
|
string cmdstr = cmd["command"]; |
|
|
|
if (cmdstr != "getState") { |
|
|
|
logger->info("rx:{}", cmd.dump()); |
|
|
|
} |
|
|
|
m_frontMsgProcesser->processMsg(cmd, receipt); |
|
|
|
if (cmdstr != "getState") { |
|
|
|
logger->info("tx:{}", receipt.dump()); |
|
|
|
} |
|
|
|
}); |
|
|
|
m_iflytopwsService->startListen(); |
|
|
|
GET_SERVICE(SelfTestCmdImpl)->initialize(); |
|
|
|
}; |