- 引入ble_common_event头文件支持蓝牙事件处理 - 在UI模型中添加蓝牙连接状态字段,包括隐藏、搜索中、已连接三种状态 - 实现蓝牙事件处理器,响应蓝牙对等设备搜索和连接事件 - 当切换到非BLE模式时自动隐藏蓝牙连接状态 - 在主界面UI中添加蓝牙连接状态显示组件(包装器、旋转动画、蓝牙图标) - 根据蓝牙连接状态动态更新UI显示:搜索时显示旋转动画,连接时显示蓝色蓝牙图标,其他情况隐藏 - 订阅蓝牙对等设备相关事件以实时更新连接状态
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
#ifndef BLINKY_UI_MAIN_H_
|
|
#define BLINKY_UI_MAIN_H_
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include <lvgl.h>
|
|
|
|
#include "mode_switch_event.h"
|
|
#include "ui/ui_page.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum ui_ble_link_state {
|
|
UI_BLE_LINK_HIDDEN = 0,
|
|
UI_BLE_LINK_SEARCHING,
|
|
UI_BLE_LINK_CONNECTED,
|
|
};
|
|
|
|
struct ui_main_model {
|
|
lv_color_t theme_color;
|
|
lv_color_t inactive_border_color;
|
|
uint8_t battery_level;
|
|
enum mode_switch_mode mode;
|
|
enum ui_ble_link_state ble_link_state;
|
|
uint8_t led_mask;
|
|
bool charging;
|
|
bool full;
|
|
};
|
|
|
|
void ui_main_init(const struct ui_main_model *model,
|
|
const char *date_text,
|
|
const char *time_text);
|
|
void ui_main_refresh_all(const struct ui_main_model *model,
|
|
const char *date_text,
|
|
const char *time_text);
|
|
void ui_main_refresh_status_bar(const struct ui_main_model *model);
|
|
void ui_main_refresh_battery(const struct ui_main_model *model);
|
|
void ui_main_refresh_datetime(const char *date_text, const char *time_text);
|
|
void ui_main_deinit(void);
|
|
struct ui_page *ui_main_page_get(const struct ui_main_model *model,
|
|
const char *date_text,
|
|
const char *time_text);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* BLINKY_UI_MAIN_H_ */
|