feat(protocol): 添加传输状态事件管理协议会话状态
添加了新的 proto_transport_state_event 事件类型来跟踪协议传输连接状态, 包括链接断开和就绪状态。为 BLE NUS 和 USB CDC 模块实现了状态机管理, 替换原有的简单布尔标志,提供更精确的连接状态跟踪。 - 添加 proto_transport_state_event 事件定义和实现 - 为 BLE NUS 模块引入业务状态机管理 - 为 USB CDC 模块引入业务状态机管理 - 实现协议模块中的会话状态管理 - 移除 protocol_module_reset_transport_state 函数 - 更新 CMakeLists.txt 包含新事件源文件
This commit is contained in:
36
inc/events/proto_transport_state_event.h
Normal file
36
inc/events/proto_transport_state_event.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef BLINKY_PROTO_TRANSPORT_STATE_EVENT_H_
|
||||
#define BLINKY_PROTO_TRANSPORT_STATE_EVENT_H_
|
||||
|
||||
#include <app_event_manager.h>
|
||||
#include <app_event_manager_profiler_tracer.h>
|
||||
|
||||
#include "proto_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct proto_transport_state_event {
|
||||
struct app_event_header header;
|
||||
enum proto_transport transport;
|
||||
enum proto_transport_link_state state;
|
||||
};
|
||||
|
||||
APP_EVENT_TYPE_DECLARE(proto_transport_state_event);
|
||||
|
||||
static inline void submit_proto_transport_state_event(
|
||||
enum proto_transport transport, enum proto_transport_link_state state)
|
||||
{
|
||||
struct proto_transport_state_event *event =
|
||||
new_proto_transport_state_event();
|
||||
|
||||
event->transport = transport;
|
||||
event->state = state;
|
||||
APP_EVENT_SUBMIT(event);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_PROTO_TRANSPORT_STATE_EVENT_H_ */
|
||||
Reference in New Issue
Block a user