diff --git a/.cproject b/.cproject
index 8f9b407..fcc79fc 100644
--- a/.cproject
+++ b/.cproject
@@ -134,36 +134,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 1eb30e0..adb54ce 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index 87ff7e7..e3dae62 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.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
diff --git a/.vscode/c_cpp_properties.json copy 2.bak b/.vscode/c_cpp_properties.json copy 2.bak
new file mode 100644
index 0000000..c69b89f
--- /dev/null
+++ b/.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
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 3b7456f..95b1834 100644
--- a/.vscode/settings.json
+++ b/.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"
diff --git a/hello.cpp b/hello.cpp
new file mode 100644
index 0000000..a3bb1db
--- /dev/null
+++ b/hello.cpp
@@ -0,0 +1,9 @@
+#include
+#include
+#include "ui/ui.h"
+
+int main() {
+ std::cout << "Hello, World!" << std::endl;
+ return 0;
+
+}
\ No newline at end of file
diff --git a/uappbase/base.hpp b/uappbase/base.hpp
index aef4fc9..05b3ca3 100644
--- a/uappbase/base.hpp
+++ b/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"
diff --git a/uappbase/bean/appevent.h b/uappbase/bean/appevent.h
new file mode 100644
index 0000000..34f193d
--- /dev/null
+++ b/uappbase/bean/appevent.h
@@ -0,0 +1,36 @@
+#pragma once
+#include
+#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;
\ No newline at end of file
diff --git a/uappbase/bean/event.hpp b/uappbase/bean/event.hpp
index 1e8410f..0db0294 100644
--- a/uappbase/bean/event.hpp
+++ b/uappbase/bean/event.hpp
@@ -3,53 +3,12 @@
#include
#include
-#include
-
-#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;
diff --git a/uappbase/service/app_event_bus.cpp b/uappbase/service/app_event_bus.cpp
index 97dd7cc..ff4d016 100644
--- a/uappbase/service/app_event_bus.cpp
+++ b/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) {
diff --git a/uappbase/service/gstate_mgr.cpp b/uappbase/service/gstate_mgr.cpp
index 2c08f89..49faa61 100644
--- a/uappbase/service/gstate_mgr.cpp
+++ b/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() {
diff --git a/ui/hand_acid_mainboard_ui.HMI b/ui/hand_acid_mainboard_ui.HMI
index 21ad954..2e84d40 100644
Binary files a/ui/hand_acid_mainboard_ui.HMI and b/ui/hand_acid_mainboard_ui.HMI differ
diff --git a/ui/ui.h b/ui/ui.h
index 1e772f8..705200f 100644
--- a/ui/ui.h
+++ b/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
diff --git a/usrc/apphardware/apphardware.hpp b/usrc/apphardware/apphardware.hpp
index 579ade5..fe93fb6 100644
--- a/usrc/apphardware/apphardware.hpp
+++ b/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 {
diff --git a/usrc/db/type/device_setting.hpp b/usrc/db/type/device_setting.hpp
index 6b551ad..543aa06 100644
--- a/usrc/db/type/device_setting.hpp
+++ b/usrc/db/type/device_setting.hpp
@@ -1,7 +1,3 @@
-// kcfg_echDitrUpLi,
-// kcfg_distrIntervalS, // 每次分配间隔时间
-// kcfg_bleClientName,
-
#pragma once
#include "uappbase/base.hpp"
diff --git a/usrc/service/app_core.cpp b/usrc/service/app_core.cpp
index 82dc5b1..9474cea 100644
--- a/usrc/service/app_core.cpp
+++ b/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);
}
diff --git a/usrc/service/remote_controler_event_processer.cpp b/usrc/service/remote_controler_event_processer.cpp
index 4be7491..6c8c486 100644
--- a/usrc/service/remote_controler_event_processer.cpp
+++ b/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;
+}
diff --git a/usrc/service/remote_controler_event_processer.hpp b/usrc/service/remote_controler_event_processer.hpp
index 12475d2..7a14b47 100644
--- a/usrc/service/remote_controler_event_processer.hpp
+++ b/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
*
diff --git a/usrc/uicontroler/base/page_processer.cpp b/usrc/uicontroler/base/page_processer.cpp
index 379f450..4c8ab0e 100644
--- a/usrc/uicontroler/base/page_processer.cpp
+++ b/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);
diff --git a/usrc/uicontroler/base/page_processer.hpp b/usrc/uicontroler/base/page_processer.hpp
index 7b0d3dd..0de33a8 100644
--- a/usrc/uicontroler/base/page_processer.hpp
+++ b/usrc/uicontroler/base/page_processer.hpp
@@ -1,11 +1,16 @@
#pragma once
+#include
-#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;
diff --git a/usrc/uicontroler/base/ui_public_state.cpp b/usrc/uicontroler/base/ui_public_state.cpp
deleted file mode 100644
index e69de29..0000000
diff --git a/usrc/uicontroler/base/ui_public_state.hpp b/usrc/uicontroler/base/ui_public_state.hpp
deleted file mode 100644
index e138b22..0000000
--- a/usrc/uicontroler/base/ui_public_state.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#pragma once
-
-#include "uappbase/base.hpp"
-#include "uicontroler/ui_controler.hpp"
-namespace iflytop {
-
-class UIPublicState {
- private:
- /* data */
- public:
-
-};
-
-} // namespace iflytop
\ No newline at end of file
diff --git a/usrc/uicontroler/base/ui_state.cpp b/usrc/uicontroler/base/ui_state.cpp
new file mode 100644
index 0000000..f723293
--- /dev/null
+++ b/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 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; }
diff --git a/usrc/uicontroler/base/ui_state.hpp b/usrc/uicontroler/base/ui_state.hpp
new file mode 100644
index 0000000..60077ef
--- /dev/null
+++ b/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 onConfirm;
+} UIPopInfo_t;
+
+class UIPublicState {
+ public:
+ static void initialize();
+ static void pushUIPopInfo(UIPopWinType_t type, const char* info, function onConfirm);
+ static bool popUIPopInfoBlock(UIPopInfo_t* info);
+ static int getPopInfoNum();
+};
+} // namespace iflytop
\ No newline at end of file
diff --git a/usrc/uicontroler/page/PageInitializer.cpp b/usrc/uicontroler/page/PageInitializer.cpp
deleted file mode 100644
index fc820a9..0000000
--- a/usrc/uicontroler/page/PageInitializer.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "uicontroler/base/page_processer.hpp"
-namespace iflytop {
-using namespace std;
-
-
-} // namespace iflytop
-
-// kpt_sys_event_page_id
\ No newline at end of file
diff --git a/usrc/uicontroler/page/home_page.cpp b/usrc/uicontroler/page/home_page.cpp
index 54ff8cb..b5234e5 100644
--- a/usrc/uicontroler/page/home_page.cpp
+++ b/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;
}
diff --git a/usrc/uicontroler/page/navi_page.cpp b/usrc/uicontroler/page/navi_page.cpp
index a999006..668aec2 100644
--- a/usrc/uicontroler/page/navi_page.cpp
+++ b/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:
diff --git a/usrc/uicontroler/page/popwin_page.cpp b/usrc/uicontroler/page/popwin_page.cpp
new file mode 100644
index 0000000..b499bcd
--- /dev/null
+++ b/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;
diff --git a/usrc/uicontroler/pagerouter/page_bak_router.cpp b/usrc/uicontroler/pagerouter/page_bak_router.cpp
index d4424cc..30c98d3 100644
--- a/usrc/uicontroler/pagerouter/page_bak_router.cpp
+++ b/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
diff --git a/usrc/uicontroler/pagerouter/page_bak_router.hpp b/usrc/uicontroler/pagerouter/page_bak_router.hpp
index ded6d82..5de62bd 100644
--- a/usrc/uicontroler/pagerouter/page_bak_router.hpp
+++ b/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);
diff --git a/usrc/uicontroler/tjc/tjc_base_type.h b/usrc/uicontroler/tjc/tjc_base_type.h
new file mode 100644
index 0000000..f3aeae1
--- /dev/null
+++ b/usrc/uicontroler/tjc/tjc_base_type.h
@@ -0,0 +1,109 @@
+#pragma once
+#include
+/**
+ * @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;
\ No newline at end of file
diff --git a/usrc/uicontroler/tjc/tjc_constant.hpp b/usrc/uicontroler/tjc/tjc_constant.hpp
index b3272c9..c6aa970 100644
--- a/usrc/uicontroler/tjc/tjc_constant.hpp
+++ b/usrc/uicontroler/tjc/tjc_constant.hpp
@@ -1,123 +1,12 @@
#pragma once
#include
-
-#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
diff --git a/usrc/uicontroler/ui_controler.cpp b/usrc/uicontroler/ui_controler.cpp
index e074a76..f20e2d2 100644
--- a/usrc/uicontroler/ui_controler.cpp
+++ b/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 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 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 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 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); }
diff --git a/usrc/uicontroler/ui_controler.hpp b/usrc/uicontroler/ui_controler.hpp
index 55ee63a..0c35637 100644
--- a/usrc/uicontroler/ui_controler.hpp
+++ b/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 onConfirm);
+ void popWarningWin(const char* info) { popWin(UI_POP_WIN_TYPE_WARNING_INFO, info, nullptr); }
+ void popConfirmWin(const char* info, function 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 onConfirm);
- void confirmNoCancle(const char* info) { confirmNoCancle(info, nullptr); }
- void confirmNoCancle(const char* info, function onConfirm);
- void confirm(const char* info, function onConfirm);
+ // void alertNoConfirm(const char* info);
+ // void alert(const char* info, function onConfirm);
+ // void confirmNoCancle(const char* info) { confirmNoCancle(info, nullptr); }
+ // void confirmNoCancle(const char* info, function onConfirm);
+ // void confirm(const char* info, function 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) {