Browse Source

添加popWinPage

v2
zhaohe 9 months ago
parent
commit
912c7c4bc6
  1. 30
      .cproject
  2. 4
      .settings/language.settings.xml
  3. 52
      .vscode/c_cpp_properties.json
  4. 35
      .vscode/c_cpp_properties.json copy 2.bak
  5. 3
      .vscode/settings.json
  6. 9
      hello.cpp
  7. 4
      uappbase/base.hpp
  8. 36
      uappbase/bean/appevent.h
  9. 47
      uappbase/bean/event.hpp
  10. 1
      uappbase/service/app_event_bus.cpp
  11. 2
      uappbase/service/gstate_mgr.cpp
  12. BIN
      ui/hand_acid_mainboard_ui.HMI
  13. 19
      ui/ui.h
  14. 2
      usrc/apphardware/apphardware.hpp
  15. 4
      usrc/db/type/device_setting.hpp
  16. 14
      usrc/service/app_core.cpp
  17. 30
      usrc/service/remote_controler_event_processer.cpp
  18. 1
      usrc/service/remote_controler_event_processer.hpp
  19. 9
      usrc/uicontroler/base/page_processer.cpp
  20. 9
      usrc/uicontroler/base/page_processer.hpp
  21. 0
      usrc/uicontroler/base/ui_public_state.cpp
  22. 14
      usrc/uicontroler/base/ui_public_state.hpp
  23. 42
      usrc/uicontroler/base/ui_state.cpp
  24. 26
      usrc/uicontroler/base/ui_state.hpp
  25. 8
      usrc/uicontroler/page/PageInitializer.cpp
  26. 2
      usrc/uicontroler/page/home_page.cpp
  27. 5
      usrc/uicontroler/page/navi_page.cpp
  28. 138
      usrc/uicontroler/page/popwin_page.cpp
  29. 2
      usrc/uicontroler/pagerouter/page_bak_router.cpp
  30. 1
      usrc/uicontroler/pagerouter/page_bak_router.hpp
  31. 109
      usrc/uicontroler/tjc/tjc_base_type.h
  32. 117
      usrc/uicontroler/tjc/tjc_constant.hpp
  33. 94
      usrc/uicontroler/ui_controler.cpp
  34. 22
      usrc/uicontroler/ui_controler.hpp

30
.cproject

@ -134,36 +134,6 @@
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.319958895" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
</toolChain>
</folderInfo>
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1853947771.256072517" name="/" resourcePath="usrc/uicontroler/page">
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.491694471" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug" unusedChildren="">
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.801178797.413757787" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.801178797"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.777915677.1128828774" name="CPU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.777915677"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.1126839807.1544882588" name="Core" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.1126839807"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.2045742466.2143889879" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.2045742466"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.2108401733.922458448" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.2108401733"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1574925555.1963979311" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1574925555"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.244221814.534851607" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.244221814"/>
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.764397174.1262549247" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock.764397174"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertbinary.992660821.517370878" name="Convert to binary file (-O binary)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertbinary.992660821"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.494792904.1165820831" name="Convert to Intel Hex file (-O ihex)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.494792904"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat.176411214.854480565" name="Use float with scanf from newlib-nano (-u _scanf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat.176411214"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.164943344.920114011" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.164943344"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.386899990.926107084" name="Toolchain" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.386899990"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1632255751" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1243726437"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1768689655" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.782799112"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1649365873" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.344817877"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.655672310" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.163881313"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.1042212218" name="MCU G++ Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.13625971"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.1406636191" name="MCU GCC Archiver" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.251758949"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.686313239" name="MCU Size" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.1663377731"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.2004824788" name="MCU Output Converter list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.1054983767"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.1431424075" name="MCU Output Converter Hex" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.959331179"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.1949386257" name="MCU Output Converter Binary" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.673967072"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.1494766544" name="MCU Output Converter Verilog" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.468761296"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.235362573" name="MCU Output Converter Motorola S-rec" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.1968696221"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.498555001" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.319958895"/>
</toolChain>
</folderInfo>
<fileInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1853947771.1288276238" name="zcanreceiver.hpp" rcbsApplicability="disable" resourcePath="stm32components/zcanreceiver/zcanreceiver.hpp" toolsToInvoke=""/>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>

4
.settings/language.settings.xml

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1290452739804114664" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1534615028576298921" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1305946972399269591" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1550109261171453848" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

52
.vscode/c_cpp_properties.json

@ -1,34 +1,42 @@
{
"configurations": [
{
"name": "app",
"name": "Win32",
"includePath": [
"./Core/Inc",
"./app_protocols",
"./Drivers/STM32F4xx_HAL_Driver/Inc",
"./Drivers/STM32F4xx_HAL_Driver/Inc/Legacy",
"./Middlewares/Third_Party/FreeRTOS/Source/include",
"./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS",
"./Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F",
"./Middlewares/ST/STM32_USB_Host_Library/Core/Inc/",
"USB_HOST/Target/",
"USB_HOST/App/",
"FATFS/App/",
"FATFS/Target/",
"Middlewares/Third_Party/FatFs/src/",
"Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc/",
"./Drivers/CMSIS/Device/ST/STM32F4xx/Include",
"./Drivers/CMSIS/Include",
"./usrc/",
"./"
"${workspaceFolder}/Core/Inc",
"${workspaceFolder}/app_protocols",
"${workspaceFolder}/Drivers/STM32F4xx_HAL_Driver/Inc",
"${workspaceFolder}/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy",
"${workspaceFolder}/Middlewares/Third_Party/FreeRTOS/Source/include",
"${workspaceFolder}/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS",
"${workspaceFolder}/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F",
"${workspaceFolder}/Middlewares/ST/STM32_USB_Host_Library/Core/Inc/",
"${workspaceFolder}/USB_HOST/Target/",
"${workspaceFolder}/USB_HOST/App/",
"${workspaceFolder}/FATFS/App/",
"${workspaceFolder}/FATFS/Target/",
"${workspaceFolder}/Middlewares/Third_Party/FatFs/src/",
"${workspaceFolder}/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc/",
"${workspaceFolder}/Drivers/CMSIS/Device/ST/STM32F4xx/Include",
"${workspaceFolder}/Drivers/CMSIS/Include",
"${workspaceFolder}/usrc/",
"${workspaceFolder}/"
],
"defines": [
"DEBUG",
"USE_HAL_DRIVER",
"STM32F407xx"
"STM32F407xx"
],
"compilerPath": "C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/arm-none-eabi-g++.exe",
"intelliSenseMode": "${default}"
"compilerPath": "C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256/tools/bin/arm-none-eabi-g++.exe",
"intelliSenseMode": "gcc-x64",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "",
"path": [
"${workspaceFolder}"
]
}
}
],
"version": 4

35
.vscode/c_cpp_properties.json copy 2.bak

@ -0,0 +1,35 @@
{
"configurations": [
{
"name": "app",
"includePath": [
"./Core/Inc",
"./app_protocols",
"./Drivers/STM32F4xx_HAL_Driver/Inc",
"./Drivers/STM32F4xx_HAL_Driver/Inc/Legacy",
"./Middlewares/Third_Party/FreeRTOS/Source/include",
"./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS",
"./Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F",
"./Middlewares/ST/STM32_USB_Host_Library/Core/Inc/",
"USB_HOST/Target/",
"USB_HOST/App/",
"FATFS/App/",
"FATFS/Target/",
"Middlewares/Third_Party/FatFs/src/",
"Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc/",
"./Drivers/CMSIS/Device/ST/STM32F4xx/Include",
"./Drivers/CMSIS/Include",
"./usrc/",
"./"
],
"defines": [
"DEBUG",
"USE_HAL_DRIVER",
"STM32F407xx"
],
"compilerPath": "C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256/tools/bin/arm-none-eabi-g++.exe",
"intelliSenseMode": "${default}"
}
],
"version": 4
}

3
.vscode/settings.json

@ -99,7 +99,8 @@
"file_operate.h": "c",
"fatfs.h": "c",
"stm32f4xx.h": "c",
"stm32f407xx.h": "c"
"stm32f407xx.h": "c",
"cstring": "cpp"
},
"files.autoGuessEncoding": false,
"files.encoding": "gb2312"

9
hello.cpp

@ -0,0 +1,9 @@
#include <stdio.h>
#include <iostream>
#include "ui/ui.h"
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}

4
uappbase/base.hpp

@ -2,8 +2,8 @@
#include "appdep.hpp"
#include "bean/bean.hpp"
#include "appcfg/appcfg.hpp"
//
// //
#include "service/app_event_bus.hpp"
#include "service/gstate_mgr.hpp"
//
// //
#include "apphal/apphal.hpp"

36
uappbase/bean/appevent.h

@ -0,0 +1,36 @@
#pragma once
#include <stdint.h>
#include "uicontroler/tjc/tjc_base_type.h"
typedef enum {
kAE_RunModeChangeEvent, //
kAppEvent_StateDisplayInfo,
kAppEvent_AcidChCfgChangeEvent,
// UI_EVENT
KAE_UIEvent,
kAE_LoginEvent,
kAE_unLoginEvent,
kAE_AcidStatChangeEvent, //
kAE_RemoterConnectedEvent, //
kAE_RemoterDisConnectedEvent, //
} AppEventType_t;
/**
*
* @
*
*/
typedef struct {
AppEventType_t type;
union {
uint32_t placeholder;
char bleName[20];
char stateDisplayInfo[30];
UIEvent uiEvent;
} d;
} AppEvent_t;

47
uappbase/bean/event.hpp

@ -3,53 +3,12 @@
#include <stdio.h>
#include <string.h>
#include <functional>
#include "uicontroler\tjc\tjc_constant.hpp"
extern "C" {
#include "appevent.h"
}
namespace iflytop {
using namespace std;
typedef enum {
kAE_RunModeChangeEvent, // 运行模式改变
kAppEvent_StateDisplayInfo,
kAppEvent_AcidChCfgChangeEvent,
// UI_EVENT
KAE_UIEvent,
kAE_LoginEvent,
kAE_unLoginEvent,
kAE_AcidStatChangeEvent, // 统计数据变化事件
kAE_RemoterConnectedEvent, // 遥控器连接成功
kAE_RemoterDisConnectedEvent, // 遥控器断开连接
} AppEventType_t;
/**
*
* @brief
*
*
* @
*
*/
typedef struct {
AppEventType_t type;
union event {
uint32_t placeholder;
char bleName[20];
char stateDisplayInfo[30];
tjc::UIEvent uiEvent;
} d;
} AppEvent_t;
static inline AppEvent_t createAppEvent(AppEventType_t type) {
AppEvent_t event;
event.type = type;
return event;
}
static inline AppEvent_t createStateDisplayInfoEvent(const char* info) {
AppEvent_t event;

1
uappbase/service/app_event_bus.cpp

@ -10,6 +10,7 @@ void AppEventBus::initialize() {
thread.init("AppEventBus", 1024);
xQueue = xQueueCreate(20, sizeof(AppEvent_t));
thread.start([this]() {
AppEvent_t event;
while (1) {

2
uappbase/service/gstate_mgr.cpp

@ -71,7 +71,7 @@ void GStateMgr::setRunMode(hand_acid_mode_t mode) {
zlock_guard l(m_mutex);
if (m_RunMode != mode) {
m_RunMode = mode;
AppEventBus::ins()->pushEvent(createAppEvent(kAE_RunModeChangeEvent));
AppEventBus::ins()->pushSimpleEvent(kAE_RunModeChangeEvent);
}
}
void GStateMgr::changeToNextRunMode() {

BIN
ui/hand_acid_mainboard_ui.HMI

19
ui/ui.h

@ -1,3 +1,4 @@
#pragma once
//pages
#define pg_gvar 0
#define pg_pStart 1
@ -13,7 +14,7 @@
#define pg_muDeviceInfo 11
#define pg_muAudit 12
#define pg_muPumpTest 13
#define pg_confirm 14
#define pg_popwin 14
#define pg_keybAcidCh 15
#define pg_keybdB 16
#define pg_keybdAP 17
@ -250,14 +251,14 @@
#define ob_muPumpTest_stop 12
#define ob_muPumpTest_pumpId 13
#define ob_muPumpTest_pumpIdTil 14
//confirm.objs
#define ob_confirm_confirm 0
#define ob_confirm_t0 1
#define ob_confirm_canclekey 2
#define ob_confirm_info 3
#define ob_confirm_confirmkey 4
#define ob_confirm_frompage 5
#define ob_confirm_t1 6
//popwin.objs
#define ob_popwin_popwin 0
#define ob_popwin_t0 1
#define ob_popwin_canclekey 2
#define ob_popwin_info 3
#define ob_popwin_confirmkey 4
#define ob_popwin_frompage 5
#define ob_popwin_t1 6
//keybAcidCh.objs
#define ob_keybAcidCh_keybAcidCh 0
#define ob_keybAcidCh_bak 1

2
usrc/apphardware/apphardware.hpp

@ -1,6 +1,6 @@
#pragma once
#include "uappbase/base.hpp"
#include "ucomponents/eeprom/m24m02_i2c_eeprom.hpp"
#include "ucomponents/eeprom/m24m02_i2c_eeprom.hpp"
namespace iflytop {

4
usrc/db/type/device_setting.hpp

@ -1,7 +1,3 @@
// kcfg_echDitrUpLi,
// kcfg_distrIntervalS, // 每次分配间隔时间
// kcfg_bleClientName,
#pragma once
#include "uappbase/base.hpp"

14
usrc/service/app_core.cpp

@ -11,8 +11,8 @@
//
#include "ucomponents/zcan/zcan.hpp"
//
#include "ui/ui.h"
#include "uicontroler/ui_controler.hpp"
// #include "uicontroler/page/page.hpp"
//
#include "uappbase/zhdb/zhdb.hpp"
@ -93,6 +93,10 @@ void AppCore::initialize() {
// 硬件初始化
AppHardware::ins()->initialize(); // 基础硬件初始化
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
ZLOGI(TAG, "load zhdb");
ZHDB::init();
UserDao::init();
@ -107,10 +111,10 @@ void AppCore::initialize() {
// UIControler::ins()->chpage(pg_login);
UIControler::ins()->chpage(pg_navi);
osDelay(1000);
UIControler::ins()->popWarningWin("警告!!!!!!!");
UIControler::ins()->popConfirmWin("消息确认!!!!!!!", [](bool val) { ZLOGI(TAG, "confirm val %d", val); });
UIControler::ins()->popInfoWin("消息确认!!!!!!!");
while (true) osDelay(30);
}

30
usrc/service/remote_controler_event_processer.cpp

@ -1,22 +1,19 @@
#include "remote_controler_event_processer.hpp"
#include "db/dao/device_setting_dao.hpp"
//
#include "pump_ctrl_service.hpp"
#include "service/remote_controler.hpp"
#include "uicontroler/ui_controler.hpp"
#include "ui/ui.h"
//
#include "uicontroler/ui_controler.hpp"
using namespace iflytop;
#define TAG "RemoteControlerEventProcesser"
static const char* zhex2str(uint8_t* data, size_t len) {
static char buf[256];
memset(buf, 0, sizeof(buf));
for (size_t i = 0; i < len; i++) {
sprintf(buf + i * 2, "%02X", data[i]);
}
return buf;
}
static const char* zhex2str(uint8_t* data, size_t len);
void RemoteControlerEventProcesser::initialize() {
m_thread.init(TAG);
@ -109,7 +106,7 @@ void RemoteControlerEventProcesser::processKeyEventFromRemoter(hand_acid_remoter
* @brief
*/
if (UIS->getNowPage() != pg_home) {
UIS->alert("请先切换到首页,在控制设备");
UIS->popWarningWin("请先切换到首页,在控制设备");
return;
}
@ -119,7 +116,7 @@ void RemoteControlerEventProcesser::processKeyEventFromRemoter(hand_acid_remoter
if (keyEvent == hand_acid_remoter_kevent_add_liquid) {
//
if (!GSM->isHasPumpSelect()) {
UIS->alert("请至少选中一个通道");
UIS->popWarningWin("请至少选中一个通道");
return;
}
@ -141,9 +138,18 @@ void RemoteControlerEventProcesser::processKeyEventFromRemoter(hand_acid_remoter
} else if (keyEvent == hand_acid_remoter_kevent_preFilling) {
// 管路填充
if (!GSM->isHasPumpSelect()) {
UIS->alert("请至少选中一个通道");
UIS->popWarningWin("请至少选中一个通道");
return;
}
PUMPCS->acidPrefilling();
}
}
static const char* zhex2str(uint8_t* data, size_t len) {
static char buf[256];
memset(buf, 0, sizeof(buf));
for (size_t i = 0; i < len; i++) {
sprintf(buf + i * 2, "%02X", data[i]);
}
return buf;
}

1
usrc/service/remote_controler_event_processer.hpp

@ -4,7 +4,6 @@
#include "uappbase/base.hpp"
#include "config/config.hpp"
namespace iflytop {
using namespace std;
/**
* @brief
*

9
usrc/uicontroler/base/page_processer.cpp

@ -30,17 +30,16 @@ void IPageProcesser::initialize() {
return;
}
if (event->d.uiEvent.eventId == tjc::kpt_sys_event_page_id) {
if (event->d.uiEvent.eventId == kpt_sys_event_page_id) {
OnPageLoadContext cxt = {0};
OnPageLoad(&cxt);
} else if (event->d.uiEvent.eventId == tjc::kpt_double_state_button_event) {
} else if (event->d.uiEvent.eventId == kpt_double_state_button_event) {
OnDoubleStateButton(event->d.uiEvent.bid, event->d.uiEvent.d.double_state_button.val);
} else if (event->d.uiEvent.eventId == tjc::kpt_button_event) {
} else if (event->d.uiEvent.eventId == kpt_button_event) {
OnButton(event->d.uiEvent.bid, event->d.uiEvent.d.button_event.val);
} else if (event->d.uiEvent.eventId == tjc::kpt_inputfield_content_change_event1) {
} else if (event->d.uiEvent.eventId == kpt_inputfield_content_change_event1) {
OnInputFieldContentChange(event->d.uiEvent.bid, event->d.uiEvent.d.inputfield_content.text);
}
//
} else {
OnAppEvent(event);

9
usrc/uicontroler/base/page_processer.hpp

@ -1,11 +1,16 @@
#pragma once
#include <stdint.h>
#include "apphardware/apphardware.hpp"
#include "config/config.hpp"
#include "uappbase/base.hpp"
#include "uappbase\bean\event.hpp"
#include "ui/ui.h"
//
#include "apphardware/apphardware.hpp"
#include "uicontroler/ui_controler.hpp"
#include "uicontroler/pagerouter/page_bak_router.hpp"
// #include "uicontroler/pagerouter/page_bak_router.hpp"
namespace iflytop {
using namespace std;

0
usrc/uicontroler/base/ui_public_state.cpp

14
usrc/uicontroler/base/ui_public_state.hpp

@ -1,14 +0,0 @@
#pragma once
#include "uappbase/base.hpp"
#include "uicontroler/ui_controler.hpp"
namespace iflytop {
class UIPublicState {
private:
/* data */
public:
};
} // namespace iflytop

42
usrc/uicontroler/base/ui_state.cpp

@ -0,0 +1,42 @@
#include "ui_state.hpp"
using namespace iflytop;
static QueueHandle_t xQueue;
static int popInfoNum;
static zmutex lock = {"UIPublicState-Lock"};
#define TAG "UIPublicState"
void UIPublicState::initialize() { //
xQueue = xQueueCreate(5, sizeof(UIPopInfo_t));
ZASSERT(xQueue);
lock.init();
}
void UIPublicState::pushUIPopInfo(UIPopWinType_t type, const char* info, function<void(bool)> onConfirm) {
zlock_guard guard(lock);
static UIPopInfo_t popInfo;
popInfo.type = type;
strncpy(popInfo.info, info, sizeof(popInfo.info));
popInfo.onConfirm = onConfirm;
BaseType_t suc = xQueueSend(xQueue, &popInfo, 0);
if (suc == 0) {
ZLOGE(TAG, "pushUIPopInfo failed");
if (onConfirm) onConfirm(false);
}
popInfoNum++;
}
bool UIPublicState::popUIPopInfoBlock(UIPopInfo_t* info) {
BaseType_t suc = xQueueReceive(xQueue, info, 100);
if (suc != 0) {
{
zlock_guard guard(lock);
popInfoNum--;
}
return true;
}
return false;
}
int UIPublicState::getPopInfoNum() { return popInfoNum; }

26
usrc/uicontroler/base/ui_state.hpp

@ -0,0 +1,26 @@
#pragma once
#include "uappbase/base.hpp"
namespace iflytop {
typedef enum {
UI_POP_WIN_TYPE_INFO,
UI_POP_WIN_TYPE_WARNING_INFO,
UI_POP_WIN_TYPE_CONFIRM,
UI_POP_WIN_TYPE_FATAL_ERROR,
} UIPopWinType_t;
typedef struct {
UIPopWinType_t type;
char info[100];
function<void(bool)> onConfirm;
} UIPopInfo_t;
class UIPublicState {
public:
static void initialize();
static void pushUIPopInfo(UIPopWinType_t type, const char* info, function<void(bool)> onConfirm);
static bool popUIPopInfoBlock(UIPopInfo_t* info);
static int getPopInfoNum();
};
} // namespace iflytop

8
usrc/uicontroler/page/PageInitializer.cpp

@ -1,8 +0,0 @@
#include "uicontroler/base/page_processer.hpp"
namespace iflytop {
using namespace std;
} // namespace iflytop
// kpt_sys_event_page_id

2
usrc/uicontroler/page/home_page.cpp

@ -54,7 +54,7 @@ class HomePage : public IPageProcesser {
virtual void OnButton(uint8_t bid, uint8_t val) override {
ZLOGI(TAG, "OnButton bid:%d val:%d", bid, val);
if (PumpCtrlService::ins()->isWorking()) {
UIS->alert("工作中,请稍后再操作");
UIS->popWarningWin("工作中,请稍后再操作");
return;
}

5
usrc/uicontroler/page/navi_page.cpp

@ -1,5 +1,5 @@
#include "db/dao/user_dao.hpp"
// #include "db/dao/user_dao.hpp"
#include "ui/ui.h"
#include "uicontroler/base/page_processer.hpp"
namespace iflytop {
@ -12,11 +12,12 @@ class NaviPage : public IPageProcesser {
char passwd[20] = {0};
public:
NaviPage() : IPageProcesser(TAG, pg_login) {}
NaviPage() : IPageProcesser(TAG, pg_navi) {}
virtual void initialize() override {
IPageProcesser::initialize();
syncState();
}
private:

138
usrc/uicontroler/page/popwin_page.cpp

@ -0,0 +1,138 @@
#include "ui/ui.h"
#include "uicontroler/base/page_processer.hpp"
#include "uicontroler/base/ui_state.hpp"
using namespace iflytop;
using namespace std;
#define TAG "PopWinPage"
static UIPopInfo_t hangupInfo;
static bool handupInfoFlag = false;
static int lastPage = 0;
static int displayNum = 0;
class PopWinPage : public IPageProcesser {
private:
ZThread thread;
public:
PopWinPage() : IPageProcesser(TAG, pg_popwin) {}
virtual void initialize() override {
IPageProcesser::initialize();
syncState();
thread.init("PopWinPage", 512);
thread.start([this]() {
while (true) {
if (handupInfoFlag) {
osDelay(300);
updatePopWindowsInfo(&hangupInfo);
} else {
if (UIPublicState::popUIPopInfoBlock(&hangupInfo)) {
ZLOGI(TAG, "PopWinPage info:%s", hangupInfo.info);
initPopWindowsInfo(&hangupInfo);
}
}
}
});
}
private:
virtual void OnPageLoad(OnPageLoadContext* cxt) override {}
virtual void OnBackKey(OnPageLoadContext* cxt) override {}
virtual void OnInputFieldContentChange(uint8_t bid, const char* text) override {}
virtual void OnButton(uint8_t bid, uint8_t val) override {
//
int num = UIPublicState::getPopInfoNum();
if (bid == ob_popwin_canclekey) {
if (hangupInfo.onConfirm) {
hangupInfo.onConfirm(false);
}
} else if (bid == ob_popwin_confirmkey) {
if (hangupInfo.onConfirm) {
hangupInfo.onConfirm(true);
}
}
if (num <= 0) {
UIControler::ins()->chpage(lastPage);
}
handupInfoFlag = false;
}
virtual void OnDoubleStateButton(uint8_t bid, uint8_t val) override {}
virtual void OnAppEvent(AppEvent_t* event) override {}
void updatePopWindowsInfo(UIPopInfo_t* info) {
int num = UIPublicState::getPopInfoNum();
if (num != displayNum) {
displayNum = num;
if (info->type == UI_POP_WIN_TYPE_INFO) {
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "消息(%d)", displayNum + 1);
} else if (info->type == UI_POP_WIN_TYPE_WARNING_INFO) {
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "警告(%d)", displayNum + 1);
} else if (info->type == UI_POP_WIN_TYPE_CONFIRM) {
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "消息(%d)", displayNum + 1);
} else if (info->type == UI_POP_WIN_TYPE_FATAL_ERROR) {
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "警告(%d)", displayNum + 1);
}
}
}
void initPopWindowsInfo(UIPopInfo_t* info) {
if (UIControler::ins()->getNowPage() != pageId) {
lastPage = UIControler::ins()->getNowPage();
}
handupInfoFlag = true;
displayNum = UIPublicState::getPopInfoNum();
UIControler::ins()->chpage(pg_popwin);
if (info->type == UI_POP_WIN_TYPE_INFO) {
// 消息
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "消息(%d)", displayNum + 1);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_t1, 10591 /*蓝色*/);
UIControler::ins()->setTxt(pageId, ob_popwin_info, info->info);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_info, 0 /*黑色*/);
UIControler::ins()->vis(ob_popwin_canclekey, 0);
} else if (info->type == UI_POP_WIN_TYPE_WARNING_INFO) {
// 警告消息
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "警告(%d)", displayNum + 1);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_t1, 63488 /*红色*/);
UIControler::ins()->setTxt(pageId, ob_popwin_info, info->info);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_info, 63488 /*红色*/);
UIControler::ins()->vis(ob_popwin_canclekey, 0);
} else if (info->type == UI_POP_WIN_TYPE_CONFIRM) {
// 确认(可被取消)
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "消息(%d)", displayNum + 1);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_t1, 10591 /*蓝色*/);
UIControler::ins()->setTxt(pageId, ob_popwin_info, info->info);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_info, 0 /*黑色*/);
UIControler::ins()->vis(ob_popwin_canclekey, 1);
} else if (info->type == UI_POP_WIN_TYPE_FATAL_ERROR) {
// 警告消息
UIControler::ins()->setTxt(pageId, ob_popwin_t1, "警告(%d)", displayNum + 1);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_t1, 63488 /*红色*/);
UIControler::ins()->setTxt(pageId, ob_popwin_info, info->info);
UIControler::ins()->sendcmd("p[%d].b[%d].pco=%d", pageId, ob_popwin_info, 63488 /*红色*/);
UIControler::ins()->vis(ob_popwin_canclekey, 0);
UIControler::ins()->vis(ob_popwin_confirmkey, 0);
}
}
private:
void syncState() {}
};
// 实例化LoginPage, 使其自动注册
static PopWinPage instance;

2
usrc/uicontroler/pagerouter/page_bak_router.cpp

@ -23,7 +23,7 @@ int getBakPage(int nowPage) {
// ) {
// return pg_muSettings;
// }
return pg_home;
return 0;
}
} // namespace iflytop

1
usrc/uicontroler/pagerouter/page_bak_router.hpp

@ -1,7 +1,6 @@
#pragma once
#include "apphardware/apphardware.hpp"
#include "uappbase/base.hpp"
#include "uicontroler/ui_controler.hpp"
#include "config/config.hpp"
namespace iflytop {
int getBakPage(int nowPage);

109
usrc/uicontroler/tjc/tjc_base_type.h

@ -0,0 +1,109 @@
#pragma once
#include <stdint.h>
/**
* @brief
*
*
* 1.15
* 2.14
* 3.14
* 4.6
*
*
* 1.
* 2. sendme指令
* 2.
*
*
*
* 使
*
*
*
*
*/
#define MAX_USR_PASSWD_LENGTH (6)
#define ELEMENT_ID_MAX_SIZE 14
#define TJC_MAX_PACKET_SIZE 256
typedef enum {
/**
* @brief
*/
kpt_sys_ecode_invalid = 0x00,
kpt_sys_ecode_suc = 0x01,
kpt_sys_ecode_invalid_control_id = 0x02,
kpt_sys_ecode_invalid_page_id = 0x03,
kpt_sys_ecode_invalid_image_id = 0x04,
kpt_sys_ecode_invalid_font_id = 0x05,
kpt_sys_ecode_file_op_failed = 0x06,
kpt_sys_ecode_crc_failed = 0x09,
kpt_sys_ecode_invalid_baudrate = 0x11,
kpt_sys_ecode_invalid_curve_id = 0x12,
kpt_sys_ecode_invalid_var_name = 0x1A,
kpt_sys_ecode_invalid_var_op = 0x1B,
kpt_sys_ecode_var_op_failed = 0x1C,
kpt_sys_ecode_flash_op_failed = 0x1D,
kpt_sys_ecode_invalid_param_num = 0x1E,
kpt_sys_ecode_io_op_failed = 0x1F,
kpt_sys_ecode_escape_char_failed = 0x20,
kpt_sys_ecode_var_name_too_long = 0x23,
kpt_sys_ecode_serial_buf_overflow = 0x24,
/**
* @brief
*/
kpt_button_event = 0x65, //
kpt_sys_event_page_id = 0x66, //
kpt_sys_event_touch_data = 0x67,
kpt_sys_event_sleep_touch = 0x68,
kpt_sys_event_string_var = 0x70,
kpt_sys_event_number_var = 0x71,
kpt_sys_event_sleep_mode = 0x86,
kpt_sys_event_auto_wakeup = 0x87,
kpt_sys_event_sys_start = 0x88,
kpt_sys_event_sd_upgrade = 0x89,
kpt_sys_event_passthrough_finish = 0xFD,
kpt_sys_event_passthrough_ready = 0xFE,
/**
* @brief
*/
kpt_ack = 0xAA,
//
kpt_inputfield_content_change_event1 = 0xAC, //
kpt_double_state_button_event = 0xAD,
kpt_bakup_button_event = 0xB0, //
} tjc_packet_type_t;
typedef enum {
kbutton_release = 0,
kbutton_press = 1,
} button_event_t;
typedef enum {
k_button_release_event = 1,
k_input_confirm_event = 2,
} usr_event_type_t;
typedef struct {
int32_t eventId;
uint8_t pid;
uint8_t bid;
union {
// inputfield_content_event
struct {
char text[TJC_MAX_PACKET_SIZE];
} inputfield_content;
// kpt_double_state_button_event
struct {
uint8_t val;
} double_state_button;
struct {
uint8_t val; // 0 1
} button_event;
} d;
} UIEvent;

117
usrc/uicontroler/tjc/tjc_constant.hpp

@ -1,123 +1,12 @@
#pragma once
#include <stdint.h>
#include "../ui/ui.h"
#include "uappbase/appcfg/appcfg.hpp"
extern "C" {
#include "tjc_base_type.h"
}
namespace tjc {
/**
* @brief
*
*
* 1.15
* 2.14
* 3.14
* 4.6
*
*
* 1.
* 2. sendme指令
* 2.
*
*
*
* 使
*
*
*
*
*/
#define MAX_USR_PASSWD_LENGTH (6)
#define ELEMENT_ID_MAX_SIZE 14
#define TJC_MAX_PACKET_SIZE 256
typedef enum {
/**
* @brief
*/
kpt_sys_ecode_invalid = 0x00,
kpt_sys_ecode_suc = 0x01,
kpt_sys_ecode_invalid_control_id = 0x02,
kpt_sys_ecode_invalid_page_id = 0x03,
kpt_sys_ecode_invalid_image_id = 0x04,
kpt_sys_ecode_invalid_font_id = 0x05,
kpt_sys_ecode_file_op_failed = 0x06,
kpt_sys_ecode_crc_failed = 0x09,
kpt_sys_ecode_invalid_baudrate = 0x11,
kpt_sys_ecode_invalid_curve_id = 0x12,
kpt_sys_ecode_invalid_var_name = 0x1A,
kpt_sys_ecode_invalid_var_op = 0x1B,
kpt_sys_ecode_var_op_failed = 0x1C,
kpt_sys_ecode_flash_op_failed = 0x1D,
kpt_sys_ecode_invalid_param_num = 0x1E,
kpt_sys_ecode_io_op_failed = 0x1F,
kpt_sys_ecode_escape_char_failed = 0x20,
kpt_sys_ecode_var_name_too_long = 0x23,
kpt_sys_ecode_serial_buf_overflow = 0x24,
/**
* @brief
*/
kpt_button_event = 0x65, // 普通按键
kpt_sys_event_page_id = 0x66, // 页面变化事件
kpt_sys_event_touch_data = 0x67,
kpt_sys_event_sleep_touch = 0x68,
kpt_sys_event_string_var = 0x70,
kpt_sys_event_number_var = 0x71,
kpt_sys_event_sleep_mode = 0x86,
kpt_sys_event_auto_wakeup = 0x87,
kpt_sys_event_sys_start = 0x88,
kpt_sys_event_sd_upgrade = 0x89,
kpt_sys_event_passthrough_finish = 0xFD,
kpt_sys_event_passthrough_ready = 0xFE,
/**
* @brief
*/
kpt_ack = 0xAA,
//
kpt_inputfield_content_change_event1 = 0xAC, // 跨页面键盘输入事件
kpt_double_state_button_event = 0xAD,
kpt_bakup_button_event = 0xB0, // 返回按键
} packet_type_t;
typedef enum {
kbutton_release = 0,
kbutton_press = 1,
} button_event_t;
typedef struct {
int32_t eventId;
uint8_t pid;
uint8_t bid;
union {
// inputfield_content_event
struct {
char text[TJC_MAX_PACKET_SIZE];
} inputfield_content;
// kpt_double_state_button_event
struct {
uint8_t val;
} double_state_button;
struct {
uint8_t val; // 0 抬起,1按下
} button_event;
} d;
} UIEvent;
typedef enum {
k_button_release_event = 1,
k_input_confirm_event = 2,
} usr_event_type_t;
const char* pt2str(uint8_t type);
const char* uimarco2str(uint8_t pid, uint8_t bid);
const char* pageName(uint8_t page);
#define UI_UUID(pgid, obid) ((pg_##pgid << 8) + ob_##pgid##_##obid)
} // namespace tjc

94
usrc/uicontroler/ui_controler.cpp

@ -38,8 +38,17 @@ void UIControler::initialize() { //
eventProcessThread.init("eventProcessThread", 1024);
tjcUart = AppHardware::ins()->tjcUart;
UIPublicState::initialize();
m_cmdlock.init();
}
void UIControler::callUsrEventCb(UIEvent* event) {
static AppEvent_t appEvent;
appEvent.type = KAE_UIEvent;
memcpy(&appEvent.d.uiEvent, event, sizeof(UIEvent));
AppEventBus::ins()->pushEvent(appEvent);
}
#define UART_RX_OVERTIME 5
void UIControler::startSchedule() {
usartRxThread.start([this]() {
@ -78,17 +87,17 @@ void UIControler::startSchedule() {
uint8_t packetType = packet.data[0];
memset(&event_cache, 0, sizeof(event_cache));
if (packetType == tjc::kpt_inputfield_content_change_event1) {
if (packetType == kpt_inputfield_content_change_event1) {
processInputfieldContentChangeEvent1(packet.data, packet.datalen);
} else if (packetType == tjc::kpt_double_state_button_event) {
} else if (packetType == kpt_double_state_button_event) {
processUsrDoubleStateButtonEvent(packet.data, packet.datalen);
} else if (tjc::kpt_button_event == packetType) {
} else if (kpt_button_event == packetType) {
event_cache.eventId = packet.data[0];
event_cache.pid = packet.data[1];
event_cache.bid = packet.data[2];
event_cache.d.button_event.val = packet.data[3];
callUsrEventCb(&event_cache);
} else if (tjc::kpt_sys_event_page_id == packetType) {
} else if (kpt_sys_event_page_id == packetType) {
event_cache.eventId = packet.data[0];
event_cache.pid = packet.data[1];
event_cache.bid = 0;
@ -98,13 +107,12 @@ void UIControler::startSchedule() {
} else {
m_lastPage = m_nowPage;
m_nowPage = packet.data[1];
}
#if MODULE_DEBUG
ZLOGD(TAG, "page change from %d to %d ", m_lastPage, m_nowPage);
ZLOGD(TAG, "page change from %d to %d ", m_lastPage, m_nowPage);
#endif
}
callUsrEventCb(&event_cache);
} else {
event_cache.eventId = packet.data[0];
callUsrEventCb(&event_cache);
@ -136,7 +144,7 @@ void UIControler::processScreenRxPacket(uint8_t* data, size_t len) {
static tjc_rx_packet_t packet;
packet.datalen = len;
memcpy(packet.data, data, len);
if (tjc::kpt_ack == packetType) {
if (kpt_ack == packetType) {
if (m_isWaitingForAck) {
bool suc = ackQueue.send(&packet, 10);
if (!suc) {
@ -210,12 +218,7 @@ void UIControler::processUsrDoubleStateButtonEvent(uint8_t* data, size_t len) {
callUsrEventCb(&event_cache);
}
void UIControler::callUsrEventCb(tjc::UIEvent* event) {
static AppEvent_t appEvent;
appEvent.type = KAE_UIEvent;
memcpy(&appEvent.d.uiEvent, event, sizeof(tjc::UIEvent));
AppEventBus::ins()->pushEvent(appEvent);
}
void UIControler::processInputfieldContentChangeEvent0(uint8_t* data, size_t len) {
/**
@ -383,71 +386,12 @@ void UIControler::setrtc(zdate_t* date) {
sendcmd("rtc5=%d", date->seconds);
}
void UIControler::alert(const char* info, function<void(bool)> onConfirm) {
zlock_guard lg(m_cmdlock);
// if (m_isInPopWin) {
// ZLOGE(TAG, "isInPopWin,alert failed");
// return;
// }
// m_onAlertPageConfirmKey = onConfirm;
// static char buf[128];
// sprintf(buf, "%s", info);
// sendcmd("p[%d].b[%d].val=%d", pg_alert, ob_alert_frompage, m_nowPage);
// sendcmd("p[%d].b[%d].txt=\"%s\"", pg_alert, ob_alert_info, buf);
// sendcmd("page alert");
}
void UIControler::alertNoConfirm(const char* info) {
void UIControler::popWin(UIPopWinType_t type, const char* info, function<void(bool)> onConfirm) {
zlock_guard lg(m_cmdlock);
// if (m_isInPopWin) {
// ZLOGE(TAG, "isInPopWin,alertNoConfirm failed");
// return;
// }
// static char buf[128];
// sprintf(buf, "%s", info);
// sendcmd("p[%d].b[%d].val=dp", pg_alert, ob_alert_frompage);
// sendcmd("p[%d].b[%d].txt=\"%s\"", pg_alert, ob_alert_info, buf);
// sendcmd("page alert");
// vis(ob_alert_confirmkey, 0);
UIPublicState::pushUIPopInfo(type, info, onConfirm);
}
void UIControler::confirmNoCancle(const char* info, function<void(bool)> onConfirm) {
zlock_guard lg(m_cmdlock);
// if (m_isInPopWin) {
// ZLOGE(TAG, "isInPopWin,confirmNoCancle failed");
// return;
// }
// m_onConfirmPageConfirmKey = onConfirm;
// static char buf[128];
// sprintf(buf, "%s", info);
// sendcmd("p[%d].b[%d].val=dp", pg_confirm, ob_confirm_frompage);
// sendcmd("p[%d].b[%d].txt=\"%s\"", pg_confirm, ob_confirm_info, buf);
// sendcmd("page confirm");
// vis(ob_confirm_canclekey, 0);
}
void UIControler::confirm(const char* info, function<void(bool)> onConfirm) {
zlock_guard lg(m_cmdlock);
// if (m_isInPopWin) {
// ZLOGE(TAG, "isInPopWin,confirm failed");
// return;
// }
// m_onConfirmPageConfirmKey = onConfirm;
// static char buf[128];
// sprintf(buf, "%s", info);
// sendcmd("p[%d].b[%d].val=dp", pg_confirm, ob_confirm_frompage);
// sendcmd("p[%d].b[%d].txt=\"%s\"", pg_confirm, ob_confirm_info, buf);
// sendcmd("page confirm");
// vis(ob_confirm_canclekey, 1);
}
void UIControler::chpage(uint8_t page) { sendcmd("page %d", page); }
// void UIControler::bakpage() { sendcmd("page %d", m_lastPage); }

22
usrc/uicontroler/ui_controler.hpp

@ -4,6 +4,7 @@
#include "uappbase/base.hpp"
//
#include "tjc/tjc.hpp"
#include "uicontroler/base/ui_state.hpp"
namespace iflytop {
using namespace std;
@ -19,7 +20,7 @@ class UIControler {
tjc_rx_packet_t ackcache;
zmutex m_cmdlock = {"UI_LOCK"};
tjc::UIEvent event_cache;
UIEvent event_cache;
int32_t m_nowPage = 0;
int32_t m_lastPage = 0;
@ -49,18 +50,20 @@ class UIControler {
void setPicturePicNum(uint8_t pid, uint8_t bid, uint8_t fromBid);
void setButtonPicNum(uint8_t pid, uint8_t bid, uint8_t fromBid);
bool setVal(uint8_t pid, uint8_t bid, int32_t val);
bool vis(uint16_t bid, int32_t val); // ²»Ö§³Ö¿çÒ³ÃæÒþ²Ø
// vis b0,0
void popWin(UIPopWinType_t type, const char* info, function<void(bool)> onConfirm);
void popWarningWin(const char* info) { popWin(UI_POP_WIN_TYPE_WARNING_INFO, info, nullptr); }
void popConfirmWin(const char* info, function<void(bool)> onConfirm) { popWin(UI_POP_WIN_TYPE_CONFIRM, info, onConfirm); }
void popInfoWin(const char* info) { popWin(UI_POP_WIN_TYPE_INFO, info, nullptr); }
void alert(const char* info) { alert(info, nullptr); }
void alertNoConfirm(const char* info);
void alert(const char* info, function<void(bool)> onConfirm);
void confirmNoCancle(const char* info) { confirmNoCancle(info, nullptr); }
void confirmNoCancle(const char* info, function<void(bool)> onConfirm);
void confirm(const char* info, function<void(bool)> onConfirm);
// void alertNoConfirm(const char* info);
// void alert(const char* info, function<void(bool)> onConfirm);
// void confirmNoCancle(const char* info) { confirmNoCancle(info, nullptr); }
// void confirmNoCancle(const char* info, function<void(bool)> onConfirm);
// void confirm(const char* info, function<void(bool)> onConfirm);
void chpage(uint8_t page);
void setrtc(zdate_t* date);
@ -83,8 +86,7 @@ class UIControler {
void processUsrDoubleStateButtonEvent(uint8_t* data, size_t len);
void startReceiveAck();
void callUsrEventCb(tjc::UIEvent* event);
void callUsrEventCb(UIEvent* event);
};
static inline const char* zitoa(int val) {

Loading…
Cancel
Save