34 changed files with 524 additions and 367 deletions
-
30.cproject
-
4.settings/language.settings.xml
-
52.vscode/c_cpp_properties.json
-
35.vscode/c_cpp_properties.json copy 2.bak
-
3.vscode/settings.json
-
9hello.cpp
-
4uappbase/base.hpp
-
36uappbase/bean/appevent.h
-
47uappbase/bean/event.hpp
-
1uappbase/service/app_event_bus.cpp
-
2uappbase/service/gstate_mgr.cpp
-
BINui/hand_acid_mainboard_ui.HMI
-
19ui/ui.h
-
2usrc/apphardware/apphardware.hpp
-
4usrc/db/type/device_setting.hpp
-
14usrc/service/app_core.cpp
-
30usrc/service/remote_controler_event_processer.cpp
-
1usrc/service/remote_controler_event_processer.hpp
-
9usrc/uicontroler/base/page_processer.cpp
-
9usrc/uicontroler/base/page_processer.hpp
-
0usrc/uicontroler/base/ui_public_state.cpp
-
14usrc/uicontroler/base/ui_public_state.hpp
-
42usrc/uicontroler/base/ui_state.cpp
-
26usrc/uicontroler/base/ui_state.hpp
-
8usrc/uicontroler/page/PageInitializer.cpp
-
2usrc/uicontroler/page/home_page.cpp
-
5usrc/uicontroler/page/navi_page.cpp
-
138usrc/uicontroler/page/popwin_page.cpp
-
2usrc/uicontroler/pagerouter/page_bak_router.cpp
-
1usrc/uicontroler/pagerouter/page_bak_router.hpp
-
109usrc/uicontroler/tjc/tjc_base_type.h
-
117usrc/uicontroler/tjc/tjc_constant.hpp
-
94usrc/uicontroler/ui_controler.cpp
-
22usrc/uicontroler/ui_controler.hpp
@ -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 |
@ -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 |
|||
} |
@ -0,0 +1,9 @@ |
|||
#include <stdio.h>
|
|||
#include <iostream>
|
|||
#include "ui/ui.h"
|
|||
|
|||
int main() { |
|||
std::cout << "Hello, World!" << std::endl; |
|||
return 0; |
|||
|
|||
} |
@ -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; |
@ -1,14 +0,0 @@ |
|||
#pragma once
|
|||
|
|||
#include "uappbase/base.hpp"
|
|||
#include "uicontroler/ui_controler.hpp"
|
|||
namespace iflytop { |
|||
|
|||
class UIPublicState { |
|||
private: |
|||
/* data */ |
|||
public: |
|||
|
|||
}; |
|||
|
|||
} // namespace iflytop
|
@ -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; } |
@ -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
|
@ -1,8 +0,0 @@ |
|||
#include "uicontroler/base/page_processer.hpp"
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
|
|||
|
|||
} // namespace iflytop
|
|||
|
|||
// kpt_sys_event_page_id
|
@ -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; |
@ -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); |
@ -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; |
@ -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
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue