hid_device: added HID Meta Events

This commit is contained in:
Matthias Ringwald 2017-04-27 14:56:07 +02:00
parent d40c9ac6cf
commit dd148ddbc5
3 changed files with 103 additions and 1 deletions

View File

@ -935,6 +935,7 @@ typedef uint8_t sm_key_t[16];
#define HCI_EVENT_AVRCP_META 0xEC
#define HCI_EVENT_GOEP_META 0xED
#define HCI_EVENT_PBAP_META 0xEE
#define HCI_EVENT_HID_META 0xEF
// Potential other meta groups
// #define HCI_EVENT_BNEP_META 0xxx
@ -1551,4 +1552,29 @@ typedef uint8_t sm_key_t[16];
*/
#define PBAP_SUBEVENT_OPERATION_COMPLETED 0x03
/**
* @format 121BH1
* @param subevent_code
* @param hid_cid
* @param status
* @param bd_addr
* @param con_handle
* @param incoming
*/
#define HID_SUBEVENT_CONNECTION_OPENED 0x01
/**
* @format 12
* @param subevent_code
* @param hid_cid
*/
#define HID_SUBEVENT_CONNECTION_CLOSED 0x02
/**
* @format 12
* @param subevent_code
* @param hid_cid
*/
#define HID_SUBEVENT_CAN_SEND_NOW 0x03
#endif

View File

@ -133,6 +133,14 @@ static inline uint8_t hci_event_pbap_meta_get_subevent_code(const uint8_t * even
static inline uint8_t hci_event_le_meta_get_subevent_code(const uint8_t * event){
return event[2];
}
/***
* @brief Get subevent code for hid event
* @param event packet
* @return subevent_code
*/
static inline uint8_t hci_event_hid_meta_get_subevent_code(const uint8_t * event){
return event[2];
}
/**
* @brief Get field status from event HCI_EVENT_INQUIRY_COMPLETE
* @param event packet
@ -4975,6 +4983,72 @@ static inline uint8_t pbap_subevent_operation_completed_get_status(const uint8_t
return event[5];
}
/**
* @brief Get field hid_cid from event HID_SUBEVENT_CONNECTION_OPENED
* @param event packet
* @return hid_cid
* @note: btstack_type 2
*/
static inline uint16_t hid_subevent_connection_opened_get_hid_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field status from event HID_SUBEVENT_CONNECTION_OPENED
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t hid_subevent_connection_opened_get_status(const uint8_t * event){
return event[5];
}
/**
* @brief Get field bd_addr from event HID_SUBEVENT_CONNECTION_OPENED
* @param event packet
* @param Pointer to storage for bd_addr
* @note: btstack_type B
*/
static inline void hid_subevent_connection_opened_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){
reverse_bd_addr(&event[6], bd_addr);
}
/**
* @brief Get field con_handle from event HID_SUBEVENT_CONNECTION_OPENED
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hid_subevent_connection_opened_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 12);
}
/**
* @brief Get field incoming from event HID_SUBEVENT_CONNECTION_OPENED
* @param event packet
* @return incoming
* @note: btstack_type 1
*/
static inline uint8_t hid_subevent_connection_opened_get_incoming(const uint8_t * event){
return event[14];
}
/**
* @brief Get field hid_cid from event HID_SUBEVENT_CONNECTION_CLOSED
* @param event packet
* @return hid_cid
* @note: btstack_type 2
*/
static inline uint16_t hid_subevent_connection_closed_get_hid_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field hid_cid from event HID_SUBEVENT_CAN_SEND_NOW
* @param event packet
* @return hid_cid
* @note: btstack_type 2
*/
static inline uint16_t hid_subevent_can_send_now_get_hid_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/* API_END */

View File

@ -16,7 +16,8 @@ meta_events = [
'HFP',
'HSP',
'PBAP',
'LE'
'LE',
'HID',
]
supported_event_groups = meta_events + [
@ -30,6 +31,7 @@ supported_event_groups = meta_events + [
'GATT',
'BNEP',
'ATT',
'HID',
]
program_info = '''