mcu_ab568x/app/projects/AB5681F_240_32M/functions/func_nfc.c
2025-05-30 18:03:10 +08:00

107 lines
2.3 KiB
C

#include "include.h"
#include "func.h"
#include "app_variable.h"
#if TRACE_EN
#define TRACE(...) printf(__VA_ARGS__)
#else
#define TRACE(...)
#endif
#ifdef TJD_GUI_NFC_Show
typedef struct f_nfc_t_
{
} f_nfc_t;
// 组件ID
enum
{
COMPO_ID_BTN_OK= 1,
};
// NFC页面
compo_form_t *func_nfc_form_create(void)
{
// 新建窗体
compo_form_t *frm = compo_form_create(true);
compo_textbox_t *txt;
txt = compo_textbox_create(frm, 50);
compo_textbox_set_multiline(txt, true);
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X, GUI_SCREEN_CENTER_Y, GUI_SCREEN_WIDTH - 20, 80);
compo_textbox_set(txt, i18n[STR_NFC_REMIND]);
compo_shape_t *shape = compo_radius_shape_create(frm, COMPO_SHAPE_TYPE_ROUNDED_RECTANGLE, 8);
compo_shape_set_color(shape, make_color(0, 203, 0));
compo_shape_set_location(shape, GUI_SCREEN_CENTER_X, 260, 140, 40);
txt = compo_textbox_create(frm, 50);
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X, 260, 100, 20);
compo_textbox_set(txt, i18n[STR_CONFIMR]);
compo_button_t *btn = compo_button_create(frm);
compo_setid(btn, COMPO_ID_BTN_OK);
compo_button_set_location(btn, GUI_SCREEN_CENTER_X, 260, 140, 40);
return frm;
}
// NFC设置功能事件处理
static void func_nfc_process(void)
{
func_process();
}
// 单击按钮
static void func_notice_button_click(void)
{
int id = compo_get_button_id();
switch (id)
{
case COMPO_ID_BTN_OK:
func_back_to(); //直接退出任务
break;
default:
break;
}
}
// NFC设置功能消息处理
static void func_nfc_message(size_msg_t msg)
{
switch (msg)
{
case MSG_CTP_CLICK:
func_notice_button_click();
break;
default:
func_message(msg);
break;
}
}
// 进入NFC设置功能
static void func_nfc_enter(void)
{
func_cb.f_cb = func_zalloc(sizeof(f_nfc_t));
func_cb.frm_main = func_nfc_form_create();
}
// 退出NFC设置功能
static void func_nfc_exit(void)
{
func_cb.last = FUNC_NFC;
}
// NFC设置功能
void func_nfc(void)
{
func_nfc_enter();
while (func_cb.sta == FUNC_NFC) {
func_nfc_process();
func_nfc_message(msg_dequeue());
}
func_nfc_exit();
}
#endif