From dcfc007d8c4e115864f338be18fe3ebecb3a78d8 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 15 May 2024 16:56:10 +0800 Subject: [PATCH] update --- api/README.md | 13 ++++++++++ api/cmds/selftest_cmd_impl.cpp | 4 +++ api/cmds/selftest_cmd_impl.hpp | 54 +++++++++++++++++++++++++++++++++++++++++ api/cmds/test_page_cmd_impl.cpp | 12 +++++++++ api/cmds/test_page_cmd_impl.hpp | 3 +++ 5 files changed, 86 insertions(+) create mode 100644 api/README.md create mode 100644 api/cmds/selftest_cmd_impl.cpp create mode 100644 api/cmds/selftest_cmd_impl.hpp diff --git a/api/README.md b/api/README.md new file mode 100644 index 0000000..b279ea2 --- /dev/null +++ b/api/README.md @@ -0,0 +1,13 @@ +测试指令 +``` +读取设备状态 +{ + "command": "getState" +} + +指示灯测试 +{ + "command": "TestPage_WarningLightCtrl", + "r": 0,"g": 0,"b": 0,"w": 0 +} +``` \ No newline at end of file diff --git a/api/cmds/selftest_cmd_impl.cpp b/api/cmds/selftest_cmd_impl.cpp new file mode 100644 index 0000000..b22c370 --- /dev/null +++ b/api/cmds/selftest_cmd_impl.cpp @@ -0,0 +1,4 @@ +#include "selftest_cmd_impl.hpp" + +using namespace iflytop; +void SelfTestCmdImpl::initialize() {} diff --git a/api/cmds/selftest_cmd_impl.hpp b/api/cmds/selftest_cmd_impl.hpp new file mode 100644 index 0000000..1c32fd8 --- /dev/null +++ b/api/cmds/selftest_cmd_impl.hpp @@ -0,0 +1,54 @@ +// +// Created by zwsd +// + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include "api/front_msg_processer.hpp" + +/** + * @brief + * + * service: SelfTestCmdImpl + * + * 监听事件: + * 依赖状态: + * 依赖服务: + * 作用: + * + */ + +namespace iflytop { +using namespace std; +using namespace core; +class SelfTestCmdImpl : public enable_shared_from_this { + ENABLE_LOGGER(SelfTestCmdImpl); + + shared_ptr m_msgProcesser; + shared_ptr m_zconfig; + shared_ptr m_iflytopwsService; + shared_ptr m_dbService; + shared_ptr m_deviceStateService; + shared_ptr m_disinfectionCtrlService; + shared_ptr m_deviceIoControlService; + shared_ptr m_disinfectionLogsManager; + shared_ptr m_zcanhost; + shared_ptr m_dataExportService; + shared_ptr m_frontMsgProcesser; + + public: + SelfTestCmdImpl(){}; + void initialize(); + + private: +}; +} // namespace iflytop \ No newline at end of file diff --git a/api/cmds/test_page_cmd_impl.cpp b/api/cmds/test_page_cmd_impl.cpp index e86ab83..0ebc58b 100644 --- a/api/cmds/test_page_cmd_impl.cpp +++ b/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(cmd["r"]); + int g = jsonGet(cmd["g"]); + int b = jsonGet(cmd["b"]); + int w = jsonGet(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)); } diff --git a/api/cmds/test_page_cmd_impl.hpp b/api/cmds/test_page_cmd_impl.hpp index 458741e..eaa2a7b 100644 --- a/api/cmds/test_page_cmd_impl.hpp +++ b/api/cmds/test_page_cmd_impl.hpp @@ -53,5 +53,8 @@ class TestPageCmdImpl : public enable_shared_from_this { 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 \ No newline at end of file