From 0874656f06f8f9b47fadc85bebee22877dc24970 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 24 May 2024 15:52:15 +0800 Subject: [PATCH] update --- iflytoplinuxsdk | 2 +- src/api/cmds/selftest_cmd_impl.cpp | 2 +- src/api/cmds/selftest_cmd_impl.hpp | 1 + src/api/cmds/test_page_cmd_impl.cpp | 15 +++++++++++++++ src/api/cmds/test_page_cmd_impl.hpp | 2 ++ src/main.cpp | 6 ++++++ src/service/device_io_control_service.cpp | 6 ++++-- 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/iflytoplinuxsdk b/iflytoplinuxsdk index a69faba..aee7987 160000 --- a/iflytoplinuxsdk +++ b/iflytoplinuxsdk @@ -1 +1 @@ -Subproject commit a69fabaacf14348ad2913136f417397e0fea4462 +Subproject commit aee79871ce50d2f4f636dc28971e51351cfab1d7 diff --git a/src/api/cmds/selftest_cmd_impl.cpp b/src/api/cmds/selftest_cmd_impl.cpp index 2e9212d..9c1edf0 100644 --- a/src/api/cmds/selftest_cmd_impl.cpp +++ b/src/api/cmds/selftest_cmd_impl.cpp @@ -69,4 +69,4 @@ void SelfTestCmdImpl::selfTest_setEvaporationBinWaterDetection(json& cmd, json& #if (defined PROJECT_TYPE_LARGE_SPACE_DISINFECTION) || (defined PROJECT_TYPE_SMALL_SPACE_DISINFECTION) || (defined PROJECT_TYPE_PIPE_DISINFECTION) p->selfTest_setEvaporationBinWaterDetection(val); #endif -} \ No newline at end of file +} diff --git a/src/api/cmds/selftest_cmd_impl.hpp b/src/api/cmds/selftest_cmd_impl.hpp index cb43f0d..7407c2e 100644 --- a/src/api/cmds/selftest_cmd_impl.hpp +++ b/src/api/cmds/selftest_cmd_impl.hpp @@ -52,6 +52,7 @@ class SelfTestCmdImpl : public enable_shared_from_this { void selfTest_setH2O2Val(json& cmd, json& receipt); void selfTest_setDeviceBottomWaterDetectionSensor(json& cmd, json& receipt); void selfTest_setEvaporationBinWaterDetection(json& cmd, json& receipt); + private: }; } // namespace iflytop \ No newline at end of file diff --git a/src/api/cmds/test_page_cmd_impl.cpp b/src/api/cmds/test_page_cmd_impl.cpp index 018e707..2a982bb 100644 --- a/src/api/cmds/test_page_cmd_impl.cpp +++ b/src/api/cmds/test_page_cmd_impl.cpp @@ -166,4 +166,19 @@ void TestPageCmdImpl::initialize() { m_msgProcesser->registerMsgProcesser("DBDBTestPage__extValBoardIsOnline", BIND(TestPageCmdImpl::DBDBTestPage__extValBoardIsOnline)); #endif + + m_msgProcesser->registerMsgProcesser("TestPage_printerTest", BIND(TestPageCmdImpl::TestPage_printerTest)); +} + +void TestPageCmdImpl::TestPage_printerTest(json& cmd, json& receipt) { + logger->info("TestPage_printerTest"); + m_deviceIoControlService->printerPrintf("你好中国\n"); + m_deviceIoControlService->printerPrintf("abcdefghijklmnopqrstuvwxyz\n"); + m_deviceIoControlService->printerPrintf("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"); + m_deviceIoControlService->printerPrintf("0123456789\n"); + m_deviceIoControlService->printerPrintf("+_)(*&^%$#@!~`-=[]\\{}|;':\",./<>?\n"); + m_deviceIoControlService->printerPrintf("\n"); + m_deviceIoControlService->printerPrintf("\n"); + m_deviceIoControlService->printerPrintf("\n"); + return; } diff --git a/src/api/cmds/test_page_cmd_impl.hpp b/src/api/cmds/test_page_cmd_impl.hpp index 83e2ff2..83ad025 100644 --- a/src/api/cmds/test_page_cmd_impl.hpp +++ b/src/api/cmds/test_page_cmd_impl.hpp @@ -76,5 +76,7 @@ class TestPageCmdImpl : public enable_shared_from_this { void DBDBTestPage__extValveCtrl(json& cmd, json& receipt); void DBDBTestPage__extValBoardIsOnline(json& cmd, json& receipt); #endif + + void TestPage_printerTest(json& cmd, json& receipt); }; } // namespace iflytop \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 3a29cc3..f4a04d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include #include "iflytop/components/uart_printer/uart_printer.hpp" +#include "configs/project_setting.hpp" using namespace iflytop; using namespace core; @@ -47,7 +48,12 @@ int Main::main(int argc, char *argv[]) { g_in_test = GET_SERVICE(GConfig)->get_testMode(); BUILD_AND_REG_SERRVICE(UartPrinter); + +#ifdef PROJECT_TYPE_DRAW_BAR_BOX + GET_SERVICE(UartPrinter)->initialize("/dev/ttyUSB0", "9600"); +#else GET_SERVICE(UartPrinter)->initialize("/dev/ttyS5", "9600"); +#endif /** * @brief diff --git a/src/service/device_io_control_service.cpp b/src/service/device_io_control_service.cpp index 6b38a12..ad6a0b3 100644 --- a/src/service/device_io_control_service.cpp +++ b/src/service/device_io_control_service.cpp @@ -12,7 +12,6 @@ using namespace iflytop; using namespace std; - static inline int filter(int data) { static list q; q.push_back(data); @@ -219,7 +218,10 @@ void DeviceIoControlService::startScan() { * SensorState * *******************************************************************************/ -void DeviceIoControlService::printerPrintf(string str) { GET_SERVICE(UartPrinter)->print(ZIconv::utf8_to_gb2312(str)); } +void DeviceIoControlService::printerPrintf(string str) { + logger->info("{}", str); + GET_SERVICE(UartPrinter)->print(ZIconv::utf8_to_gb2312(str)); +} void DeviceIoControlService::processReportPacket(uint8_t* packet, size_t len) { // auto* cmdpacket = (transmit_disinfection_protocol_header_t*)packet;