My fork of X_NUCLEO_IDB0XA1
Fork of X_NUCLEO_IDB0XA1 by
x-nucleo-idb0xa1/bluenrg-hci/hci_const.h@229:9981f62cdb1a, 2016-05-16 (annotated)
- Committer:
- Andrea Palmieri
- Date:
- Mon May 16 17:22:03 2016 +0200
- Revision:
- 229:9981f62cdb1a
- Parent:
- 132:51056160fa4a
Fix issues and add features
- Fix handles management
- Fix UUIDs management
- Implement API to read random address
- Fix clearing/setting of ADV payload
- Fix scanning behaviour
- Fix scanning while a connection is ongoing
- Implement Char Descriptor discovery
- Implement scanning/advertising filter policy (White List partial management)
- Update underlying BlueNRG stack
- Cosmetics
Signed-off-by: Andrea Palmieri <andrea.palmieri@st.com>
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wolfgang Betz |
132:51056160fa4a | 1 | /****************************************************************************** |
Wolfgang Betz |
132:51056160fa4a | 2 | * |
Wolfgang Betz |
132:51056160fa4a | 3 | * File Description |
Wolfgang Betz |
132:51056160fa4a | 4 | * --------------------- |
Wolfgang Betz |
132:51056160fa4a | 5 | * This file defines constants and functions for HCI layer. |
Wolfgang Betz |
132:51056160fa4a | 6 | * See Bluetooth Core v 4.0, Vol. 2, Part E. |
Wolfgang Betz |
132:51056160fa4a | 7 | * |
Wolfgang Betz |
132:51056160fa4a | 8 | *******************************************************************************/ |
Wolfgang Betz |
132:51056160fa4a | 9 | |
Wolfgang Betz |
132:51056160fa4a | 10 | #ifndef __HCI_INTERNAL_H_ |
Wolfgang Betz |
132:51056160fa4a | 11 | #define __HCI_INTERNAL_H_ |
Wolfgang Betz |
132:51056160fa4a | 12 | |
Wolfgang Betz |
132:51056160fa4a | 13 | #include "compiler.h" |
Wolfgang Betz |
132:51056160fa4a | 14 | #include "hal_types.h" |
Wolfgang Betz |
132:51056160fa4a | 15 | #include "clock.h" |
Wolfgang Betz |
132:51056160fa4a | 16 | #include "link_layer.h" |
Wolfgang Betz |
132:51056160fa4a | 17 | #include "hci.h" |
Wolfgang Betz |
132:51056160fa4a | 18 | |
Wolfgang Betz |
132:51056160fa4a | 19 | #define DEFAULT_TIMEOUT (CLOCK_SECOND/10) |
Wolfgang Betz |
132:51056160fa4a | 20 | |
Wolfgang Betz |
132:51056160fa4a | 21 | /** |
Wolfgang Betz |
132:51056160fa4a | 22 | * Maximum payload of HCI commands that can be sent. Change this value if needed. |
Wolfgang Betz |
132:51056160fa4a | 23 | * This value can be up to 255. |
Wolfgang Betz |
132:51056160fa4a | 24 | */ |
Wolfgang Betz |
132:51056160fa4a | 25 | #define HCI_MAX_PAYLOAD_SIZE 128 |
Wolfgang Betz |
132:51056160fa4a | 26 | |
Wolfgang Betz |
132:51056160fa4a | 27 | /* HCI Packet types */ |
Wolfgang Betz |
132:51056160fa4a | 28 | #define HCI_COMMAND_PKT 0x01 |
Wolfgang Betz |
132:51056160fa4a | 29 | #define HCI_ACLDATA_PKT 0x02 |
Wolfgang Betz |
132:51056160fa4a | 30 | #define HCI_SCODATA_PKT 0x03 |
Wolfgang Betz |
132:51056160fa4a | 31 | #define HCI_EVENT_PKT 0x04 |
Wolfgang Betz |
132:51056160fa4a | 32 | #define HCI_VENDOR_PKT 0xff |
Wolfgang Betz |
132:51056160fa4a | 33 | |
Wolfgang Betz |
132:51056160fa4a | 34 | typedef __packed struct _hci_uart_pckt{ |
Wolfgang Betz |
132:51056160fa4a | 35 | uint8_t type; |
Wolfgang Betz |
132:51056160fa4a | 36 | uint8_t data[VARIABLE_SIZE]; |
Wolfgang Betz |
132:51056160fa4a | 37 | } PACKED hci_uart_pckt; |
Wolfgang Betz |
132:51056160fa4a | 38 | #define HCI_HDR_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 39 | |
Wolfgang Betz |
132:51056160fa4a | 40 | typedef __packed struct _hci_command_hdr{ |
Wolfgang Betz |
132:51056160fa4a | 41 | uint16_t opcode; /* OCF & OGF */ |
Wolfgang Betz |
132:51056160fa4a | 42 | uint8_t plen; |
Wolfgang Betz |
132:51056160fa4a | 43 | } PACKED hci_command_hdr; |
Wolfgang Betz |
132:51056160fa4a | 44 | #define HCI_COMMAND_HDR_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 45 | |
Wolfgang Betz |
132:51056160fa4a | 46 | typedef __packed struct _hci_event_pckt{ |
Wolfgang Betz |
132:51056160fa4a | 47 | uint8_t evt; |
Wolfgang Betz |
132:51056160fa4a | 48 | uint8_t plen; |
Wolfgang Betz |
132:51056160fa4a | 49 | uint8_t data[VARIABLE_SIZE]; |
Wolfgang Betz |
132:51056160fa4a | 50 | } PACKED hci_event_pckt; |
Wolfgang Betz |
132:51056160fa4a | 51 | #define HCI_EVENT_HDR_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 52 | |
Wolfgang Betz |
132:51056160fa4a | 53 | typedef __packed struct _hci_acl_hdr{ |
Wolfgang Betz |
132:51056160fa4a | 54 | uint16_t handle; /* Handle & Flags(PB, BC) */ |
Wolfgang Betz |
132:51056160fa4a | 55 | uint16_t dlen; |
Wolfgang Betz |
132:51056160fa4a | 56 | } PACKED hci_acl_hdr; |
Wolfgang Betz |
132:51056160fa4a | 57 | #define HCI_ACL_HDR_SIZE 4 |
Wolfgang Betz |
132:51056160fa4a | 58 | |
Wolfgang Betz |
132:51056160fa4a | 59 | /* Link Control */ |
Wolfgang Betz |
132:51056160fa4a | 60 | #define OGF_LINK_CTL 0x01 |
Wolfgang Betz |
132:51056160fa4a | 61 | |
Wolfgang Betz |
132:51056160fa4a | 62 | #define OCF_DISCONNECT 0x0006 |
Wolfgang Betz |
132:51056160fa4a | 63 | typedef __packed struct _disconnect_cp{ |
Wolfgang Betz |
132:51056160fa4a | 64 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 65 | uint8_t reason; |
Wolfgang Betz |
132:51056160fa4a | 66 | } PACKED disconnect_cp; |
Wolfgang Betz |
132:51056160fa4a | 67 | #define DISCONNECT_CP_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 68 | |
Wolfgang Betz |
132:51056160fa4a | 69 | /* Host Controller and Baseband */ |
Wolfgang Betz |
132:51056160fa4a | 70 | #define OGF_HOST_CTL 0x03 |
Wolfgang Betz |
132:51056160fa4a | 71 | |
Wolfgang Betz |
132:51056160fa4a | 72 | #define OCF_SET_EVENT_MASK 0x0001 |
Wolfgang Betz |
132:51056160fa4a | 73 | #define OCF_RESET 0x0003 |
Wolfgang Betz |
132:51056160fa4a | 74 | |
Wolfgang Betz |
132:51056160fa4a | 75 | #define OCF_READ_TRANSMIT_POWER_LEVEL 0x002D |
Wolfgang Betz |
132:51056160fa4a | 76 | typedef __packed struct _read_transmit_power_level_cp{ |
Wolfgang Betz |
132:51056160fa4a | 77 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 78 | uint8_t type; |
Wolfgang Betz |
132:51056160fa4a | 79 | } PACKED read_transmit_power_level_cp; |
Wolfgang Betz |
132:51056160fa4a | 80 | #define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 81 | typedef __packed struct _read_transmit_power_level_rp{ |
Wolfgang Betz |
132:51056160fa4a | 82 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 83 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 84 | int8_t level; |
Wolfgang Betz |
132:51056160fa4a | 85 | } PACKED read_transmit_power_level_rp; |
Wolfgang Betz |
132:51056160fa4a | 86 | #define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4 |
Wolfgang Betz |
132:51056160fa4a | 87 | |
Wolfgang Betz |
132:51056160fa4a | 88 | #define OCF_SET_CONTROLLER_TO_HOST_FC 0x0031 |
Wolfgang Betz |
132:51056160fa4a | 89 | #define OCF_HOST_BUFFER_SIZE 0x0033 |
Wolfgang Betz |
132:51056160fa4a | 90 | #define OCF_HOST_NUM_COMP_PKTS 0x0035 |
Wolfgang Betz |
132:51056160fa4a | 91 | |
Wolfgang Betz |
132:51056160fa4a | 92 | /* Informational Parameters */ |
Wolfgang Betz |
132:51056160fa4a | 93 | #define OGF_INFO_PARAM 0x04 |
Wolfgang Betz |
132:51056160fa4a | 94 | |
Wolfgang Betz |
132:51056160fa4a | 95 | #define OCF_READ_LOCAL_VERSION 0x0001 |
Wolfgang Betz |
132:51056160fa4a | 96 | typedef __packed struct _read_local_version_rp{ |
Wolfgang Betz |
132:51056160fa4a | 97 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 98 | uint8_t hci_version; |
Wolfgang Betz |
132:51056160fa4a | 99 | uint16_t hci_revision; |
Wolfgang Betz |
132:51056160fa4a | 100 | uint8_t lmp_pal_version; |
Wolfgang Betz |
132:51056160fa4a | 101 | uint16_t manufacturer_name; |
Wolfgang Betz |
132:51056160fa4a | 102 | uint16_t lmp_pal_subversion; |
Wolfgang Betz |
132:51056160fa4a | 103 | } PACKED read_local_version_rp; |
Wolfgang Betz |
132:51056160fa4a | 104 | #define READ_LOCAL_VERSION_RP_SIZE 9 |
Wolfgang Betz |
132:51056160fa4a | 105 | |
Wolfgang Betz |
132:51056160fa4a | 106 | #define OCF_READ_LOCAL_COMMANDS 0x0002 |
Wolfgang Betz |
132:51056160fa4a | 107 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
Wolfgang Betz |
132:51056160fa4a | 108 | |
Wolfgang Betz |
132:51056160fa4a | 109 | #define OCF_READ_BD_ADDR 0x0009 |
Wolfgang Betz |
132:51056160fa4a | 110 | typedef __packed struct _read_bd_addr_rp{ |
Wolfgang Betz |
132:51056160fa4a | 111 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 112 | tBDAddr bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 113 | } PACKED read_bd_addr_rp; |
Wolfgang Betz |
132:51056160fa4a | 114 | #define READ_BD_ADDR_RP_SIZE 7 |
Wolfgang Betz |
132:51056160fa4a | 115 | |
Wolfgang Betz |
132:51056160fa4a | 116 | /* Status params */ |
Wolfgang Betz |
132:51056160fa4a | 117 | #define OGF_STATUS_PARAM 0x05 |
Wolfgang Betz |
132:51056160fa4a | 118 | |
Wolfgang Betz |
132:51056160fa4a | 119 | #define OCF_READ_RSSI 0x0005 |
Wolfgang Betz |
132:51056160fa4a | 120 | typedef __packed struct _read_rssi_cp{ |
Wolfgang Betz |
132:51056160fa4a | 121 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 122 | } PACKED read_rssi_cp; |
Wolfgang Betz |
132:51056160fa4a | 123 | #define READ_RSSI_CP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 124 | typedef __packed struct _read_rssi_rp{ |
Wolfgang Betz |
132:51056160fa4a | 125 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 126 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 127 | int8_t rssi; |
Wolfgang Betz |
132:51056160fa4a | 128 | } PACKED read_rssi_rp; |
Wolfgang Betz |
132:51056160fa4a | 129 | #define READ_RSSI_RP_SIZE 4 |
Wolfgang Betz |
132:51056160fa4a | 130 | |
Wolfgang Betz |
132:51056160fa4a | 131 | |
Wolfgang Betz |
132:51056160fa4a | 132 | /* LE commands */ |
Wolfgang Betz |
132:51056160fa4a | 133 | #define OGF_LE_CTL 0x08 |
Wolfgang Betz |
132:51056160fa4a | 134 | |
Wolfgang Betz |
132:51056160fa4a | 135 | #define OCF_LE_SET_EVENT_MASK 0x0001 |
Wolfgang Betz |
132:51056160fa4a | 136 | typedef __packed struct _le_set_event_mask_cp{ |
Wolfgang Betz |
132:51056160fa4a | 137 | uint8_t mask[8]; |
Wolfgang Betz |
132:51056160fa4a | 138 | } PACKED le_set_event_mask_cp; |
Wolfgang Betz |
132:51056160fa4a | 139 | #define LE_SET_EVENT_MASK_CP_SIZE 8 |
Wolfgang Betz |
132:51056160fa4a | 140 | |
Wolfgang Betz |
132:51056160fa4a | 141 | #define OCF_LE_READ_BUFFER_SIZE 0x0002 |
Wolfgang Betz |
132:51056160fa4a | 142 | typedef __packed struct _le_read_buffer_size_rp{ |
Wolfgang Betz |
132:51056160fa4a | 143 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 144 | uint16_t pkt_len; |
Wolfgang Betz |
132:51056160fa4a | 145 | uint8_t max_pkt; |
Wolfgang Betz |
132:51056160fa4a | 146 | } PACKED le_read_buffer_size_rp; |
Wolfgang Betz |
132:51056160fa4a | 147 | #define LE_READ_BUFFER_SIZE_RP_SIZE 4 |
Wolfgang Betz |
132:51056160fa4a | 148 | |
Wolfgang Betz |
132:51056160fa4a | 149 | #define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003 |
Wolfgang Betz |
132:51056160fa4a | 150 | typedef __packed struct _le_read_local_supported_features_rp{ |
Wolfgang Betz |
132:51056160fa4a | 151 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 152 | uint8_t features[8]; |
Wolfgang Betz |
132:51056160fa4a | 153 | } PACKED le_read_local_supported_features_rp; |
Wolfgang Betz |
132:51056160fa4a | 154 | #define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9 |
Wolfgang Betz |
132:51056160fa4a | 155 | |
Wolfgang Betz |
132:51056160fa4a | 156 | #define OCF_LE_SET_RANDOM_ADDRESS 0x0005 |
Wolfgang Betz |
132:51056160fa4a | 157 | typedef __packed struct _le_set_random_address_cp{ |
Wolfgang Betz |
132:51056160fa4a | 158 | tBDAddr bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 159 | } PACKED le_set_random_address_cp; |
Wolfgang Betz |
132:51056160fa4a | 160 | #define LE_SET_RANDOM_ADDRESS_CP_SIZE 6 |
Wolfgang Betz |
132:51056160fa4a | 161 | |
Wolfgang Betz |
132:51056160fa4a | 162 | #define OCF_LE_SET_ADV_PARAMETERS 0x0006 |
Wolfgang Betz |
132:51056160fa4a | 163 | typedef __packed struct _le_set_adv_parameters_cp{ |
Wolfgang Betz |
132:51056160fa4a | 164 | uint16_t min_interval; |
Wolfgang Betz |
132:51056160fa4a | 165 | uint16_t max_interval; |
Wolfgang Betz |
132:51056160fa4a | 166 | uint8_t advtype; |
Wolfgang Betz |
132:51056160fa4a | 167 | uint8_t own_bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 168 | uint8_t direct_bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 169 | tBDAddr direct_bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 170 | uint8_t chan_map; |
Wolfgang Betz |
132:51056160fa4a | 171 | uint8_t filter; |
Wolfgang Betz |
132:51056160fa4a | 172 | } PACKED le_set_adv_parameters_cp; |
Wolfgang Betz |
132:51056160fa4a | 173 | #define LE_SET_ADV_PARAMETERS_CP_SIZE 15 |
Wolfgang Betz |
132:51056160fa4a | 174 | |
Wolfgang Betz |
132:51056160fa4a | 175 | #define OCF_LE_READ_ADV_CHANNEL_TX_POWER 0x0007 |
Wolfgang Betz |
132:51056160fa4a | 176 | typedef __packed struct _le_read_adv_channel_tx_power_rp{ |
Wolfgang Betz |
132:51056160fa4a | 177 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 178 | int8_t level; |
Wolfgang Betz |
132:51056160fa4a | 179 | } PACKED le_read_adv_channel_tx_power_rp; |
Wolfgang Betz |
132:51056160fa4a | 180 | #define LE_READ_ADV_CHANNEL_TX_POWER_RP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 181 | |
Wolfgang Betz |
132:51056160fa4a | 182 | #define OCF_LE_SET_ADV_DATA 0x0008 |
Wolfgang Betz |
132:51056160fa4a | 183 | typedef __packed struct _le_set_adv_data_cp{ |
Wolfgang Betz |
132:51056160fa4a | 184 | uint8_t length; |
Wolfgang Betz |
132:51056160fa4a | 185 | uint8_t data[31]; |
Wolfgang Betz |
132:51056160fa4a | 186 | } PACKED le_set_adv_data_cp; |
Wolfgang Betz |
132:51056160fa4a | 187 | #define LE_SET_ADV_DATA_CP_SIZE 32 |
Wolfgang Betz |
132:51056160fa4a | 188 | |
Wolfgang Betz |
132:51056160fa4a | 189 | #define OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009 |
Wolfgang Betz |
132:51056160fa4a | 190 | typedef __packed struct _le_set_scan_response_data_cp{ |
Wolfgang Betz |
132:51056160fa4a | 191 | uint8_t length; |
Wolfgang Betz |
132:51056160fa4a | 192 | uint8_t data[31]; |
Wolfgang Betz |
132:51056160fa4a | 193 | } PACKED le_set_scan_response_data_cp; |
Wolfgang Betz |
132:51056160fa4a | 194 | #define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32 |
Wolfgang Betz |
132:51056160fa4a | 195 | |
Wolfgang Betz |
132:51056160fa4a | 196 | #define OCF_LE_SET_ADVERTISE_ENABLE 0x000A |
Wolfgang Betz |
132:51056160fa4a | 197 | typedef __packed struct _le_set_advertise_enable_cp{ |
Wolfgang Betz |
132:51056160fa4a | 198 | uint8_t enable; |
Wolfgang Betz |
132:51056160fa4a | 199 | } PACKED le_set_advertise_enable_cp; |
Wolfgang Betz |
132:51056160fa4a | 200 | #define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 201 | |
Wolfgang Betz |
132:51056160fa4a | 202 | #define OCF_LE_SET_SCAN_PARAMETERS 0x000B |
Wolfgang Betz |
132:51056160fa4a | 203 | typedef __packed struct _le_set_scan_parameters_cp{ |
Wolfgang Betz |
132:51056160fa4a | 204 | uint8_t type; |
Wolfgang Betz |
132:51056160fa4a | 205 | uint16_t interval; |
Wolfgang Betz |
132:51056160fa4a | 206 | uint16_t window; |
Wolfgang Betz |
132:51056160fa4a | 207 | uint8_t own_bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 208 | uint8_t filter; |
Wolfgang Betz |
132:51056160fa4a | 209 | } PACKED le_set_scan_parameters_cp; |
Wolfgang Betz |
132:51056160fa4a | 210 | #define LE_SET_SCAN_PARAMETERS_CP_SIZE 7 |
Wolfgang Betz |
132:51056160fa4a | 211 | |
Wolfgang Betz |
132:51056160fa4a | 212 | #define OCF_LE_SET_SCAN_ENABLE 0x000C |
Wolfgang Betz |
132:51056160fa4a | 213 | typedef __packed struct _le_set_scan_enable_cp{ |
Wolfgang Betz |
132:51056160fa4a | 214 | uint8_t enable; |
Wolfgang Betz |
132:51056160fa4a | 215 | uint8_t filter_dup; |
Wolfgang Betz |
132:51056160fa4a | 216 | } PACKED le_set_scan_enable_cp; |
Wolfgang Betz |
132:51056160fa4a | 217 | #define LE_SET_SCAN_ENABLE_CP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 218 | |
Wolfgang Betz |
132:51056160fa4a | 219 | #define OCF_LE_CREATE_CONN 0x000D |
Wolfgang Betz |
132:51056160fa4a | 220 | typedef __packed struct _le_create_connection_cp{ |
Wolfgang Betz |
132:51056160fa4a | 221 | uint16_t interval; |
Wolfgang Betz |
132:51056160fa4a | 222 | uint16_t window; |
Wolfgang Betz |
132:51056160fa4a | 223 | uint8_t initiator_filter; |
Wolfgang Betz |
132:51056160fa4a | 224 | uint8_t peer_bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 225 | tBDAddr peer_bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 226 | uint8_t own_bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 227 | uint16_t min_interval; |
Wolfgang Betz |
132:51056160fa4a | 228 | uint16_t max_interval; |
Wolfgang Betz |
132:51056160fa4a | 229 | uint16_t latency; |
Wolfgang Betz |
132:51056160fa4a | 230 | uint16_t supervision_timeout; |
Wolfgang Betz |
132:51056160fa4a | 231 | uint16_t min_ce_length; |
Wolfgang Betz |
132:51056160fa4a | 232 | uint16_t max_ce_length; |
Wolfgang Betz |
132:51056160fa4a | 233 | } PACKED le_create_connection_cp; |
Wolfgang Betz |
132:51056160fa4a | 234 | #define LE_CREATE_CONN_CP_SIZE 25 |
Wolfgang Betz |
132:51056160fa4a | 235 | |
Wolfgang Betz |
132:51056160fa4a | 236 | #define OCF_LE_CREATE_CONN_CANCEL 0x000E |
Wolfgang Betz |
132:51056160fa4a | 237 | |
Wolfgang Betz |
132:51056160fa4a | 238 | #define OCF_LE_READ_WHITE_LIST_SIZE 0x000F |
Wolfgang Betz |
132:51056160fa4a | 239 | typedef __packed struct _le_read_white_list_size_rp{ |
Wolfgang Betz |
132:51056160fa4a | 240 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 241 | uint8_t size; |
Wolfgang Betz |
132:51056160fa4a | 242 | } PACKED le_read_white_list_size_rp; |
Wolfgang Betz |
132:51056160fa4a | 243 | #define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 244 | |
Wolfgang Betz |
132:51056160fa4a | 245 | #define OCF_LE_CLEAR_WHITE_LIST 0x0010 |
Wolfgang Betz |
132:51056160fa4a | 246 | |
Wolfgang Betz |
132:51056160fa4a | 247 | #define OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011 |
Wolfgang Betz |
132:51056160fa4a | 248 | typedef __packed struct _le_add_device_to_white_list_cp{ |
Wolfgang Betz |
132:51056160fa4a | 249 | uint8_t bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 250 | tBDAddr bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 251 | } PACKED le_add_device_to_white_list_cp; |
Wolfgang Betz |
132:51056160fa4a | 252 | #define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7 |
Wolfgang Betz |
132:51056160fa4a | 253 | |
Wolfgang Betz |
132:51056160fa4a | 254 | #define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012 |
Wolfgang Betz |
132:51056160fa4a | 255 | typedef __packed struct _le_remove_device_from_white_list_cp{ |
Wolfgang Betz |
132:51056160fa4a | 256 | uint8_t bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 257 | tBDAddr bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 258 | } PACKED le_remove_device_from_white_list_cp; |
Wolfgang Betz |
132:51056160fa4a | 259 | #define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7 |
Wolfgang Betz |
132:51056160fa4a | 260 | |
Wolfgang Betz |
132:51056160fa4a | 261 | #define OCF_LE_CONN_UPDATE 0x0013 |
Wolfgang Betz |
132:51056160fa4a | 262 | typedef __packed struct _le_connection_update_cp{ |
Wolfgang Betz |
132:51056160fa4a | 263 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 264 | uint16_t min_interval; |
Wolfgang Betz |
132:51056160fa4a | 265 | uint16_t max_interval; |
Wolfgang Betz |
132:51056160fa4a | 266 | uint16_t latency; |
Wolfgang Betz |
132:51056160fa4a | 267 | uint16_t supervision_timeout; |
Wolfgang Betz |
132:51056160fa4a | 268 | uint16_t min_ce_length; |
Wolfgang Betz |
132:51056160fa4a | 269 | uint16_t max_ce_length; |
Wolfgang Betz |
132:51056160fa4a | 270 | } PACKED le_connection_update_cp; |
Wolfgang Betz |
132:51056160fa4a | 271 | #define LE_CONN_UPDATE_CP_SIZE 14 |
Wolfgang Betz |
132:51056160fa4a | 272 | |
Wolfgang Betz |
132:51056160fa4a | 273 | #define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014 |
Wolfgang Betz |
132:51056160fa4a | 274 | typedef __packed struct _le_set_host_channel_classification_cp{ |
Wolfgang Betz |
132:51056160fa4a | 275 | uint8_t map[5]; |
Wolfgang Betz |
132:51056160fa4a | 276 | } PACKED le_set_host_channel_classification_cp; |
Wolfgang Betz |
132:51056160fa4a | 277 | #define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5 |
Wolfgang Betz |
132:51056160fa4a | 278 | |
Wolfgang Betz |
132:51056160fa4a | 279 | #define OCF_LE_READ_CHANNEL_MAP 0x0015 |
Wolfgang Betz |
132:51056160fa4a | 280 | typedef __packed struct _le_read_channel_map_cp{ |
Wolfgang Betz |
132:51056160fa4a | 281 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 282 | } PACKED le_read_channel_map_cp; |
Wolfgang Betz |
132:51056160fa4a | 283 | #define LE_READ_CHANNEL_MAP_CP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 284 | |
Wolfgang Betz |
132:51056160fa4a | 285 | typedef __packed struct _le_read_channel_map_rp{ |
Wolfgang Betz |
132:51056160fa4a | 286 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 287 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 288 | uint8_t map[5]; |
Andrea Palmieri |
229:9981f62cdb1a | 289 | } PACKED le_read_channel_map_rp; |
Wolfgang Betz |
132:51056160fa4a | 290 | #define LE_READ_CHANNEL_MAP_RP_SIZE 8 |
Wolfgang Betz |
132:51056160fa4a | 291 | |
Wolfgang Betz |
132:51056160fa4a | 292 | #define OCF_LE_READ_REMOTE_USED_FEATURES 0x0016 |
Wolfgang Betz |
132:51056160fa4a | 293 | typedef __packed struct _le_read_remote_used_features_cp{ |
Wolfgang Betz |
132:51056160fa4a | 294 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 295 | } PACKED le_read_remote_used_features_cp; |
Wolfgang Betz |
132:51056160fa4a | 296 | #define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 297 | |
Wolfgang Betz |
132:51056160fa4a | 298 | #define OCF_LE_ENCRYPT 0x0017 |
Wolfgang Betz |
132:51056160fa4a | 299 | typedef __packed struct _le_encrypt_cp{ |
Wolfgang Betz |
132:51056160fa4a | 300 | uint8_t key[16]; |
Wolfgang Betz |
132:51056160fa4a | 301 | uint8_t plaintext[16]; |
Wolfgang Betz |
132:51056160fa4a | 302 | } PACKED le_encrypt_cp; |
Wolfgang Betz |
132:51056160fa4a | 303 | #define LE_ENCRYPT_CP_SIZE 32 |
Wolfgang Betz |
132:51056160fa4a | 304 | |
Wolfgang Betz |
132:51056160fa4a | 305 | typedef __packed struct _le_encrypt_rp{ |
Wolfgang Betz |
132:51056160fa4a | 306 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 307 | uint8_t encdata[16]; |
Wolfgang Betz |
132:51056160fa4a | 308 | } PACKED le_encrypt_rp; |
Wolfgang Betz |
132:51056160fa4a | 309 | #define LE_ENCRYPT_RP_SIZE 17 |
Wolfgang Betz |
132:51056160fa4a | 310 | |
Wolfgang Betz |
132:51056160fa4a | 311 | #define OCF_LE_RAND 0x0018 |
Wolfgang Betz |
132:51056160fa4a | 312 | typedef __packed struct _le_rand_rp{ |
Wolfgang Betz |
132:51056160fa4a | 313 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 314 | uint8_t random[8]; |
Wolfgang Betz |
132:51056160fa4a | 315 | } PACKED le_rand_rp; |
Wolfgang Betz |
132:51056160fa4a | 316 | #define LE_RAND_RP_SIZE 9 |
Wolfgang Betz |
132:51056160fa4a | 317 | |
Wolfgang Betz |
132:51056160fa4a | 318 | #define OCF_LE_START_ENCRYPTION 0x0019 |
Wolfgang Betz |
132:51056160fa4a | 319 | typedef __packed struct _le_start_encryption_cp{ |
Wolfgang Betz |
132:51056160fa4a | 320 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 321 | uint8_t random[8]; |
Wolfgang Betz |
132:51056160fa4a | 322 | uint16_t diversifier; |
Wolfgang Betz |
132:51056160fa4a | 323 | uint8_t key[16]; |
Wolfgang Betz |
132:51056160fa4a | 324 | } PACKED le_start_encryption_cp; |
Wolfgang Betz |
132:51056160fa4a | 325 | #define LE_START_ENCRYPTION_CP_SIZE 28 |
Wolfgang Betz |
132:51056160fa4a | 326 | |
Wolfgang Betz |
132:51056160fa4a | 327 | #define OCF_LE_LTK_REPLY 0x001A |
Wolfgang Betz |
132:51056160fa4a | 328 | typedef __packed struct _le_ltk_reply_cp{ |
Wolfgang Betz |
132:51056160fa4a | 329 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 330 | uint8_t key[16]; |
Wolfgang Betz |
132:51056160fa4a | 331 | } PACKED le_ltk_reply_cp; |
Wolfgang Betz |
132:51056160fa4a | 332 | #define LE_LTK_REPLY_CP_SIZE 18 |
Wolfgang Betz |
132:51056160fa4a | 333 | |
Wolfgang Betz |
132:51056160fa4a | 334 | typedef __packed struct _le_ltk_reply_rp{ |
Wolfgang Betz |
132:51056160fa4a | 335 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 336 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 337 | } PACKED le_ltk_reply_rp; |
Wolfgang Betz |
132:51056160fa4a | 338 | #define LE_LTK_REPLY_RP_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 339 | |
Wolfgang Betz |
132:51056160fa4a | 340 | #define OCF_LE_LTK_NEG_REPLY 0x001B |
Wolfgang Betz |
132:51056160fa4a | 341 | typedef __packed struct _le_ltk_neg_reply_cp{ |
Wolfgang Betz |
132:51056160fa4a | 342 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 343 | } PACKED le_ltk_neg_reply_cp; |
Wolfgang Betz |
132:51056160fa4a | 344 | #define LE_LTK_NEG_REPLY_CP_SIZE 2 |
Wolfgang Betz |
132:51056160fa4a | 345 | |
Wolfgang Betz |
132:51056160fa4a | 346 | typedef __packed struct _le_ltk_neg_reply_rp{ |
Wolfgang Betz |
132:51056160fa4a | 347 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 348 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 349 | } PACKED le_ltk_neg_reply_rp; |
Wolfgang Betz |
132:51056160fa4a | 350 | #define LE_LTK_NEG_REPLY_RP_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 351 | |
Wolfgang Betz |
132:51056160fa4a | 352 | #define OCF_LE_READ_SUPPORTED_STATES 0x001C |
Wolfgang Betz |
132:51056160fa4a | 353 | typedef __packed struct _le_read_supported_states_rp{ |
Wolfgang Betz |
132:51056160fa4a | 354 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 355 | uint8_t states[8]; |
Wolfgang Betz |
132:51056160fa4a | 356 | } PACKED le_read_supported_states_rp; |
Wolfgang Betz |
132:51056160fa4a | 357 | #define LE_READ_SUPPORTED_STATES_RP_SIZE 9 |
Wolfgang Betz |
132:51056160fa4a | 358 | |
Wolfgang Betz |
132:51056160fa4a | 359 | #define OCF_LE_RECEIVER_TEST 0x001D |
Wolfgang Betz |
132:51056160fa4a | 360 | typedef __packed struct _le_receiver_test_cp{ |
Wolfgang Betz |
132:51056160fa4a | 361 | uint8_t frequency; |
Wolfgang Betz |
132:51056160fa4a | 362 | } PACKED le_receiver_test_cp; |
Wolfgang Betz |
132:51056160fa4a | 363 | #define LE_RECEIVER_TEST_CP_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 364 | |
Wolfgang Betz |
132:51056160fa4a | 365 | #define OCF_LE_TRANSMITTER_TEST 0x001E |
Wolfgang Betz |
132:51056160fa4a | 366 | typedef __packed struct _le_transmitter_test_cp{ |
Wolfgang Betz |
132:51056160fa4a | 367 | uint8_t frequency; |
Wolfgang Betz |
132:51056160fa4a | 368 | uint8_t length; |
Wolfgang Betz |
132:51056160fa4a | 369 | uint8_t payload; |
Wolfgang Betz |
132:51056160fa4a | 370 | } PACKED le_transmitter_test_cp; |
Wolfgang Betz |
132:51056160fa4a | 371 | #define LE_TRANSMITTER_TEST_CP_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 372 | |
Wolfgang Betz |
132:51056160fa4a | 373 | #define OCF_LE_TEST_END 0x001F |
Wolfgang Betz |
132:51056160fa4a | 374 | typedef __packed struct _le_test_end_rp{ |
Wolfgang Betz |
132:51056160fa4a | 375 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 376 | uint16_t num_pkts; |
Wolfgang Betz |
132:51056160fa4a | 377 | } PACKED le_test_end_rp; |
Wolfgang Betz |
132:51056160fa4a | 378 | #define LE_TEST_END_RP_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 379 | |
Wolfgang Betz |
132:51056160fa4a | 380 | /* Vendor specific commands */ |
Wolfgang Betz |
132:51056160fa4a | 381 | #define OGF_VENDOR_CMD 0x3f |
Wolfgang Betz |
132:51056160fa4a | 382 | |
Wolfgang Betz |
132:51056160fa4a | 383 | |
Wolfgang Betz |
132:51056160fa4a | 384 | /*------------- Events -------------*/ |
Wolfgang Betz |
132:51056160fa4a | 385 | #define EVT_CONN_COMPLETE 0x03 |
Wolfgang Betz |
132:51056160fa4a | 386 | typedef __packed struct _evt_conn_complete{ |
Wolfgang Betz |
132:51056160fa4a | 387 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 388 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 389 | tBDAddr bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 390 | uint8_t link_type; |
Wolfgang Betz |
132:51056160fa4a | 391 | uint8_t encr_mode; |
Wolfgang Betz |
132:51056160fa4a | 392 | } PACKED evt_conn_complete; |
Wolfgang Betz |
132:51056160fa4a | 393 | #define EVT_CONN_COMPLETE_SIZE 13 |
Wolfgang Betz |
132:51056160fa4a | 394 | |
Wolfgang Betz |
132:51056160fa4a | 395 | #define EVT_DISCONN_COMPLETE 0x05 |
Wolfgang Betz |
132:51056160fa4a | 396 | typedef __packed struct _evt_disconn_complete{ |
Wolfgang Betz |
132:51056160fa4a | 397 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 398 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 399 | uint8_t reason; |
Wolfgang Betz |
132:51056160fa4a | 400 | } PACKED evt_disconn_complete; |
Wolfgang Betz |
132:51056160fa4a | 401 | #define EVT_DISCONN_COMPLETE_SIZE 4 |
Wolfgang Betz |
132:51056160fa4a | 402 | |
Wolfgang Betz |
132:51056160fa4a | 403 | #define EVT_ENCRYPT_CHANGE 0x08 |
Wolfgang Betz |
132:51056160fa4a | 404 | typedef __packed struct _evt_encrypt_change{ |
Wolfgang Betz |
132:51056160fa4a | 405 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 406 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 407 | uint8_t encrypt; |
Wolfgang Betz |
132:51056160fa4a | 408 | } PACKED evt_encrypt_change; |
Wolfgang Betz |
132:51056160fa4a | 409 | #define EVT_ENCRYPT_CHANGE_SIZE 5 |
Wolfgang Betz |
132:51056160fa4a | 410 | |
Wolfgang Betz |
132:51056160fa4a | 411 | #define EVT_READ_REMOTE_VERSION_COMPLETE 0x0C |
Wolfgang Betz |
132:51056160fa4a | 412 | |
Wolfgang Betz |
132:51056160fa4a | 413 | #define EVT_CMD_COMPLETE 0x0E |
Wolfgang Betz |
132:51056160fa4a | 414 | typedef __packed struct _evt_cmd_complete{ |
Wolfgang Betz |
132:51056160fa4a | 415 | uint8_t ncmd; |
Wolfgang Betz |
132:51056160fa4a | 416 | uint16_t opcode; |
Wolfgang Betz |
132:51056160fa4a | 417 | } PACKED evt_cmd_complete; |
Wolfgang Betz |
132:51056160fa4a | 418 | #define EVT_CMD_COMPLETE_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 419 | |
Wolfgang Betz |
132:51056160fa4a | 420 | #define EVT_CMD_STATUS 0x0F |
Wolfgang Betz |
132:51056160fa4a | 421 | typedef __packed struct _evt_cmd_status{ |
Wolfgang Betz |
132:51056160fa4a | 422 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 423 | uint8_t ncmd; |
Wolfgang Betz |
132:51056160fa4a | 424 | uint16_t opcode; |
Wolfgang Betz |
132:51056160fa4a | 425 | } PACKED evt_cmd_status; |
Wolfgang Betz |
132:51056160fa4a | 426 | #define EVT_CMD_STATUS_SIZE 4 |
Wolfgang Betz |
132:51056160fa4a | 427 | |
Wolfgang Betz |
132:51056160fa4a | 428 | #define EVT_HARDWARE_ERROR 0x10 |
Wolfgang Betz |
132:51056160fa4a | 429 | typedef __packed struct _evt_hardware_error{ |
Wolfgang Betz |
132:51056160fa4a | 430 | uint8_t code; |
Wolfgang Betz |
132:51056160fa4a | 431 | } PACKED evt_hardware_error; |
Wolfgang Betz |
132:51056160fa4a | 432 | #define EVT_HARDWARE_ERROR_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 433 | |
Wolfgang Betz |
132:51056160fa4a | 434 | #define EVT_NUM_COMP_PKTS 0x13 |
Wolfgang Betz |
132:51056160fa4a | 435 | typedef __packed struct _evt_num_comp_pkts{ |
Wolfgang Betz |
132:51056160fa4a | 436 | uint8_t num_hndl; |
Wolfgang Betz |
132:51056160fa4a | 437 | /* variable length part */ |
Wolfgang Betz |
132:51056160fa4a | 438 | } PACKED evt_num_comp_pkts; |
Wolfgang Betz |
132:51056160fa4a | 439 | #define EVT_NUM_COMP_PKTS_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 440 | |
Wolfgang Betz |
132:51056160fa4a | 441 | /* variable length part of evt_num_comp_pkts. */ |
Wolfgang Betz |
132:51056160fa4a | 442 | typedef __packed struct _evt_num_comp_pkts_param{ |
Wolfgang Betz |
132:51056160fa4a | 443 | uint16_t hndl; |
Wolfgang Betz |
132:51056160fa4a | 444 | uint16_t num_comp_pkts; |
Wolfgang Betz |
132:51056160fa4a | 445 | } PACKED evt_num_comp_pkts_param; |
Wolfgang Betz |
132:51056160fa4a | 446 | #define EVT_NUM_COMP_PKTS_PARAM_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 447 | |
Wolfgang Betz |
132:51056160fa4a | 448 | #define EVT_DATA_BUFFER_OVERFLOW 0x1A |
Wolfgang Betz |
132:51056160fa4a | 449 | typedef __packed struct _evt_data_buffer_overflow{ |
Wolfgang Betz |
132:51056160fa4a | 450 | uint8_t link_type; |
Wolfgang Betz |
132:51056160fa4a | 451 | } PACKED evt_data_buffer_overflow; |
Wolfgang Betz |
132:51056160fa4a | 452 | #define EVT_DATA_BUFFER_OVERFLOW_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 453 | |
Wolfgang Betz |
132:51056160fa4a | 454 | #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30 |
Wolfgang Betz |
132:51056160fa4a | 455 | typedef __packed struct _evt_encryption_key_refresh_complete{ |
Wolfgang Betz |
132:51056160fa4a | 456 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 457 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 458 | } PACKED evt_encryption_key_refresh_complete; |
Wolfgang Betz |
132:51056160fa4a | 459 | #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3 |
Wolfgang Betz |
132:51056160fa4a | 460 | |
Wolfgang Betz |
132:51056160fa4a | 461 | #define EVT_LE_META_EVENT 0x3E |
Wolfgang Betz |
132:51056160fa4a | 462 | typedef __packed struct _evt_le_meta_event{ |
Wolfgang Betz |
132:51056160fa4a | 463 | uint8_t subevent; |
Wolfgang Betz |
132:51056160fa4a | 464 | uint8_t data[VARIABLE_SIZE]; |
Wolfgang Betz |
132:51056160fa4a | 465 | } PACKED evt_le_meta_event; |
Wolfgang Betz |
132:51056160fa4a | 466 | #define EVT_LE_META_EVENT_SIZE 1 |
Wolfgang Betz |
132:51056160fa4a | 467 | |
Wolfgang Betz |
132:51056160fa4a | 468 | #define EVT_LE_CONN_COMPLETE 0x01 |
Wolfgang Betz |
132:51056160fa4a | 469 | typedef __packed struct _evt_le_connection_complete{ |
Wolfgang Betz |
132:51056160fa4a | 470 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 471 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 472 | uint8_t role; |
Wolfgang Betz |
132:51056160fa4a | 473 | uint8_t peer_bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 474 | tBDAddr peer_bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 475 | uint16_t interval; |
Wolfgang Betz |
132:51056160fa4a | 476 | uint16_t latency; |
Wolfgang Betz |
132:51056160fa4a | 477 | uint16_t supervision_timeout; |
Wolfgang Betz |
132:51056160fa4a | 478 | uint8_t master_clock_accuracy; |
Wolfgang Betz |
132:51056160fa4a | 479 | } PACKED evt_le_connection_complete; |
Wolfgang Betz |
132:51056160fa4a | 480 | #define EVT_LE_CONN_COMPLETE_SIZE 18 |
Wolfgang Betz |
132:51056160fa4a | 481 | |
Wolfgang Betz |
132:51056160fa4a | 482 | #define EVT_LE_ADVERTISING_REPORT 0x02 |
Wolfgang Betz |
132:51056160fa4a | 483 | typedef __packed struct _le_advertising_info{ |
Wolfgang Betz |
132:51056160fa4a | 484 | uint8_t evt_type; |
Wolfgang Betz |
132:51056160fa4a | 485 | uint8_t bdaddr_type; |
Wolfgang Betz |
132:51056160fa4a | 486 | tBDAddr bdaddr; |
Wolfgang Betz |
132:51056160fa4a | 487 | uint8_t data_length; |
Wolfgang Betz |
132:51056160fa4a | 488 | uint8_t data_RSSI[VARIABLE_SIZE]; // RSSI is last octect (signed integer). |
Wolfgang Betz |
132:51056160fa4a | 489 | } PACKED le_advertising_info; |
Wolfgang Betz |
132:51056160fa4a | 490 | #define LE_ADVERTISING_INFO_SIZE 9 |
Wolfgang Betz |
132:51056160fa4a | 491 | |
Wolfgang Betz |
132:51056160fa4a | 492 | #define EVT_LE_CONN_UPDATE_COMPLETE 0x03 |
Wolfgang Betz |
132:51056160fa4a | 493 | typedef __packed struct _evt_le_connection_update_complete{ |
Wolfgang Betz |
132:51056160fa4a | 494 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 495 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 496 | uint16_t interval; |
Wolfgang Betz |
132:51056160fa4a | 497 | uint16_t latency; |
Wolfgang Betz |
132:51056160fa4a | 498 | uint16_t supervision_timeout; |
Wolfgang Betz |
132:51056160fa4a | 499 | } PACKED evt_le_connection_update_complete; |
Wolfgang Betz |
132:51056160fa4a | 500 | #define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9 |
Wolfgang Betz |
132:51056160fa4a | 501 | |
Wolfgang Betz |
132:51056160fa4a | 502 | #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04 |
Wolfgang Betz |
132:51056160fa4a | 503 | typedef __packed struct _evt_le_read_remote_used_features_complete{ |
Wolfgang Betz |
132:51056160fa4a | 504 | uint8_t status; |
Wolfgang Betz |
132:51056160fa4a | 505 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 506 | uint8_t features[8]; |
Wolfgang Betz |
132:51056160fa4a | 507 | } PACKED evt_le_read_remote_used_features_complete; |
Wolfgang Betz |
132:51056160fa4a | 508 | #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11 |
Wolfgang Betz |
132:51056160fa4a | 509 | |
Wolfgang Betz |
132:51056160fa4a | 510 | #define EVT_LE_LTK_REQUEST 0x05 |
Wolfgang Betz |
132:51056160fa4a | 511 | typedef __packed struct _evt_le_long_term_key_request{ |
Wolfgang Betz |
132:51056160fa4a | 512 | uint16_t handle; |
Wolfgang Betz |
132:51056160fa4a | 513 | uint8_t random[8]; |
Wolfgang Betz |
132:51056160fa4a | 514 | uint16_t ediv; |
Wolfgang Betz |
132:51056160fa4a | 515 | } PACKED evt_le_long_term_key_request; |
Wolfgang Betz |
132:51056160fa4a | 516 | #define EVT_LE_LTK_REQUEST_SIZE 12 |
Wolfgang Betz |
132:51056160fa4a | 517 | |
Wolfgang Betz |
132:51056160fa4a | 518 | /** |
Wolfgang Betz |
132:51056160fa4a | 519 | * The event code in the @ref hci_event_pckt structure. If event code is EVT_VENDOR, |
Wolfgang Betz |
132:51056160fa4a | 520 | * application can use @ref evt_blue_aci structure to parse the packet. |
Wolfgang Betz |
132:51056160fa4a | 521 | */ |
Wolfgang Betz |
132:51056160fa4a | 522 | #define EVT_VENDOR 0xFF |
Wolfgang Betz |
132:51056160fa4a | 523 | |
Wolfgang Betz |
132:51056160fa4a | 524 | |
Wolfgang Betz |
132:51056160fa4a | 525 | /* Command opcode pack/unpack */ |
Wolfgang Betz |
132:51056160fa4a | 526 | #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10)) |
Wolfgang Betz |
132:51056160fa4a | 527 | #define cmd_opcode_ogf(op) (op >> 10) |
Wolfgang Betz |
132:51056160fa4a | 528 | #define cmd_opcode_ocf(op) (op & 0x03ff) |
Wolfgang Betz |
132:51056160fa4a | 529 | |
Wolfgang Betz |
132:51056160fa4a | 530 | |
Wolfgang Betz |
132:51056160fa4a | 531 | struct hci_request { |
Wolfgang Betz |
132:51056160fa4a | 532 | uint16_t ogf; |
Wolfgang Betz |
132:51056160fa4a | 533 | uint16_t ocf; |
Wolfgang Betz |
132:51056160fa4a | 534 | int event; |
Wolfgang Betz |
132:51056160fa4a | 535 | void *cparam; |
Wolfgang Betz |
132:51056160fa4a | 536 | int clen; |
Wolfgang Betz |
132:51056160fa4a | 537 | void *rparam; |
Wolfgang Betz |
132:51056160fa4a | 538 | int rlen; |
Wolfgang Betz |
132:51056160fa4a | 539 | }; |
Wolfgang Betz |
132:51056160fa4a | 540 | |
Wolfgang Betz |
132:51056160fa4a | 541 | void hci_send_cmd(uint16_t ogf, uint16_t ocf, uint8_t plen, void *param); |
Wolfgang Betz |
132:51056160fa4a | 542 | |
Wolfgang Betz |
132:51056160fa4a | 543 | typedef enum { |
Wolfgang Betz |
132:51056160fa4a | 544 | WAITING_TYPE, |
Wolfgang Betz |
132:51056160fa4a | 545 | WAITING_OPCODE1, |
Wolfgang Betz |
132:51056160fa4a | 546 | WAITING_OPCODE2, |
Wolfgang Betz |
132:51056160fa4a | 547 | WAITING_EVENT_CODE, |
Wolfgang Betz |
132:51056160fa4a | 548 | WAITING_HANDLE, |
Wolfgang Betz |
132:51056160fa4a | 549 | WAITING_HANDLE_FLAG, |
Wolfgang Betz |
132:51056160fa4a | 550 | WAITING_PARAM_LEN, |
Wolfgang Betz |
132:51056160fa4a | 551 | WAITING_DATA_LEN1, |
Wolfgang Betz |
132:51056160fa4a | 552 | WAITING_DATA_LEN2, |
Wolfgang Betz |
132:51056160fa4a | 553 | WAITING_PAYLOAD |
Wolfgang Betz |
132:51056160fa4a | 554 | }hci_state; |
Wolfgang Betz |
132:51056160fa4a | 555 | |
Wolfgang Betz |
132:51056160fa4a | 556 | typedef void (*hci_packet_complete_callback)(void *pckt, uint16_t len); |
Wolfgang Betz |
132:51056160fa4a | 557 | |
Wolfgang Betz |
132:51056160fa4a | 558 | /* HCI library functions. */ |
Wolfgang Betz |
132:51056160fa4a | 559 | void hci_init(void); |
Wolfgang Betz |
132:51056160fa4a | 560 | |
Wolfgang Betz |
132:51056160fa4a | 561 | int hci_send_req(struct hci_request *r, BOOL async); |
Wolfgang Betz |
132:51056160fa4a | 562 | |
Wolfgang Betz |
132:51056160fa4a | 563 | #endif /* __HCI_INTERNAL_H_ */ |