add interface
This commit is contained in:
@@ -2349,6 +2349,70 @@ bool parsemsg(const std::string& devid, const std::string& guid, const nlohmann:
|
||||
return true;
|
||||
}
|
||||
|
||||
////////lnk20260312新增读取运行状态、版本、对时、重启
|
||||
|
||||
case 1111: { // 读取运行状态
|
||||
parsed.ok = true;
|
||||
|
||||
std::cout << "[parsemsg] read running status, devid=" << devid
|
||||
<< ", guid=" << guid << std::endl;
|
||||
|
||||
//
|
||||
if (!recordguid(devid, guid, static_cast<int>(DeviceState::READING_RUNNINGINFORMATION_1), 1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
ClientManager::instance().read_runninginformation_action_to_device(devid);//主动触发,读取
|
||||
return true;
|
||||
}
|
||||
|
||||
case 1112: { // 读取版本信息
|
||||
parsed.ok = true;
|
||||
|
||||
std::cout << "[parsemsg] read version info, devid=" << devid
|
||||
<< ", guid=" << guid << std::endl;
|
||||
|
||||
if (!recordguid(devid, guid, static_cast<int>(DeviceState::READING_DEVVERSION), 1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ClientManager::instance().read_devversion_action_to_device(devid);
|
||||
return true;
|
||||
}
|
||||
|
||||
case 1113: { // 对时
|
||||
parsed.ok = true;
|
||||
|
||||
std::cout << "[parsemsg] time sync, devid=" << devid
|
||||
<< ", guid=" << guid << std::endl;
|
||||
|
||||
if (!recordguid(devid, guid, static_cast<int>(DeviceState::SET_RIGHTTIME_2), 1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 方案A:Msg 为空,直接使用当前系统时间下发
|
||||
ClientManager::instance().set_righttime_action_to_devic(devid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case 1114: { // 重启
|
||||
parsed.ok = true;
|
||||
|
||||
std::cout << "[parsemsg] reboot device, devid=" << devid
|
||||
<< ", guid=" << guid << std::endl;
|
||||
|
||||
if (!recordguid(devid, guid, static_cast<int>(DeviceState::SET_CTRL), 2)) {//分两步,一步校验一步重启
|
||||
return true;
|
||||
}
|
||||
|
||||
ClientManager::instance().set_ctrl_action_to_device(devid,0x01,0x00);//尝试装置重启指令!第一步校验
|
||||
return true;
|
||||
}
|
||||
|
||||
////////lnk20260312新增读取运行状态、版本、对时、重启
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user