- 将原来的HID传输状态事件替换为新的HID通道状态事件,支持USB键盘、USB消费者和BLE共享通道 - 添加usb_hid_consumer_module.c模块来处理USB消费者HID报告 - 添加usb_hid_keyboard_module.c模块来处理USB键盘HID报告 - 修改CMakeLists.txt以包含新的HID模块源文件 - 更新事件系统中的transport字段为channel字段,并相应修改所有相关处理逻辑 - 在hid_flowctrl_module.c中实现多通道并发处理机制 - 删除过时的hid_transport_state_event相关代码 - 添加新的hid_channel_state_event用于报告各通道就绪状态
58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
#ifndef BLINKY_HID_TX_REPORT_EVENT_H_
|
|
#define BLINKY_HID_TX_REPORT_EVENT_H_
|
|
|
|
#include <errno.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
#include <app_event_manager.h>
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
|
|
#include "keyboard_core.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct hid_tx_report_event {
|
|
struct app_event_header header;
|
|
enum hid_send_channel channel;
|
|
enum keyboard_report_type report_type;
|
|
enum keyboard_protocol_mode protocol_mode;
|
|
uint16_t sequence;
|
|
struct event_dyndata dyndata;
|
|
};
|
|
|
|
APP_EVENT_TYPE_DYNDATA_DECLARE(hid_tx_report_event);
|
|
|
|
static inline int submit_hid_tx_report_event(enum hid_send_channel channel,
|
|
enum keyboard_report_type report_type,
|
|
enum keyboard_protocol_mode protocol_mode,
|
|
uint16_t sequence,
|
|
const uint8_t *data, size_t size)
|
|
{
|
|
struct hid_tx_report_event *event;
|
|
|
|
if ((data == NULL) && (size > 0U)) {
|
|
return -EINVAL;
|
|
}
|
|
|
|
event = new_hid_tx_report_event(size);
|
|
event->channel = channel;
|
|
event->report_type = report_type;
|
|
event->protocol_mode = protocol_mode;
|
|
event->sequence = sequence;
|
|
if (size > 0U) {
|
|
memcpy(event->dyndata.data, data, size);
|
|
}
|
|
|
|
APP_EVENT_SUBMIT(event);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* BLINKY_HID_TX_REPORT_EVENT_H_ */
|