Browse Source

update

master
zhaohe 1 year ago
parent
commit
dcfc007d8c
  1. 13
      api/README.md
  2. 4
      api/cmds/selftest_cmd_impl.cpp
  3. 54
      api/cmds/selftest_cmd_impl.hpp
  4. 12
      api/cmds/test_page_cmd_impl.cpp
  5. 3
      api/cmds/test_page_cmd_impl.hpp

13
api/README.md

@ -0,0 +1,13 @@
测试指令
```
读取设备状态
{
"command": "getState"
}
指示灯测试
{
"command": "TestPage_WarningLightCtrl",
"r": 0,"g": 0,"b": 0,"w": 0
}
```

4
api/cmds/selftest_cmd_impl.cpp

@ -0,0 +1,4 @@
#include "selftest_cmd_impl.hpp"
using namespace iflytop;
void SelfTestCmdImpl::initialize() {}

54
api/cmds/selftest_cmd_impl.hpp

@ -0,0 +1,54 @@
//
// Created by zwsd
//
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "api/front_msg_processer.hpp"
/**
* @brief
*
* service: SelfTestCmdImpl
*
* :
* :
* :
* :
*
*/
namespace iflytop {
using namespace std;
using namespace core;
class SelfTestCmdImpl : public enable_shared_from_this<SelfTestCmdImpl> {
ENABLE_LOGGER(SelfTestCmdImpl);
shared_ptr<FrontMsgProcesser> m_msgProcesser;
shared_ptr<GConfig> m_zconfig;
shared_ptr<IflytopFrontEndService> m_iflytopwsService;
shared_ptr<DBService> m_dbService;
shared_ptr<DeviceStateService> m_deviceStateService;
shared_ptr<DisinfectionCtrlService> m_disinfectionCtrlService;
shared_ptr<DeviceIoControlService> m_deviceIoControlService;
shared_ptr<DisinfectionLogsManager> m_disinfectionLogsManager;
shared_ptr<ZCanHost> m_zcanhost;
shared_ptr<DataExportService> m_dataExportService;
shared_ptr<FrontMsgProcesser> m_frontMsgProcesser;
public:
SelfTestCmdImpl(){};
void initialize();
private:
};
} // namespace iflytop

12
api/cmds/test_page_cmd_impl.cpp

@ -37,6 +37,17 @@ void TestPageCmdImpl::exceCanCmd(json& cmd, json& receipt) {
return;
}
void TestPageCmdImpl::TestPage_WarningLightCtrl(json& cmd, json& receipt) {
int r = jsonGet<int>(cmd["r"]);
int g = jsonGet<int>(cmd["g"]);
int b = jsonGet<int>(cmd["b"]);
int w = jsonGet<int>(cmd["w"]);
logger->info("TestPage_WarningLightCtrl r:{} g:{} b:{} w:{}", r, g, b, w);
m_deviceIoControlService->warningLightCtrl(r, g, b, w);
return;
}
void TestPageCmdImpl::initialize() {
GET_TO_SERVICE(m_msgProcesser);
GET_TO_SERVICE(m_zconfig);
@ -53,4 +64,5 @@ void TestPageCmdImpl::initialize() {
m_msgProcesser->registerMsgProcesser("test_sprayLiquidPumpCtrl", BIND(TestPageCmdImpl::test_sprayLiquidPumpCtrl));
m_msgProcesser->registerMsgProcesser("test_replenishingFluidsPumpCtrl", BIND(TestPageCmdImpl::test_replenishingFluidsPumpCtrl));
m_msgProcesser->registerMsgProcesser("exceCanCmd", BIND(TestPageCmdImpl::exceCanCmd));
m_msgProcesser->registerMsgProcesser("TestPage_WarningLightCtrl", BIND(TestPageCmdImpl::TestPage_WarningLightCtrl));
}

3
api/cmds/test_page_cmd_impl.hpp

@ -53,5 +53,8 @@ class TestPageCmdImpl : public enable_shared_from_this<TestPageCmdImpl> {
void test_sprayLiquidPumpCtrl(json& cmd, json& receipt);
void test_replenishingFluidsPumpCtrl(json& cmd, json& receipt);
void exceCanCmd(json& cmd, json& receipt);
void TestPage_WarningLightCtrl(json& cmd, json& receipt);
};
} // namespace iflytop
Loading…
Cancel
Save