diff --git a/src/btstack_defines.h b/src/btstack_defines.h index a41c609aa..d26808a80 100644 --- a/src/btstack_defines.h +++ b/src/btstack_defines.h @@ -753,6 +753,21 @@ typedef uint8_t sm_key_t[16]; */ #define GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE 0xAC +/** + * @format 1BH2 + * @param address_type + * @param address + * @param handle + * @param l2cap_cid if BR/EDR bearer + */ +#define ATT_EVENT_CONNECTED 0xB3 + +/** + * @format H + * @param handle + */ +#define ATT_EVENT_DISCONNECTED 0xB4 + /** * @format H2 * @param handle diff --git a/src/btstack_event.h b/src/btstack_event.h index 748b56441..cbc194a09 100644 --- a/src/btstack_event.h +++ b/src/btstack_event.h @@ -2206,6 +2206,53 @@ static inline hci_con_handle_t gatt_event_can_write_without_response_get_handle( } #endif +/** + * @brief Get field address_type from event ATT_EVENT_CONNECTED + * @param event packet + * @return address_type + * @note: btstack_type 1 + */ +static inline uint8_t att_event_connected_get_address_type(const uint8_t * event){ + return event[2]; +} +/** + * @brief Get field address from event ATT_EVENT_CONNECTED + * @param event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void att_event_connected_get_address(const uint8_t * event, bd_addr_t address){ + reverse_bd_addr(&event[3], address); +} +/** + * @brief Get field handle from event ATT_EVENT_CONNECTED + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t att_event_connected_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 9); +} +/** + * @brief Get field l2cap_cid from event ATT_EVENT_CONNECTED + * @param event packet + * @return l2cap_cid + * @note: btstack_type 2 + */ +static inline uint16_t att_event_connected_get_l2cap_cid(const uint8_t * event){ + return little_endian_read_16(event, 11); +} + +/** + * @brief Get field handle from event ATT_EVENT_DISCONNECTED + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t att_event_disconnected_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + /** * @brief Get field handle from event ATT_EVENT_MTU_EXCHANGE_COMPLETE * @param event packet