feat(protocol): 添加时间同步和主题颜色协议支持
- 添加CDC_PROTO_TYPE_LED_STATE、CDC_PROTO_TYPE_TIME_SYNC和 CDC_PROTO_TYPE_THEME_RGB协议类型定义 - 在protobuf中定义LedState、TimeSync和ThemeRgb消息结构 - 更新CdcPacketBody消息以包含新的协议类型 - 增加协议能力标志位以支持新功能
This commit is contained in:
26
inc/events/datetime_event.h
Normal file
26
inc/events/datetime_event.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef BLINKY_DATETIME_EVENT_H_
|
||||
#define BLINKY_DATETIME_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DATETIME_EVENT_DATE_TEXT_LEN 16
|
||||
#define DATETIME_EVENT_TIME_TEXT_LEN 16
|
||||
|
||||
struct datetime_event {
|
||||
struct app_event_header header;
|
||||
char date_text[DATETIME_EVENT_DATE_TEXT_LEN];
|
||||
char time_text[DATETIME_EVENT_TIME_TEXT_LEN];
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(datetime_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_DATETIME_EVENT_H_ */
|
||||
24
inc/events/theme_rgb_update_event.h
Normal file
24
inc/events/theme_rgb_update_event.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef BLINKY_THEME_RGB_UPDATE_EVENT_H_
|
||||
#define BLINKY_THEME_RGB_UPDATE_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#include "theme_color.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct theme_rgb_update_event {
|
||||
struct app_event_header header;
|
||||
struct theme_rgb theme;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(theme_rgb_update_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_THEME_RGB_UPDATE_EVENT_H_ */
|
||||
26
inc/events/time_sync_event.h
Normal file
26
inc/events/time_sync_event.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef BLINKY_TIME_SYNC_EVENT_H_
|
||||
#define BLINKY_TIME_SYNC_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct time_sync_event {
|
||||
struct app_event_header header;
|
||||
uint32_t version;
|
||||
uint32_t flags;
|
||||
int32_t timezone_min;
|
||||
uint64_t utc_ms;
|
||||
uint32_t accuracy_ms;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(time_sync_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_TIME_SYNC_EVENT_H_ */
|
||||
@@ -12,6 +12,9 @@ extern "C" {
|
||||
#define CDC_PROTO_TYPE_HELLO_RSP 0x02U
|
||||
#define CDC_PROTO_TYPE_BITMAP 0x10U
|
||||
#define CDC_PROTO_TYPE_FUNCTION_KEY_EVENT 0x20U
|
||||
#define CDC_PROTO_TYPE_LED_STATE 0x21U
|
||||
#define CDC_PROTO_TYPE_TIME_SYNC 0x30U
|
||||
#define CDC_PROTO_TYPE_THEME_RGB 0x31U
|
||||
#define CDC_PROTO_TYPE_ACK 0x7EU
|
||||
#define CDC_PROTO_TYPE_ERROR 0x7FU
|
||||
|
||||
|
||||
Reference in New Issue
Block a user