1 /* 2 * ng_hci.h 3 */ 4 5 /*- 6 * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin@yahoo.com> 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * $Id: ng_hci.h,v 1.2 2003/03/18 00:09:37 max Exp $ 31 * $FreeBSD$ 32 */ 33 34 /* 35 * This file contains everything that application needs to know about 36 * Host Controller Interface (HCI). All information was obtained from 37 * Bluetooth Specification Book v1.1. 38 * 39 * This file can be included by both kernel and userland applications. 40 * 41 * NOTE: Here and after Bluetooth device is called a "unit". Bluetooth 42 * specification refers to both devices and units. They are the 43 * same thing (i think), so to be consistent word "unit" will be 44 * used. 45 */ 46 47 #ifndef _NETGRAPH_HCI_H_ 48 #define _NETGRAPH_HCI_H_ 49 50 /************************************************************************** 51 ************************************************************************** 52 ** Netgraph node hook name, type name and type cookie and commands 53 ************************************************************************** 54 **************************************************************************/ 55 56 /* Node type name and type cookie */ 57 #define NG_HCI_NODE_TYPE "hci" 58 #define NGM_HCI_COOKIE 1000774184 59 60 /* Netgraph node hook names */ 61 #define NG_HCI_HOOK_DRV "drv" /* Driver <-> HCI */ 62 #define NG_HCI_HOOK_ACL "acl" /* HCI <-> Upper */ 63 #define NG_HCI_HOOK_SCO "sco" /* HCI <-> Upper */ 64 #define NG_HCI_HOOK_RAW "raw" /* HCI <-> Upper */ 65 66 /************************************************************************** 67 ************************************************************************** 68 ** Common defines and types (HCI) 69 ************************************************************************** 70 **************************************************************************/ 71 72 /* All sizes are in bytes */ 73 #define NG_HCI_BDADDR_SIZE 6 /* unit address */ 74 #define NG_HCI_LAP_SIZE 3 /* unit LAP */ 75 #define NG_HCI_KEY_SIZE 16 /* link key */ 76 #define NG_HCI_PIN_SIZE 16 /* link PIN */ 77 #define NG_HCI_EVENT_MASK_SIZE 8 /* event mask */ 78 #define NG_HCI_LE_EVENT_MASK_SIZE 8 /* event mask */ 79 #define NG_HCI_CLASS_SIZE 3 /* unit class */ 80 #define NG_HCI_FEATURES_SIZE 8 /* LMP features */ 81 #define NG_HCI_UNIT_NAME_SIZE 248 /* unit name size */ 82 #define NG_HCI_COMMANDS_SIZE 64 /*Command list BMP size*/ 83 /* HCI specification */ 84 #define NG_HCI_SPEC_V10 0x00 /* v1.0 */ 85 #define NG_HCI_SPEC_V11 0x01 /* v1.1 */ 86 /* 0x02 - 0xFF - reserved for future use */ 87 88 /* LMP features */ 89 /* ------------------- byte 0 --------------------*/ 90 #define NG_HCI_LMP_3SLOT 0x01 91 #define NG_HCI_LMP_5SLOT 0x02 92 #define NG_HCI_LMP_ENCRYPTION 0x04 93 #define NG_HCI_LMP_SLOT_OFFSET 0x08 94 #define NG_HCI_LMP_TIMING_ACCURACY 0x10 95 #define NG_HCI_LMP_SWITCH 0x20 96 #define NG_HCI_LMP_HOLD_MODE 0x40 97 #define NG_HCI_LMP_SNIFF_MODE 0x80 98 /* ------------------- byte 1 --------------------*/ 99 #define NG_HCI_LMP_PARK_MODE 0x01 100 #define NG_HCI_LMP_RSSI 0x02 101 #define NG_HCI_LMP_CHANNEL_QUALITY 0x04 102 #define NG_HCI_LMP_SCO_LINK 0x08 103 #define NG_HCI_LMP_HV2_PKT 0x10 104 #define NG_HCI_LMP_HV3_PKT 0x20 105 #define NG_HCI_LMP_ULAW_LOG 0x40 106 #define NG_HCI_LMP_ALAW_LOG 0x80 107 /* ------------------- byte 2 --------------------*/ 108 #define NG_HCI_LMP_CVSD 0x01 109 #define NG_HCI_LMP_PAGING_SCHEME 0x02 110 #define NG_HCI_LMP_POWER_CONTROL 0x04 111 #define NG_HCI_LMP_TRANSPARENT_SCO 0x08 112 #define NG_HCI_LMP_FLOW_CONTROL_LAG0 0x10 113 #define NG_HCI_LMP_FLOW_CONTROL_LAG1 0x20 114 #define NG_HCI_LMP_FLOW_CONTROL_LAG2 0x40 115 116 /* Link types */ 117 #define NG_HCI_LINK_SCO 0x00 /* Voice */ 118 #define NG_HCI_LINK_ACL 0x01 /* Data */ 119 #define NG_HCI_LINK_LE_PUBLIC 0x02 /* LE Public*/ 120 #define NG_HCI_LINK_LE_RANDOM 0x03 /* LE Random*/ 121 /* 0x02 - 0xFF - reserved for future use */ 122 123 /* Packet types */ 124 /* 0x0001 - 0x0004 - reserved for future use */ 125 #define NG_HCI_PKT_DM1 0x0008 /* ACL link */ 126 #define NG_HCI_PKT_DH1 0x0010 /* ACL link */ 127 #define NG_HCI_PKT_HV1 0x0020 /* SCO link */ 128 #define NG_HCI_PKT_HV2 0x0040 /* SCO link */ 129 #define NG_HCI_PKT_HV3 0x0080 /* SCO link */ 130 /* 0x0100 - 0x0200 - reserved for future use */ 131 #define NG_HCI_PKT_DM3 0x0400 /* ACL link */ 132 #define NG_HCI_PKT_DH3 0x0800 /* ACL link */ 133 /* 0x1000 - 0x2000 - reserved for future use */ 134 #define NG_HCI_PKT_DM5 0x4000 /* ACL link */ 135 #define NG_HCI_PKT_DH5 0x8000 /* ACL link */ 136 137 /* 138 * Connection modes/Unit modes 139 * 140 * This is confusing. It means that one of the units change its mode 141 * for the specific connection. For example one connection was put on 142 * hold (but i could be wrong :) 143 */ 144 145 #define NG_HCI_UNIT_MODE_ACTIVE 0x00 146 #define NG_HCI_UNIT_MODE_HOLD 0x01 147 #define NG_HCI_UNIT_MODE_SNIFF 0x02 148 #define NG_HCI_UNIT_MODE_PARK 0x03 149 /* 0x04 - 0xFF - reserved for future use */ 150 151 /* Page scan modes */ 152 #define NG_HCI_MANDATORY_PAGE_SCAN_MODE 0x00 153 #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01 154 #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02 155 #define NG_HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03 156 /* 0x04 - 0xFF - reserved for future use */ 157 158 /* Page scan repetition modes */ 159 #define NG_HCI_SCAN_REP_MODE0 0x00 160 #define NG_HCI_SCAN_REP_MODE1 0x01 161 #define NG_HCI_SCAN_REP_MODE2 0x02 162 /* 0x03 - 0xFF - reserved for future use */ 163 164 /* Page scan period modes */ 165 #define NG_HCI_PAGE_SCAN_PERIOD_MODE0 0x00 166 #define NG_HCI_PAGE_SCAN_PERIOD_MODE1 0x01 167 #define NG_HCI_PAGE_SCAN_PERIOD_MODE2 0x02 168 /* 0x03 - 0xFF - reserved for future use */ 169 170 /* Scan enable */ 171 #define NG_HCI_NO_SCAN_ENABLE 0x00 172 #define NG_HCI_INQUIRY_ENABLE_PAGE_DISABLE 0x01 173 #define NG_HCI_INQUIRY_DISABLE_PAGE_ENABLE 0x02 174 #define NG_HCI_INQUIRY_ENABLE_PAGE_ENABLE 0x03 175 /* 0x04 - 0xFF - reserved for future use */ 176 177 /* Hold mode activities */ 178 #define NG_HCI_HOLD_MODE_NO_CHANGE 0x00 179 #define NG_HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01 180 #define NG_HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02 181 #define NG_HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04 182 /* 0x08 - 0x80 - reserved for future use */ 183 184 /* Connection roles */ 185 #define NG_HCI_ROLE_MASTER 0x00 186 #define NG_HCI_ROLE_SLAVE 0x01 187 /* 0x02 - 0xFF - reserved for future use */ 188 189 /* Key flags */ 190 #define NG_HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00 191 #define NG_HCI_USE_TEMPORARY_LINK_KEY 0x01 192 /* 0x02 - 0xFF - reserved for future use */ 193 194 /* Pin types */ 195 #define NG_HCI_PIN_TYPE_VARIABLE 0x00 196 #define NG_HCI_PIN_TYPE_FIXED 0x01 197 198 /* Link key types */ 199 #define NG_HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00 200 #define NG_HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01 201 #define NG_HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02 202 /* 0x03 - 0xFF - reserved for future use */ 203 204 /* Encryption modes */ 205 #define NG_HCI_ENCRYPTION_MODE_NONE 0x00 206 #define NG_HCI_ENCRYPTION_MODE_P2P 0x01 207 #define NG_HCI_ENCRYPTION_MODE_ALL 0x02 208 /* 0x03 - 0xFF - reserved for future use */ 209 210 /* Quality of service types */ 211 #define NG_HCI_SERVICE_TYPE_NO_TRAFFIC 0x00 212 #define NG_HCI_SERVICE_TYPE_BEST_EFFORT 0x01 213 #define NG_HCI_SERVICE_TYPE_GUARANTEED 0x02 214 /* 0x03 - 0xFF - reserved for future use */ 215 216 /* Link policy settings */ 217 #define NG_HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000 218 #define NG_HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 /* Master/Slave switch */ 219 #define NG_HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002 220 #define NG_HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004 221 #define NG_HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008 222 /* 0x0010 - 0x8000 - reserved for future use */ 223 224 /* Event masks */ 225 #define NG_HCI_EVMSK_ALL 0x00000000ffffffff 226 #define NG_HCI_EVMSK_NONE 0x0000000000000000 227 #define NG_HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001 228 #define NG_HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002 229 #define NG_HCI_EVMSK_CON_COMPL 0x0000000000000004 230 #define NG_HCI_EVMSK_CON_REQ 0x0000000000000008 231 #define NG_HCI_EVMSK_DISCON_COMPL 0x0000000000000010 232 #define NG_HCI_EVMSK_AUTH_COMPL 0x0000000000000020 233 #define NG_HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040 234 #define NG_HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080 235 #define NG_HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100 236 #define NG_HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200 237 #define NG_HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400 238 #define NG_HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800 239 #define NG_HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000 240 #define NG_HCI_EVMSK_COMMAND_COMPL 0x0000000000002000 241 #define NG_HCI_EVMSK_COMMAND_STATUS 0x0000000000004000 242 #define NG_HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000 243 #define NG_HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000 244 #define NG_HCI_EVMSK_ROLE_CHANGE 0x0000000000020000 245 #define NG_HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000 246 #define NG_HCI_EVMSK_MODE_CHANGE 0x0000000000080000 247 #define NG_HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000 248 #define NG_HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000 249 #define NG_HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000 250 #define NG_HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000 251 #define NG_HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000 252 #define NG_HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000 253 #define NG_HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000 254 #define NG_HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000 255 #define NG_HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000 256 #define NG_HCI_EVMSK_QOS_VIOLATION 0x0000000020000000 257 #define NG_HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000 258 #define NG_HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000 259 /* 0x0000000100000000 - 0x8000000000000000 - reserved for future use */ 260 261 /* Filter types */ 262 #define NG_HCI_FILTER_TYPE_NONE 0x00 263 #define NG_HCI_FILTER_TYPE_INQUIRY_RESULT 0x01 264 #define NG_HCI_FILTER_TYPE_CON_SETUP 0x02 265 /* 0x03 - 0xFF - reserved for future use */ 266 267 /* Filter condition types for NG_HCI_FILTER_TYPE_INQUIRY_RESULT */ 268 #define NG_HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00 269 #define NG_HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01 270 #define NG_HCI_FILTER_COND_INQUIRY_BDADDR 0x02 271 /* 0x03 - 0xFF - reserved for future use */ 272 273 /* Filter condition types for NG_HCI_FILTER_TYPE_CON_SETUP */ 274 #define NG_HCI_FILTER_COND_CON_ANY_UNIT 0x00 275 #define NG_HCI_FILTER_COND_CON_UNIT_CLASS 0x01 276 #define NG_HCI_FILTER_COND_CON_BDADDR 0x02 277 /* 0x03 - 0xFF - reserved for future use */ 278 279 /* Xmit level types */ 280 #define NG_HCI_XMIT_LEVEL_CURRENT 0x00 281 #define NG_HCI_XMIT_LEVEL_MAXIMUM 0x01 282 /* 0x02 - 0xFF - reserved for future use */ 283 284 /* Host to Host Controller flow control */ 285 #define NG_HCI_H2HC_FLOW_CONTROL_NONE 0x00 286 #define NG_HCI_H2HC_FLOW_CONTROL_ACL 0x01 287 #define NG_HCI_H2HC_FLOW_CONTROL_SCO 0x02 288 #define NG_HCI_H2HC_FLOW_CONTROL_BOTH 0x03 /* ACL and SCO */ 289 /* 0x04 - 0xFF - reserved future use */ 290 291 /* Country codes */ 292 #define NG_HCI_COUNTRY_CODE_NAM_EUR_JP 0x00 293 #define NG_HCI_COUNTRY_CODE_FRANCE 0x01 294 /* 0x02 - 0xFF - reserved future use */ 295 296 /* Loopback modes */ 297 #define NG_HCI_LOOPBACK_NONE 0x00 298 #define NG_HCI_LOOPBACK_LOCAL 0x01 299 #define NG_HCI_LOOPBACK_REMOTE 0x02 300 /* 0x03 - 0xFF - reserved future use */ 301 302 /************************************************************************** 303 ************************************************************************** 304 ** Link level defines, headers and types 305 ************************************************************************** 306 **************************************************************************/ 307 308 /* 309 * Macro(s) to combine OpCode and extract OGF (OpCode Group Field) 310 * and OCF (OpCode Command Field) from OpCode. 311 */ 312 313 #define NG_HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff)) 314 #define NG_HCI_OCF(op) ((op) & 0x3ff) 315 #define NG_HCI_OGF(op) (((op) >> 10) & 0x3f) 316 317 /* 318 * Marco(s) to extract/combine connection handle, BC (Broadcast) and 319 * PB (Packet boundary) flags. 320 */ 321 322 #define NG_HCI_CON_HANDLE(h) ((h) & 0x0fff) 323 #define NG_HCI_PB_FLAG(h) (((h) & 0x3000) >> 12) 324 #define NG_HCI_BC_FLAG(h) (((h) & 0xc000) >> 14) 325 #define NG_HCI_MK_CON_HANDLE(h, pb, bc) \ 326 (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) 327 328 /* PB flag values */ 329 /* 00 - reserved for future use */ 330 #define NG_HCI_PACKET_FRAGMENT 0x1 331 #define NG_HCI_PACKET_START 0x2 332 /* 11 - reserved for future use */ 333 334 /* BC flag values */ 335 #define NG_HCI_POINT2POINT 0x0 /* only Host controller to Host */ 336 #define NG_HCI_BROADCAST_ACTIVE 0x1 /* both directions */ 337 #define NG_HCI_BROADCAST_PICONET 0x2 /* both directions */ 338 /* 11 - reserved for future use */ 339 340 /* HCI command packet header */ 341 #define NG_HCI_CMD_PKT 0x01 342 #define NG_HCI_CMD_PKT_SIZE 0xff /* without header */ 343 typedef struct { 344 u_int8_t type; /* MUST be 0x1 */ 345 u_int16_t opcode; /* OpCode */ 346 u_int8_t length; /* parameter(s) length in bytes */ 347 } __attribute__ ((packed)) ng_hci_cmd_pkt_t; 348 349 /* ACL data packet header */ 350 #define NG_HCI_ACL_DATA_PKT 0x02 351 #define NG_HCI_ACL_PKT_SIZE 0xffff /* without header */ 352 typedef struct { 353 u_int8_t type; /* MUST be 0x2 */ 354 u_int16_t con_handle; /* connection handle + PB + BC flags */ 355 u_int16_t length; /* payload length in bytes */ 356 } __attribute__ ((packed)) ng_hci_acldata_pkt_t; 357 358 /* SCO data packet header */ 359 #define NG_HCI_SCO_DATA_PKT 0x03 360 #define NG_HCI_SCO_PKT_SIZE 0xff /* without header */ 361 typedef struct { 362 u_int8_t type; /* MUST be 0x3 */ 363 u_int16_t con_handle; /* connection handle + reserved bits */ 364 u_int8_t length; /* payload length in bytes */ 365 } __attribute__ ((packed)) ng_hci_scodata_pkt_t; 366 367 /* HCI event packet header */ 368 #define NG_HCI_EVENT_PKT 0x04 369 #define NG_HCI_EVENT_PKT_SIZE 0xff /* without header */ 370 typedef struct { 371 u_int8_t type; /* MUST be 0x4 */ 372 u_int8_t event; /* event */ 373 u_int8_t length; /* parameter(s) length in bytes */ 374 } __attribute__ ((packed)) ng_hci_event_pkt_t; 375 376 /* Bluetooth unit address */ 377 typedef struct { 378 u_int8_t b[NG_HCI_BDADDR_SIZE]; 379 } __attribute__ ((packed)) bdaddr_t; 380 typedef bdaddr_t * bdaddr_p; 381 382 /* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */ 383 #define NG_HCI_BDADDR_ANY ((bdaddr_p) "\000\000\000\000\000\000") 384 385 /* HCI status return parameter */ 386 typedef struct { 387 u_int8_t status; /* 0x00 - success */ 388 } __attribute__ ((packed)) ng_hci_status_rp; 389 390 /************************************************************************** 391 ************************************************************************** 392 ** Upper layer protocol interface. LP_xxx event parameters 393 ************************************************************************** 394 **************************************************************************/ 395 396 /* Connection Request Event */ 397 #define NGM_HCI_LP_CON_REQ 1 /* Upper -> HCI */ 398 typedef struct { 399 u_int16_t link_type; /* type of connection */ 400 bdaddr_t bdaddr; /* remote unit address */ 401 } ng_hci_lp_con_req_ep; 402 403 /* 404 * XXX XXX XXX 405 * 406 * NOTE: This request is not defined by Bluetooth specification, 407 * but i find it useful :) 408 */ 409 #define NGM_HCI_LP_DISCON_REQ 2 /* Upper -> HCI */ 410 typedef struct { 411 u_int16_t con_handle; /* connection handle */ 412 u_int16_t reason; /* reason to disconnect (only low byte) */ 413 } ng_hci_lp_discon_req_ep; 414 415 /* Connection Confirmation Event */ 416 #define NGM_HCI_LP_CON_CFM 3 /* HCI -> Upper */ 417 typedef struct { 418 u_int8_t status; /* 0x00 - success */ 419 u_int8_t link_type; /* link type */ 420 u_int16_t con_handle; /* con_handle */ 421 bdaddr_t bdaddr; /* remote unit address */ 422 } ng_hci_lp_con_cfm_ep; 423 424 /* Connection Indication Event */ 425 #define NGM_HCI_LP_CON_IND 4 /* HCI -> Upper */ 426 typedef struct { 427 u_int8_t link_type; /* link type */ 428 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */ 429 bdaddr_t bdaddr; /* remote unit address */ 430 } ng_hci_lp_con_ind_ep; 431 432 /* Connection Response Event */ 433 #define NGM_HCI_LP_CON_RSP 5 /* Upper -> HCI */ 434 typedef struct { 435 u_int8_t status; /* 0x00 - accept connection */ 436 u_int8_t link_type; /* link type */ 437 bdaddr_t bdaddr; /* remote unit address */ 438 } ng_hci_lp_con_rsp_ep; 439 440 /* Disconnection Indication Event */ 441 #define NGM_HCI_LP_DISCON_IND 6 /* HCI -> Upper */ 442 typedef struct { 443 u_int8_t reason; /* reason to disconnect (only low byte) */ 444 u_int8_t link_type; /* link type */ 445 u_int16_t con_handle; /* connection handle */ 446 } ng_hci_lp_discon_ind_ep; 447 448 /* QoS Setup Request Event */ 449 #define NGM_HCI_LP_QOS_REQ 7 /* Upper -> HCI */ 450 typedef struct { 451 u_int16_t con_handle; /* connection handle */ 452 u_int8_t flags; /* reserved */ 453 u_int8_t service_type; /* service type */ 454 u_int32_t token_rate; /* bytes/sec */ 455 u_int32_t peak_bandwidth; /* bytes/sec */ 456 u_int32_t latency; /* msec */ 457 u_int32_t delay_variation; /* msec */ 458 } ng_hci_lp_qos_req_ep; 459 460 /* QoS Conformition Event */ 461 #define NGM_HCI_LP_QOS_CFM 8 /* HCI -> Upper */ 462 typedef struct { 463 u_int16_t status; /* 0x00 - success (only low byte) */ 464 u_int16_t con_handle; /* connection handle */ 465 } ng_hci_lp_qos_cfm_ep; 466 467 /* QoS Violation Indication Event */ 468 #define NGM_HCI_LP_QOS_IND 9 /* HCI -> Upper */ 469 typedef struct { 470 u_int16_t con_handle; /* connection handle */ 471 } ng_hci_lp_qos_ind_ep; 472 /*Encryption Change event*/ 473 #define NGM_HCI_LP_ENC_CHG 10 /* HCI->Upper*/ 474 typedef struct { 475 uint16_t con_handle; 476 uint8_t status; 477 uint8_t link_type; 478 }ng_hci_lp_enc_change_ep; 479 /************************************************************************** 480 ************************************************************************** 481 ** HCI node command/event parameters 482 ************************************************************************** 483 **************************************************************************/ 484 485 /* Debug levels */ 486 #define NG_HCI_ALERT_LEVEL 1 487 #define NG_HCI_ERR_LEVEL 2 488 #define NG_HCI_WARN_LEVEL 3 489 #define NG_HCI_INFO_LEVEL 4 490 491 /* Unit states */ 492 #define NG_HCI_UNIT_CONNECTED (1 << 0) 493 #define NG_HCI_UNIT_INITED (1 << 1) 494 #define NG_HCI_UNIT_READY (NG_HCI_UNIT_CONNECTED|NG_HCI_UNIT_INITED) 495 #define NG_HCI_UNIT_COMMAND_PENDING (1 << 2) 496 497 /* Connection state */ 498 #define NG_HCI_CON_CLOSED 0 /* connection closed */ 499 #define NG_HCI_CON_W4_LP_CON_RSP 1 /* wait for LP_ConnectRsp */ 500 #define NG_HCI_CON_W4_CONN_COMPLETE 2 /* wait for Connection_Complete evt */ 501 #define NG_HCI_CON_OPEN 3 /* connection open */ 502 503 /* Get HCI node (unit) state (see states above) */ 504 #define NGM_HCI_NODE_GET_STATE 100 /* HCI -> User */ 505 typedef u_int16_t ng_hci_node_state_ep; 506 507 /* Turn on "inited" bit */ 508 #define NGM_HCI_NODE_INIT 101 /* User -> HCI */ 509 /* No parameters */ 510 511 /* Get/Set node debug level (see debug levels above) */ 512 #define NGM_HCI_NODE_GET_DEBUG 102 /* HCI -> User */ 513 #define NGM_HCI_NODE_SET_DEBUG 103 /* User -> HCI */ 514 typedef u_int16_t ng_hci_node_debug_ep; 515 516 /* Get node buffer info */ 517 #define NGM_HCI_NODE_GET_BUFFER 104 /* HCI -> User */ 518 typedef struct { 519 u_int8_t cmd_free; /* number of free command packets */ 520 u_int8_t sco_size; /* max. size of SCO packet */ 521 u_int16_t sco_pkts; /* number of SCO packets */ 522 u_int16_t sco_free; /* number of free SCO packets */ 523 u_int16_t acl_size; /* max. size of ACL packet */ 524 u_int16_t acl_pkts; /* number of ACL packets */ 525 u_int16_t acl_free; /* number of free ACL packets */ 526 } ng_hci_node_buffer_ep; 527 528 /* Get BDADDR */ 529 #define NGM_HCI_NODE_GET_BDADDR 105 /* HCI -> User */ 530 /* bdaddr_t -- BDADDR */ 531 532 /* Get features */ 533 #define NGM_HCI_NODE_GET_FEATURES 106 /* HCI -> User */ 534 /* features[NG_HCI_FEATURES_SIZE] -- features */ 535 536 #define NGM_HCI_NODE_GET_STAT 107 /* HCI -> User */ 537 typedef struct { 538 u_int32_t cmd_sent; /* number of HCI commands sent */ 539 u_int32_t evnt_recv; /* number of HCI events received */ 540 u_int32_t acl_recv; /* number of ACL packets received */ 541 u_int32_t acl_sent; /* number of ACL packets sent */ 542 u_int32_t sco_recv; /* number of SCO packets received */ 543 u_int32_t sco_sent; /* number of SCO packets sent */ 544 u_int32_t bytes_recv; /* total number of bytes received */ 545 u_int32_t bytes_sent; /* total number of bytes sent */ 546 } ng_hci_node_stat_ep; 547 548 #define NGM_HCI_NODE_RESET_STAT 108 /* User -> HCI */ 549 /* No parameters */ 550 551 #define NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE 109 /* User -> HCI */ 552 553 #define NGM_HCI_NODE_GET_NEIGHBOR_CACHE 110 /* HCI -> User */ 554 typedef struct { 555 u_int32_t num_entries; /* number of entries */ 556 } ng_hci_node_get_neighbor_cache_ep; 557 558 typedef struct { 559 u_int16_t page_scan_rep_mode; /* page rep scan mode */ 560 u_int16_t page_scan_mode; /* page scan mode */ 561 u_int16_t clock_offset; /* clock offset */ 562 bdaddr_t bdaddr; /* bdaddr */ 563 u_int8_t features[NG_HCI_FEATURES_SIZE]; /* features */ 564 } ng_hci_node_neighbor_cache_entry_ep; 565 566 #define NG_HCI_MAX_NEIGHBOR_NUM \ 567 ((0xffff - sizeof(ng_hci_node_get_neighbor_cache_ep))/sizeof(ng_hci_node_neighbor_cache_entry_ep)) 568 569 #define NGM_HCI_NODE_GET_CON_LIST 111 /* HCI -> User */ 570 typedef struct { 571 u_int32_t num_connections; /* number of connections */ 572 } ng_hci_node_con_list_ep; 573 574 typedef struct { 575 u_int8_t link_type; /* ACL or SCO */ 576 u_int8_t encryption_mode; /* none, p2p, ... */ 577 u_int8_t mode; /* ACTIVE, HOLD ... */ 578 u_int8_t role; /* MASTER/SLAVE */ 579 u_int16_t state; /* connection state */ 580 u_int16_t reserved; /* place holder */ 581 u_int16_t pending; /* number of pending packets */ 582 u_int16_t queue_len; /* number of packets in queue */ 583 u_int16_t con_handle; /* connection handle */ 584 bdaddr_t bdaddr; /* remote bdaddr */ 585 } ng_hci_node_con_ep; 586 587 #define NG_HCI_MAX_CON_NUM \ 588 ((0xffff - sizeof(ng_hci_node_con_list_ep))/sizeof(ng_hci_node_con_ep)) 589 590 #define NGM_HCI_NODE_UP 112 /* HCI -> Upper */ 591 typedef struct { 592 u_int16_t pkt_size; /* max. ACL/SCO packet size (w/out header) */ 593 u_int16_t num_pkts; /* ACL/SCO packet queue size */ 594 u_int16_t reserved; /* place holder */ 595 bdaddr_t bdaddr; /* bdaddr */ 596 } ng_hci_node_up_ep; 597 598 #define NGM_HCI_SYNC_CON_QUEUE 113 /* HCI -> Upper */ 599 typedef struct { 600 u_int16_t con_handle; /* connection handle */ 601 u_int16_t completed; /* number of completed packets */ 602 } ng_hci_sync_con_queue_ep; 603 604 #define NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK 114 /* HCI -> User */ 605 #define NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK 115 /* User -> HCI */ 606 typedef u_int16_t ng_hci_node_link_policy_mask_ep; 607 608 #define NGM_HCI_NODE_GET_PACKET_MASK 116 /* HCI -> User */ 609 #define NGM_HCI_NODE_SET_PACKET_MASK 117 /* User -> HCI */ 610 typedef u_int16_t ng_hci_node_packet_mask_ep; 611 612 #define NGM_HCI_NODE_GET_ROLE_SWITCH 118 /* HCI -> User */ 613 #define NGM_HCI_NODE_SET_ROLE_SWITCH 119 /* User -> HCI */ 614 typedef u_int16_t ng_hci_node_role_switch_ep; 615 616 #define NGM_HCI_NODE_LIST_NAMES 200 /* HCI -> User */ 617 618 /************************************************************************** 619 ************************************************************************** 620 ** Link control commands and return parameters 621 ************************************************************************** 622 **************************************************************************/ 623 624 #define NG_HCI_OGF_LINK_CONTROL 0x01 /* OpCode Group Field */ 625 626 #define NG_HCI_OCF_INQUIRY 0x0001 627 typedef struct { 628 u_int8_t lap[NG_HCI_LAP_SIZE]; /* LAP */ 629 u_int8_t inquiry_length; /* (N x 1.28) sec */ 630 u_int8_t num_responses; /* Max. # of responses before halted */ 631 } __attribute__ ((packed)) ng_hci_inquiry_cp; 632 /* No return parameter(s) */ 633 634 #define NG_HCI_OCF_INQUIRY_CANCEL 0x0002 635 /* No command parameter(s) */ 636 typedef ng_hci_status_rp ng_hci_inquiry_cancel_rp; 637 638 #define NG_HCI_OCF_PERIODIC_INQUIRY 0x0003 639 typedef struct { 640 u_int16_t max_period_length; /* Max. and min. amount of time */ 641 u_int16_t min_period_length; /* between consecutive inquiries */ 642 u_int8_t lap[NG_HCI_LAP_SIZE]; /* LAP */ 643 u_int8_t inquiry_length; /* (inquiry_length * 1.28) sec */ 644 u_int8_t num_responses; /* Max. # of responses */ 645 } __attribute__ ((packed)) ng_hci_periodic_inquiry_cp; 646 647 typedef ng_hci_status_rp ng_hci_periodic_inquiry_rp; 648 649 #define NG_HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004 650 /* No command parameter(s) */ 651 typedef ng_hci_status_rp ng_hci_exit_periodic_inquiry_rp; 652 653 #define NG_HCI_OCF_CREATE_CON 0x0005 654 typedef struct { 655 bdaddr_t bdaddr; /* destination address */ 656 u_int16_t pkt_type; /* packet type */ 657 u_int8_t page_scan_rep_mode; /* page scan repetition mode */ 658 u_int8_t page_scan_mode; /* page scan mode */ 659 u_int16_t clock_offset; /* clock offset */ 660 u_int8_t accept_role_switch; /* accept role switch? 0x00 - no */ 661 } __attribute__ ((packed)) ng_hci_create_con_cp; 662 /* No return parameter(s) */ 663 664 #define NG_HCI_OCF_DISCON 0x0006 665 typedef struct { 666 u_int16_t con_handle; /* connection handle */ 667 u_int8_t reason; /* reason to disconnect */ 668 } __attribute__ ((packed)) ng_hci_discon_cp; 669 /* No return parameter(s) */ 670 671 #define NG_HCI_OCF_ADD_SCO_CON 0x0007 672 typedef struct { 673 u_int16_t con_handle; /* connection handle */ 674 u_int16_t pkt_type; /* packet type */ 675 } __attribute__ ((packed)) ng_hci_add_sco_con_cp; 676 /* No return parameter(s) */ 677 678 #define NG_HCI_OCF_ACCEPT_CON 0x0009 679 typedef struct { 680 bdaddr_t bdaddr; /* address of unit to be connected */ 681 u_int8_t role; /* connection role */ 682 } __attribute__ ((packed)) ng_hci_accept_con_cp; 683 /* No return parameter(s) */ 684 685 #define NG_HCI_OCF_REJECT_CON 0x000a 686 typedef struct { 687 bdaddr_t bdaddr; /* remote address */ 688 u_int8_t reason; /* reason to reject */ 689 } __attribute__ ((packed)) ng_hci_reject_con_cp; 690 /* No return parameter(s) */ 691 692 #define NG_HCI_OCF_LINK_KEY_REP 0x000b 693 typedef struct { 694 bdaddr_t bdaddr; /* remote address */ 695 u_int8_t key[NG_HCI_KEY_SIZE]; /* key */ 696 } __attribute__ ((packed)) ng_hci_link_key_rep_cp; 697 698 typedef struct { 699 u_int8_t status; /* 0x00 - success */ 700 bdaddr_t bdaddr; /* unit address */ 701 } __attribute__ ((packed)) ng_hci_link_key_rep_rp; 702 703 #define NG_HCI_OCF_LINK_KEY_NEG_REP 0x000c 704 typedef struct { 705 bdaddr_t bdaddr; /* remote address */ 706 } __attribute__ ((packed)) ng_hci_link_key_neg_rep_cp; 707 708 typedef struct { 709 u_int8_t status; /* 0x00 - success */ 710 bdaddr_t bdaddr; /* unit address */ 711 } __attribute__ ((packed)) ng_hci_link_key_neg_rep_rp; 712 713 #define NG_HCI_OCF_PIN_CODE_REP 0x000d 714 typedef struct { 715 bdaddr_t bdaddr; /* remote address */ 716 u_int8_t pin_size; /* pin code length (in bytes) */ 717 u_int8_t pin[NG_HCI_PIN_SIZE]; /* pin code */ 718 } __attribute__ ((packed)) ng_hci_pin_code_rep_cp; 719 720 typedef struct { 721 u_int8_t status; /* 0x00 - success */ 722 bdaddr_t bdaddr; /* unit address */ 723 } __attribute__ ((packed)) ng_hci_pin_code_rep_rp; 724 725 #define NG_HCI_OCF_PIN_CODE_NEG_REP 0x000e 726 typedef struct { 727 bdaddr_t bdaddr; /* remote address */ 728 } __attribute__ ((packed)) ng_hci_pin_code_neg_rep_cp; 729 730 typedef struct { 731 u_int8_t status; /* 0x00 - success */ 732 bdaddr_t bdaddr; /* unit address */ 733 } __attribute__ ((packed)) ng_hci_pin_code_neg_rep_rp; 734 735 #define NG_HCI_OCF_CHANGE_CON_PKT_TYPE 0x000f 736 typedef struct { 737 u_int16_t con_handle; /* connection handle */ 738 u_int16_t pkt_type; /* packet type */ 739 } __attribute__ ((packed)) ng_hci_change_con_pkt_type_cp; 740 /* No return parameter(s) */ 741 742 #define NG_HCI_OCF_AUTH_REQ 0x0011 743 typedef struct { 744 u_int16_t con_handle; /* connection handle */ 745 } __attribute__ ((packed)) ng_hci_auth_req_cp; 746 /* No return parameter(s) */ 747 748 #define NG_HCI_OCF_SET_CON_ENCRYPTION 0x0013 749 typedef struct { 750 u_int16_t con_handle; /* connection handle */ 751 u_int8_t encryption_enable; /* 0x00 - disable, 0x01 - enable */ 752 } __attribute__ ((packed)) ng_hci_set_con_encryption_cp; 753 /* No return parameter(s) */ 754 755 #define NG_HCI_OCF_CHANGE_CON_LINK_KEY 0x0015 756 typedef struct { 757 u_int16_t con_handle; /* connection handle */ 758 } __attribute__ ((packed)) ng_hci_change_con_link_key_cp; 759 /* No return parameter(s) */ 760 761 #define NG_HCI_OCF_MASTER_LINK_KEY 0x0017 762 typedef struct { 763 u_int8_t key_flag; /* key flag */ 764 } __attribute__ ((packed)) ng_hci_master_link_key_cp; 765 /* No return parameter(s) */ 766 767 #define NG_HCI_OCF_REMOTE_NAME_REQ 0x0019 768 typedef struct { 769 bdaddr_t bdaddr; /* remote address */ 770 u_int8_t page_scan_rep_mode; /* page scan repetition mode */ 771 u_int8_t page_scan_mode; /* page scan mode */ 772 u_int16_t clock_offset; /* clock offset */ 773 } __attribute__ ((packed)) ng_hci_remote_name_req_cp; 774 /* No return parameter(s) */ 775 776 #define NG_HCI_OCF_READ_REMOTE_FEATURES 0x001b 777 typedef struct { 778 u_int16_t con_handle; /* connection handle */ 779 } __attribute__ ((packed)) ng_hci_read_remote_features_cp; 780 /* No return parameter(s) */ 781 782 #define NG_HCI_OCF_READ_REMOTE_VER_INFO 0x001d 783 typedef struct { 784 u_int16_t con_handle; /* connection handle */ 785 } __attribute__ ((packed)) ng_hci_read_remote_ver_info_cp; 786 /* No return parameter(s) */ 787 788 #define NG_HCI_OCF_READ_CLOCK_OFFSET 0x001f 789 typedef struct { 790 u_int16_t con_handle; /* connection handle */ 791 } __attribute__ ((packed)) ng_hci_read_clock_offset_cp; 792 /* No return parameter(s) */ 793 794 /************************************************************************** 795 ************************************************************************** 796 ** Link policy commands and return parameters 797 ************************************************************************** 798 **************************************************************************/ 799 800 #define NG_HCI_OGF_LINK_POLICY 0x02 /* OpCode Group Field */ 801 802 #define NG_HCI_OCF_HOLD_MODE 0x0001 803 typedef struct { 804 u_int16_t con_handle; /* connection handle */ 805 u_int16_t max_interval; /* (max_interval * 0.625) msec */ 806 u_int16_t min_interval; /* (max_interval * 0.625) msec */ 807 } __attribute__ ((packed)) ng_hci_hold_mode_cp; 808 /* No return parameter(s) */ 809 810 #define NG_HCI_OCF_SNIFF_MODE 0x0003 811 typedef struct { 812 u_int16_t con_handle; /* connection handle */ 813 u_int16_t max_interval; /* (max_interval * 0.625) msec */ 814 u_int16_t min_interval; /* (max_interval * 0.625) msec */ 815 u_int16_t attempt; /* (2 * attempt - 1) * 0.625 msec */ 816 u_int16_t timeout; /* (2 * attempt - 1) * 0.625 msec */ 817 } __attribute__ ((packed)) ng_hci_sniff_mode_cp; 818 /* No return parameter(s) */ 819 820 #define NG_HCI_OCF_EXIT_SNIFF_MODE 0x0004 821 typedef struct { 822 u_int16_t con_handle; /* connection handle */ 823 } __attribute__ ((packed)) ng_hci_exit_sniff_mode_cp; 824 /* No return parameter(s) */ 825 826 #define NG_HCI_OCF_PARK_MODE 0x0005 827 typedef struct { 828 u_int16_t con_handle; /* connection handle */ 829 u_int16_t max_interval; /* (max_interval * 0.625) msec */ 830 u_int16_t min_interval; /* (max_interval * 0.625) msec */ 831 } __attribute__ ((packed)) ng_hci_park_mode_cp; 832 /* No return parameter(s) */ 833 834 #define NG_HCI_OCF_EXIT_PARK_MODE 0x0006 835 typedef struct { 836 u_int16_t con_handle; /* connection handle */ 837 } __attribute__ ((packed)) ng_hci_exit_park_mode_cp; 838 /* No return parameter(s) */ 839 840 #define NG_HCI_OCF_QOS_SETUP 0x0007 841 typedef struct { 842 u_int16_t con_handle; /* connection handle */ 843 u_int8_t flags; /* reserved for future use */ 844 u_int8_t service_type; /* service type */ 845 u_int32_t token_rate; /* bytes per second */ 846 u_int32_t peak_bandwidth; /* bytes per second */ 847 u_int32_t latency; /* microseconds */ 848 u_int32_t delay_variation; /* microseconds */ 849 } __attribute__ ((packed)) ng_hci_qos_setup_cp; 850 /* No return parameter(s) */ 851 852 #define NG_HCI_OCF_ROLE_DISCOVERY 0x0009 853 typedef struct { 854 u_int16_t con_handle; /* connection handle */ 855 } __attribute__ ((packed)) ng_hci_role_discovery_cp; 856 857 typedef struct { 858 u_int8_t status; /* 0x00 - success */ 859 u_int16_t con_handle; /* connection handle */ 860 u_int8_t role; /* role for the connection handle */ 861 } __attribute__ ((packed)) ng_hci_role_discovery_rp; 862 863 #define NG_HCI_OCF_SWITCH_ROLE 0x000b 864 typedef struct { 865 bdaddr_t bdaddr; /* remote address */ 866 u_int8_t role; /* new local role */ 867 } __attribute__ ((packed)) ng_hci_switch_role_cp; 868 /* No return parameter(s) */ 869 870 #define NG_HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c 871 typedef struct { 872 u_int16_t con_handle; /* connection handle */ 873 } __attribute__ ((packed)) ng_hci_read_link_policy_settings_cp; 874 875 typedef struct { 876 u_int8_t status; /* 0x00 - success */ 877 u_int16_t con_handle; /* connection handle */ 878 u_int16_t settings; /* link policy settings */ 879 } __attribute__ ((packed)) ng_hci_read_link_policy_settings_rp; 880 881 #define NG_HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d 882 typedef struct { 883 u_int16_t con_handle; /* connection handle */ 884 u_int16_t settings; /* link policy settings */ 885 } __attribute__ ((packed)) ng_hci_write_link_policy_settings_cp; 886 887 typedef struct { 888 u_int8_t status; /* 0x00 - success */ 889 u_int16_t con_handle; /* connection handle */ 890 } __attribute__ ((packed)) ng_hci_write_link_policy_settings_rp; 891 892 /************************************************************************** 893 ************************************************************************** 894 ** Host controller and baseband commands and return parameters 895 ************************************************************************** 896 **************************************************************************/ 897 898 #define NG_HCI_OGF_HC_BASEBAND 0x03 /* OpCode Group Field */ 899 900 #define NG_HCI_OCF_SET_EVENT_MASK 0x0001 901 typedef struct { 902 u_int8_t event_mask[NG_HCI_EVENT_MASK_SIZE]; /* event_mask */ 903 } __attribute__ ((packed)) ng_hci_set_event_mask_cp; 904 905 typedef ng_hci_status_rp ng_hci_set_event_mask_rp; 906 #define NG_HCI_EVENT_MASK_DEFAULT 0x1fffffffffff 907 #define NG_HCI_EVENT_MASK_LE 0x2000000000000000 908 909 #define NG_HCI_OCF_RESET 0x0003 910 /* No command parameter(s) */ 911 typedef ng_hci_status_rp ng_hci_reset_rp; 912 913 #define NG_HCI_OCF_SET_EVENT_FILTER 0x0005 914 typedef struct { 915 u_int8_t filter_type; /* filter type */ 916 u_int8_t filter_condition_type; /* filter condition type */ 917 u_int8_t condition[0]; /* conditions - variable size */ 918 } __attribute__ ((packed)) ng_hci_set_event_filter_cp; 919 920 typedef ng_hci_status_rp ng_hci_set_event_filter_rp; 921 922 #define NG_HCI_OCF_FLUSH 0x0008 923 typedef struct { 924 u_int16_t con_handle; /* connection handle */ 925 } __attribute__ ((packed)) ng_hci_flush_cp; 926 927 typedef struct { 928 u_int8_t status; /* 0x00 - success */ 929 u_int16_t con_handle; /* connection handle */ 930 } __attribute__ ((packed)) ng_hci_flush_rp; 931 932 #define NG_HCI_OCF_READ_PIN_TYPE 0x0009 933 /* No command parameter(s) */ 934 typedef struct { 935 u_int8_t status; /* 0x00 - success */ 936 u_int8_t pin_type; /* PIN type */ 937 } __attribute__ ((packed)) ng_hci_read_pin_type_rp; 938 939 #define NG_HCI_OCF_WRITE_PIN_TYPE 0x000a 940 typedef struct { 941 u_int8_t pin_type; /* PIN type */ 942 } __attribute__ ((packed)) ng_hci_write_pin_type_cp; 943 944 typedef ng_hci_status_rp ng_hci_write_pin_type_rp; 945 946 #define NG_HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b 947 /* No command parameter(s) */ 948 typedef ng_hci_status_rp ng_hci_create_new_unit_key_rp; 949 950 #define NG_HCI_OCF_READ_STORED_LINK_KEY 0x000d 951 typedef struct { 952 bdaddr_t bdaddr; /* address */ 953 u_int8_t read_all; /* read all keys? 0x01 - yes */ 954 } __attribute__ ((packed)) ng_hci_read_stored_link_key_cp; 955 956 typedef struct { 957 u_int8_t status; /* 0x00 - success */ 958 u_int16_t max_num_keys; /* Max. number of keys */ 959 u_int16_t num_keys_read; /* Number of stored keys */ 960 } __attribute__ ((packed)) ng_hci_read_stored_link_key_rp; 961 962 #define NG_HCI_OCF_WRITE_STORED_LINK_KEY 0x0011 963 typedef struct { 964 u_int8_t num_keys_write; /* # of keys to write */ 965 /* these are repeated "num_keys_write" times 966 bdaddr_t bdaddr; --- remote address(es) 967 u_int8_t key[NG_HCI_KEY_SIZE]; --- key(s) */ 968 } __attribute__ ((packed)) ng_hci_write_stored_link_key_cp; 969 970 typedef struct { 971 u_int8_t status; /* 0x00 - success */ 972 u_int8_t num_keys_written; /* # of keys successfully written */ 973 } __attribute__ ((packed)) ng_hci_write_stored_link_key_rp; 974 975 #define NG_HCI_OCF_DELETE_STORED_LINK_KEY 0x0012 976 typedef struct { 977 bdaddr_t bdaddr; /* address */ 978 u_int8_t delete_all; /* delete all keys? 0x01 - yes */ 979 } __attribute__ ((packed)) ng_hci_delete_stored_link_key_cp; 980 981 typedef struct { 982 u_int8_t status; /* 0x00 - success */ 983 u_int16_t num_keys_deleted; /* Number of keys deleted */ 984 } __attribute__ ((packed)) ng_hci_delete_stored_link_key_rp; 985 986 #define NG_HCI_OCF_CHANGE_LOCAL_NAME 0x0013 987 typedef struct { 988 char name[NG_HCI_UNIT_NAME_SIZE]; /* new unit name */ 989 } __attribute__ ((packed)) ng_hci_change_local_name_cp; 990 991 typedef ng_hci_status_rp ng_hci_change_local_name_rp; 992 993 #define NG_HCI_OCF_READ_LOCAL_NAME 0x0014 994 /* No command parameter(s) */ 995 typedef struct { 996 u_int8_t status; /* 0x00 - success */ 997 char name[NG_HCI_UNIT_NAME_SIZE]; /* unit name */ 998 } __attribute__ ((packed)) ng_hci_read_local_name_rp; 999 1000 #define NG_HCI_OCF_READ_CON_ACCEPT_TIMO 0x0015 1001 /* No command parameter(s) */ 1002 typedef struct { 1003 u_int8_t status; /* 0x00 - success */ 1004 u_int16_t timeout; /* (timeout * 0.625) msec */ 1005 } __attribute__ ((packed)) ng_hci_read_con_accept_timo_rp; 1006 1007 #define NG_HCI_OCF_WRITE_CON_ACCEPT_TIMO 0x0016 1008 typedef struct { 1009 u_int16_t timeout; /* (timeout * 0.625) msec */ 1010 } __attribute__ ((packed)) ng_hci_write_con_accept_timo_cp; 1011 1012 typedef ng_hci_status_rp ng_hci_write_con_accept_timo_rp; 1013 1014 #define NG_HCI_OCF_READ_PAGE_TIMO 0x0017 1015 /* No command parameter(s) */ 1016 typedef struct { 1017 u_int8_t status; /* 0x00 - success */ 1018 u_int16_t timeout; /* (timeout * 0.625) msec */ 1019 } __attribute__ ((packed)) ng_hci_read_page_timo_rp; 1020 1021 #define NG_HCI_OCF_WRITE_PAGE_TIMO 0x0018 1022 typedef struct { 1023 u_int16_t timeout; /* (timeout * 0.625) msec */ 1024 } __attribute__ ((packed)) ng_hci_write_page_timo_cp; 1025 1026 typedef ng_hci_status_rp ng_hci_write_page_timo_rp; 1027 1028 #define NG_HCI_OCF_READ_SCAN_ENABLE 0x0019 1029 /* No command parameter(s) */ 1030 typedef struct { 1031 u_int8_t status; /* 0x00 - success */ 1032 u_int8_t scan_enable; /* Scan enable */ 1033 } __attribute__ ((packed)) ng_hci_read_scan_enable_rp; 1034 1035 #define NG_HCI_OCF_WRITE_SCAN_ENABLE 0x001a 1036 typedef struct { 1037 u_int8_t scan_enable; /* Scan enable */ 1038 } __attribute__ ((packed)) ng_hci_write_scan_enable_cp; 1039 1040 typedef ng_hci_status_rp ng_hci_write_scan_enable_rp; 1041 1042 #define NG_HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b 1043 /* No command parameter(s) */ 1044 typedef struct { 1045 u_int8_t status; /* 0x00 - success */ 1046 u_int16_t page_scan_interval; /* interval * 0.625 msec */ 1047 u_int16_t page_scan_window; /* window * 0.625 msec */ 1048 } __attribute__ ((packed)) ng_hci_read_page_scan_activity_rp; 1049 1050 #define NG_HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c 1051 typedef struct { 1052 u_int16_t page_scan_interval; /* interval * 0.625 msec */ 1053 u_int16_t page_scan_window; /* window * 0.625 msec */ 1054 } __attribute__ ((packed)) ng_hci_write_page_scan_activity_cp; 1055 1056 typedef ng_hci_status_rp ng_hci_write_page_scan_activity_rp; 1057 1058 #define NG_HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d 1059 /* No command parameter(s) */ 1060 typedef struct { 1061 u_int8_t status; /* 0x00 - success */ 1062 u_int16_t inquiry_scan_interval; /* interval * 0.625 msec */ 1063 u_int16_t inquiry_scan_window; /* window * 0.625 msec */ 1064 } __attribute__ ((packed)) ng_hci_read_inquiry_scan_activity_rp; 1065 1066 #define NG_HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e 1067 typedef struct { 1068 u_int16_t inquiry_scan_interval; /* interval * 0.625 msec */ 1069 u_int16_t inquiry_scan_window; /* window * 0.625 msec */ 1070 } __attribute__ ((packed)) ng_hci_write_inquiry_scan_activity_cp; 1071 1072 typedef ng_hci_status_rp ng_hci_write_inquiry_scan_activity_rp; 1073 1074 #define NG_HCI_OCF_READ_AUTH_ENABLE 0x001f 1075 /* No command parameter(s) */ 1076 typedef struct { 1077 u_int8_t status; /* 0x00 - success */ 1078 u_int8_t auth_enable; /* 0x01 - enabled */ 1079 } __attribute__ ((packed)) ng_hci_read_auth_enable_rp; 1080 1081 #define NG_HCI_OCF_WRITE_AUTH_ENABLE 0x0020 1082 typedef struct { 1083 u_int8_t auth_enable; /* 0x01 - enabled */ 1084 } __attribute__ ((packed)) ng_hci_write_auth_enable_cp; 1085 1086 typedef ng_hci_status_rp ng_hci_write_auth_enable_rp; 1087 1088 #define NG_HCI_OCF_READ_ENCRYPTION_MODE 0x0021 1089 /* No command parameter(s) */ 1090 typedef struct { 1091 u_int8_t status; /* 0x00 - success */ 1092 u_int8_t encryption_mode; /* encryption mode */ 1093 } __attribute__ ((packed)) ng_hci_read_encryption_mode_rp; 1094 1095 #define NG_HCI_OCF_WRITE_ENCRYPTION_MODE 0x0022 1096 typedef struct { 1097 u_int8_t encryption_mode; /* encryption mode */ 1098 } __attribute__ ((packed)) ng_hci_write_encryption_mode_cp; 1099 1100 typedef ng_hci_status_rp ng_hci_write_encryption_mode_rp; 1101 1102 #define NG_HCI_OCF_READ_UNIT_CLASS 0x0023 1103 /* No command parameter(s) */ 1104 typedef struct { 1105 u_int8_t status; /* 0x00 - success */ 1106 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */ 1107 } __attribute__ ((packed)) ng_hci_read_unit_class_rp; 1108 1109 #define NG_HCI_OCF_WRITE_UNIT_CLASS 0x0024 1110 typedef struct { 1111 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* unit class */ 1112 } __attribute__ ((packed)) ng_hci_write_unit_class_cp; 1113 1114 typedef ng_hci_status_rp ng_hci_write_unit_class_rp; 1115 1116 #define NG_HCI_OCF_READ_VOICE_SETTINGS 0x0025 1117 /* No command parameter(s) */ 1118 typedef struct { 1119 u_int8_t status; /* 0x00 - success */ 1120 u_int16_t settings; /* voice settings */ 1121 } __attribute__ ((packed)) ng_hci_read_voice_settings_rp; 1122 1123 #define NG_HCI_OCF_WRITE_VOICE_SETTINGS 0x0026 1124 typedef struct { 1125 u_int16_t settings; /* voice settings */ 1126 } __attribute__ ((packed)) ng_hci_write_voice_settings_cp; 1127 1128 typedef ng_hci_status_rp ng_hci_write_voice_settings_rp; 1129 1130 #define NG_HCI_OCF_READ_AUTO_FLUSH_TIMO 0x0027 1131 typedef struct { 1132 u_int16_t con_handle; /* connection handle */ 1133 } __attribute__ ((packed)) ng_hci_read_auto_flush_timo_cp; 1134 1135 typedef struct { 1136 u_int8_t status; /* 0x00 - success */ 1137 u_int16_t con_handle; /* connection handle */ 1138 u_int16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */ 1139 } __attribute__ ((packed)) ng_hci_read_auto_flush_timo_rp; 1140 1141 #define NG_HCI_OCF_WRITE_AUTO_FLUSH_TIMO 0x0028 1142 typedef struct { 1143 u_int16_t con_handle; /* connection handle */ 1144 u_int16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */ 1145 } __attribute__ ((packed)) ng_hci_write_auto_flush_timo_cp; 1146 1147 typedef struct { 1148 u_int8_t status; /* 0x00 - success */ 1149 u_int16_t con_handle; /* connection handle */ 1150 } __attribute__ ((packed)) ng_hci_write_auto_flush_timo_rp; 1151 1152 #define NG_HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x0029 1153 /* No command parameter(s) */ 1154 typedef struct { 1155 u_int8_t status; /* 0x00 - success */ 1156 u_int8_t counter; /* number of broadcast retransmissions */ 1157 } __attribute__ ((packed)) ng_hci_read_num_broadcast_retrans_rp; 1158 1159 #define NG_HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a 1160 typedef struct { 1161 u_int8_t counter; /* number of broadcast retransmissions */ 1162 } __attribute__ ((packed)) ng_hci_write_num_broadcast_retrans_cp; 1163 1164 typedef ng_hci_status_rp ng_hci_write_num_broadcast_retrans_rp; 1165 1166 #define NG_HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b 1167 /* No command parameter(s) */ 1168 typedef struct { 1169 u_int8_t status; /* 0x00 - success */ 1170 u_int8_t hold_mode_activity; /* Hold mode activities */ 1171 } __attribute__ ((packed)) ng_hci_read_hold_mode_activity_rp; 1172 1173 #define NG_HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c 1174 typedef struct { 1175 u_int8_t hold_mode_activity; /* Hold mode activities */ 1176 } __attribute__ ((packed)) ng_hci_write_hold_mode_activity_cp; 1177 1178 typedef ng_hci_status_rp ng_hci_write_hold_mode_activity_rp; 1179 1180 #define NG_HCI_OCF_READ_XMIT_LEVEL 0x002d 1181 typedef struct { 1182 u_int16_t con_handle; /* connection handle */ 1183 u_int8_t type; /* Xmit level type */ 1184 } __attribute__ ((packed)) ng_hci_read_xmit_level_cp; 1185 1186 typedef struct { 1187 u_int8_t status; /* 0x00 - success */ 1188 u_int16_t con_handle; /* connection handle */ 1189 char level; /* -30 <= level <= 30 dBm */ 1190 } __attribute__ ((packed)) ng_hci_read_xmit_level_rp; 1191 1192 #define NG_HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e 1193 /* No command parameter(s) */ 1194 typedef struct { 1195 u_int8_t status; /* 0x00 - success */ 1196 u_int8_t flow_control; /* 0x00 - disabled */ 1197 } __attribute__ ((packed)) ng_hci_read_sco_flow_control_rp; 1198 1199 #define NG_HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f 1200 typedef struct { 1201 u_int8_t flow_control; /* 0x00 - disabled */ 1202 } __attribute__ ((packed)) ng_hci_write_sco_flow_control_cp; 1203 1204 typedef ng_hci_status_rp ng_hci_write_sco_flow_control_rp; 1205 1206 #define NG_HCI_OCF_H2HC_FLOW_CONTROL 0x0031 1207 typedef struct { 1208 u_int8_t h2hc_flow; /* Host to Host controller flow control */ 1209 } __attribute__ ((packed)) ng_hci_h2hc_flow_control_cp; 1210 1211 typedef ng_hci_status_rp ng_hci_h2hc_flow_control_rp; 1212 1213 #define NG_HCI_OCF_HOST_BUFFER_SIZE 0x0033 1214 typedef struct { 1215 u_int16_t max_acl_size; /* Max. size of ACL packet (bytes) */ 1216 u_int8_t max_sco_size; /* Max. size of SCO packet (bytes) */ 1217 u_int16_t num_acl_pkt; /* Max. number of ACL packets */ 1218 u_int16_t num_sco_pkt; /* Max. number of SCO packets */ 1219 } __attribute__ ((packed)) ng_hci_host_buffer_size_cp; 1220 1221 typedef ng_hci_status_rp ng_hci_host_buffer_size_rp; 1222 1223 #define NG_HCI_OCF_HOST_NUM_COMPL_PKTS 0x0035 1224 typedef struct { 1225 u_int8_t num_con_handles; /* # of connection handles */ 1226 /* these are repeated "num_con_handles" times 1227 u_int16_t con_handle; --- connection handle(s) 1228 u_int16_t compl_pkt; --- # of completed packets */ 1229 } __attribute__ ((packed)) ng_hci_host_num_compl_pkts_cp; 1230 /* No return parameter(s) */ 1231 1232 #define NG_HCI_OCF_READ_LINK_SUPERVISION_TIMO 0x0036 1233 typedef struct { 1234 u_int16_t con_handle; /* connection handle */ 1235 } __attribute__ ((packed)) ng_hci_read_link_supervision_timo_cp; 1236 1237 typedef struct { 1238 u_int8_t status; /* 0x00 - success */ 1239 u_int16_t con_handle; /* connection handle */ 1240 u_int16_t timeout; /* Link supervision timeout * 0.625 msec */ 1241 } __attribute__ ((packed)) ng_hci_read_link_supervision_timo_rp; 1242 1243 #define NG_HCI_OCF_WRITE_LINK_SUPERVISION_TIMO 0x0037 1244 typedef struct { 1245 u_int16_t con_handle; /* connection handle */ 1246 u_int16_t timeout; /* Link supervision timeout * 0.625 msec */ 1247 } __attribute__ ((packed)) ng_hci_write_link_supervision_timo_cp; 1248 1249 typedef struct { 1250 u_int8_t status; /* 0x00 - success */ 1251 u_int16_t con_handle; /* connection handle */ 1252 } __attribute__ ((packed)) ng_hci_write_link_supervision_timo_rp; 1253 1254 #define NG_HCI_OCF_READ_SUPPORTED_IAC_NUM 0x0038 1255 /* No command parameter(s) */ 1256 typedef struct { 1257 u_int8_t status; /* 0x00 - success */ 1258 u_int8_t num_iac; /* # of supported IAC during scan */ 1259 } __attribute__ ((packed)) ng_hci_read_supported_iac_num_rp; 1260 1261 #define NG_HCI_OCF_READ_IAC_LAP 0x0039 1262 /* No command parameter(s) */ 1263 typedef struct { 1264 u_int8_t status; /* 0x00 - success */ 1265 u_int8_t num_iac; /* # of IAC */ 1266 /* these are repeated "num_iac" times 1267 u_int8_t laps[NG_HCI_LAP_SIZE]; --- LAPs */ 1268 } __attribute__ ((packed)) ng_hci_read_iac_lap_rp; 1269 1270 #define NG_HCI_OCF_WRITE_IAC_LAP 0x003a 1271 typedef struct { 1272 u_int8_t num_iac; /* # of IAC */ 1273 /* these are repeated "num_iac" times 1274 u_int8_t laps[NG_HCI_LAP_SIZE]; --- LAPs */ 1275 } __attribute__ ((packed)) ng_hci_write_iac_lap_cp; 1276 1277 typedef ng_hci_status_rp ng_hci_write_iac_lap_rp; 1278 1279 /*0x003b-0x003e commands are depricated v2.0 or later*/ 1280 #define NG_HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b 1281 /* No command parameter(s) */ 1282 typedef struct { 1283 u_int8_t status; /* 0x00 - success */ 1284 u_int8_t page_scan_period_mode; /* Page scan period mode */ 1285 } __attribute__ ((packed)) ng_hci_read_page_scan_period_rp; 1286 1287 #define NG_HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c 1288 typedef struct { 1289 u_int8_t page_scan_period_mode; /* Page scan period mode */ 1290 } __attribute__ ((packed)) ng_hci_write_page_scan_period_cp; 1291 1292 typedef ng_hci_status_rp ng_hci_write_page_scan_period_rp; 1293 1294 #define NG_HCI_OCF_READ_PAGE_SCAN 0x003d 1295 /* No command parameter(s) */ 1296 typedef struct { 1297 u_int8_t status; /* 0x00 - success */ 1298 u_int8_t page_scan_mode; /* Page scan mode */ 1299 } __attribute__ ((packed)) ng_hci_read_page_scan_rp; 1300 1301 #define NG_HCI_OCF_WRITE_PAGE_SCAN 0x003e 1302 typedef struct { 1303 u_int8_t page_scan_mode; /* Page scan mode */ 1304 } __attribute__ ((packed)) ng_hci_write_page_scan_cp; 1305 1306 typedef ng_hci_status_rp ng_hci_write_page_scan_rp; 1307 1308 #define NG_HCI_OCF_READ_LE_HOST_SUPPORTED 0x6c 1309 typedef struct { 1310 u_int8_t status; /* 0x00 - success */ 1311 u_int8_t le_supported_host ;/* LE host supported?*/ 1312 u_int8_t simultaneous_le_host; /* BR/LE simulateneous? */ 1313 } __attribute__ ((packed)) ng_hci_read_le_host_supported_rp; 1314 1315 #define NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED 0x6d 1316 typedef struct { 1317 u_int8_t le_supported_host; /* LE host supported?*/ 1318 u_int8_t simultaneous_le_host; /* LE host supported?*/ 1319 } __attribute__ ((packed)) ng_hci_write_le_host_supported_cp; 1320 1321 typedef ng_hci_status_rp ng_hci_write_le_host_supported_rp; 1322 1323 /************************************************************************** 1324 ************************************************************************** 1325 ** Informational commands and return parameters 1326 ** All commands in this category do not accept any parameters 1327 ************************************************************************** 1328 **************************************************************************/ 1329 1330 #define NG_HCI_OGF_INFO 0x04 /* OpCode Group Field */ 1331 1332 #define NG_HCI_OCF_READ_LOCAL_VER 0x0001 1333 typedef struct { 1334 u_int8_t status; /* 0x00 - success */ 1335 u_int8_t hci_version; /* HCI version */ 1336 u_int16_t hci_revision; /* HCI revision */ 1337 u_int8_t lmp_version; /* LMP version */ 1338 u_int16_t manufacturer; /* Hardware manufacturer name */ 1339 u_int16_t lmp_subversion; /* LMP sub-version */ 1340 } __attribute__ ((packed)) ng_hci_read_local_ver_rp; 1341 1342 #define NG_HCI_OCF_READ_LOCAL_COMMANDS 0x0002 1343 typedef struct { 1344 u_int8_t status; /* 0x00 - success */ 1345 u_int8_t features[NG_HCI_COMMANDS_SIZE]; /* command bitmsk*/ 1346 } __attribute__ ((packed)) ng_hci_read_local_commands_rp; 1347 1348 #define NG_HCI_OCF_READ_LOCAL_FEATURES 0x0003 1349 typedef struct { 1350 u_int8_t status; /* 0x00 - success */ 1351 u_int8_t features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ 1352 } __attribute__ ((packed)) ng_hci_read_local_features_rp; 1353 1354 #define NG_HCI_OCF_READ_BUFFER_SIZE 0x0005 1355 typedef struct { 1356 u_int8_t status; /* 0x00 - success */ 1357 u_int16_t max_acl_size; /* Max. size of ACL packet (bytes) */ 1358 u_int8_t max_sco_size; /* Max. size of SCO packet (bytes) */ 1359 u_int16_t num_acl_pkt; /* Max. number of ACL packets */ 1360 u_int16_t num_sco_pkt; /* Max. number of SCO packets */ 1361 } __attribute__ ((packed)) ng_hci_read_buffer_size_rp; 1362 1363 #define NG_HCI_OCF_READ_COUNTRY_CODE 0x0007 1364 typedef struct { 1365 u_int8_t status; /* 0x00 - success */ 1366 u_int8_t country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */ 1367 } __attribute__ ((packed)) ng_hci_read_country_code_rp; 1368 1369 #define NG_HCI_OCF_READ_BDADDR 0x0009 1370 typedef struct { 1371 u_int8_t status; /* 0x00 - success */ 1372 bdaddr_t bdaddr; /* unit address */ 1373 } __attribute__ ((packed)) ng_hci_read_bdaddr_rp; 1374 1375 /************************************************************************** 1376 ************************************************************************** 1377 ** Status commands and return parameters 1378 ************************************************************************** 1379 **************************************************************************/ 1380 1381 #define NG_HCI_OGF_STATUS 0x05 /* OpCode Group Field */ 1382 1383 #define NG_HCI_OCF_READ_FAILED_CONTACT_CNTR 0x0001 1384 typedef struct { 1385 u_int16_t con_handle; /* connection handle */ 1386 } __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_cp; 1387 1388 typedef struct { 1389 u_int8_t status; /* 0x00 - success */ 1390 u_int16_t con_handle; /* connection handle */ 1391 u_int16_t counter; /* number of consecutive failed contacts */ 1392 } __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_rp; 1393 1394 #define NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x0002 1395 typedef struct { 1396 u_int16_t con_handle; /* connection handle */ 1397 } __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_cp; 1398 1399 typedef struct { 1400 u_int8_t status; /* 0x00 - success */ 1401 u_int16_t con_handle; /* connection handle */ 1402 } __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_rp; 1403 1404 #define NG_HCI_OCF_GET_LINK_QUALITY 0x0003 1405 typedef struct { 1406 u_int16_t con_handle; /* connection handle */ 1407 } __attribute__ ((packed)) ng_hci_get_link_quality_cp; 1408 1409 typedef struct { 1410 u_int8_t status; /* 0x00 - success */ 1411 u_int16_t con_handle; /* connection handle */ 1412 u_int8_t quality; /* higher value means better quality */ 1413 } __attribute__ ((packed)) ng_hci_get_link_quality_rp; 1414 1415 #define NG_HCI_OCF_READ_RSSI 0x0005 1416 typedef struct { 1417 u_int16_t con_handle; /* connection handle */ 1418 } __attribute__ ((packed)) ng_hci_read_rssi_cp; 1419 1420 typedef struct { 1421 u_int8_t status; /* 0x00 - success */ 1422 u_int16_t con_handle; /* connection handle */ 1423 char rssi; /* -127 <= rssi <= 127 dB */ 1424 } __attribute__ ((packed)) ng_hci_read_rssi_rp; 1425 1426 /************************************************************************** 1427 ************************************************************************** 1428 ** Testing commands and return parameters 1429 ************************************************************************** 1430 **************************************************************************/ 1431 1432 #define NG_HCI_OGF_TESTING 0x06 /* OpCode Group Field */ 1433 1434 #define NG_HCI_OCF_READ_LOOPBACK_MODE 0x0001 1435 /* No command parameter(s) */ 1436 typedef struct { 1437 u_int8_t status; /* 0x00 - success */ 1438 u_int8_t lbmode; /* loopback mode */ 1439 } __attribute__ ((packed)) ng_hci_read_loopback_mode_rp; 1440 1441 #define NG_HCI_OCF_WRITE_LOOPBACK_MODE 0x0002 1442 typedef struct { 1443 u_int8_t lbmode; /* loopback mode */ 1444 } __attribute__ ((packed)) ng_hci_write_loopback_mode_cp; 1445 1446 typedef ng_hci_status_rp ng_hci_write_loopback_mode_rp; 1447 1448 #define NG_HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x0003 1449 /* No command parameter(s) */ 1450 typedef ng_hci_status_rp ng_hci_enable_unit_under_test_rp; 1451 1452 /************************************************************************** 1453 ************************************************************************** 1454 ** LE OpCode group field 1455 ************************************************************************** 1456 **************************************************************************/ 1457 1458 #define NG_HCI_OGF_LE 0x08 /* OpCode Group Field */ 1459 #define NG_HCI_OCF_LE_SET_EVENT_MASK 0x0001 1460 typedef struct { 1461 u_int8_t event_mask[NG_HCI_LE_EVENT_MASK_SIZE]; /* event_mask*/ 1462 1463 } __attribute__ ((packed)) ng_hci_le_set_event_mask_cp; 1464 typedef ng_hci_status_rp ng_hci_le_set_event_mask_rp; 1465 #define NG_HCI_LE_EVENT_MASK_ALL 0x1f 1466 1467 #define NG_HCI_OCF_LE_READ_BUFFER_SIZE 0x0002 1468 /*No command parameter */ 1469 typedef struct { 1470 u_int8_t status; /*status*/ 1471 u_int16_t hc_le_data_packet_length; 1472 u_int8_t hc_total_num_le_data_packets; 1473 } __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp; 1474 1475 1476 #define NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003 1477 /*No command parameter */ 1478 typedef struct { 1479 u_int8_t status; /*status*/ 1480 u_int64_t le_features; 1481 } __attribute__ ((packed)) ng_hci_le_read_local_supported_features_rp; 1482 1483 #define NG_HCI_OCF_LE_SET_RANDOM_ADDRESS 0x0005 1484 typedef struct { 1485 bdaddr_t random_address; 1486 } __attribute__ ((packed)) ng_hci_le_set_random_address_cp_; 1487 typedef ng_hci_status_rp ng_hci_le_set_random_address_rp; 1488 1489 #define NG_HCI_OCF_LE_SET_ADVERTISING_PARAMETERS 0x0006 1490 typedef struct { 1491 u_int16_t advertising_interval_min; 1492 u_int16_t advertising_interval_max; 1493 u_int8_t advertising_type; 1494 u_int8_t own_address_type; 1495 u_int8_t direct_address_type; 1496 bdaddr_t direct_address; 1497 u_int8_t advertising_channel_map; 1498 u_int8_t advertising_filter_policy; 1499 } __attribute__ ((packed)) ng_hci_le_set_advertising_parameters_cp; 1500 typedef ng_hci_status_rp ng_hci_le_set_advertising_parameters_rp; 1501 1502 #define NG_HCI_OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x0007 1503 /*No command parameter*/ 1504 typedef struct { 1505 u_int8_t status; 1506 u_int8_t transmit_power_level; 1507 } __attribute__ ((packed)) ng_hci_le_read_advertising_channel_tx_power_rp; 1508 1509 #define NG_HCI_OCF_LE_SET_ADVERTISING_DATA 0x0008 1510 #define NG_HCI_ADVERTISING_DATA_SIZE 31 1511 typedef struct { 1512 u_int8_t advertising_data_length; 1513 char advertising_data[NG_HCI_ADVERTISING_DATA_SIZE]; 1514 } __attribute__ ((packed)) ng_hci_le_set_advertising_data_cp; 1515 typedef ng_hci_status_rp ng_hci_le_set_advertising_data_rp; 1516 1517 #define NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009 1518 1519 typedef struct { 1520 u_int8_t scan_response_data_length; 1521 char scan_response_data[NG_HCI_ADVERTISING_DATA_SIZE]; 1522 } __attribute__ ((packed)) ng_hci_le_set_scan_response_data_cp; 1523 typedef ng_hci_status_rp ng_hci_le_set_scan_response_data_rp; 1524 1525 #define NG_HCI_OCF_LE_SET_ADVERTISE_ENABLE 0x000a 1526 typedef struct { 1527 u_int8_t advertising_enable; 1528 }__attribute__ ((packed)) ng_hci_le_set_advertise_enable_cp; 1529 typedef ng_hci_status_rp ng_hci_le_set_advertise_enable_rp; 1530 1531 #define NG_HCI_OCF_LE_SET_SCAN_PARAMETERS 0x000b 1532 typedef struct { 1533 u_int8_t le_scan_type; 1534 u_int16_t le_scan_interval; 1535 u_int16_t le_scan_window; 1536 u_int8_t own_address_type; 1537 u_int8_t scanning_filter_policy; 1538 }__attribute__ ((packed)) ng_hci_le_set_scan_parameters_cp; 1539 typedef ng_hci_status_rp ng_hci_le_set_scan_parameters_rp; 1540 1541 #define NG_HCI_OCF_LE_SET_SCAN_ENABLE 0x000c 1542 typedef struct { 1543 u_int8_t le_scan_enable; 1544 u_int8_t filter_duplicates; 1545 }__attribute__ ((packed)) ng_hci_le_set_scan_enable_cp; 1546 typedef ng_hci_status_rp ng_hci_le_set_scan_enable_rp; 1547 1548 #define NG_HCI_OCF_LE_CREATE_CONNECTION 0x000d 1549 typedef struct { 1550 u_int16_t scan_interval; 1551 u_int16_t scan_window; 1552 u_int8_t filter_policy; 1553 u_int8_t peer_addr_type; 1554 bdaddr_t peer_addr; 1555 u_int8_t own_address_type; 1556 u_int16_t conn_interval_min; 1557 u_int16_t conn_interval_max; 1558 u_int16_t conn_latency; 1559 u_int16_t supervision_timeout; 1560 u_int16_t min_ce_length; 1561 u_int16_t max_ce_length; 1562 }__attribute__((packed)) ng_hci_le_create_connection_cp; 1563 /* No return parameters. */ 1564 #define NG_HCI_OCF_LE_CREATE_CONNECTION_CANCEL 0x000e 1565 /*No command parameter*/ 1566 typedef ng_hci_status_rp ng_hci_le_create_connection_cancel_rp; 1567 #define NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE 0x000f 1568 /*No command parameter*/ 1569 typedef struct { 1570 u_int8_t status; 1571 u_int8_t white_list_size; 1572 } __attribute__ ((packed)) ng_hci_le_read_white_list_size_rp; 1573 1574 #define NG_HCI_OCF_LE_CLEAR_WHITE_LIST 0x0010 1575 /* No command parameters. */ 1576 typedef ng_hci_status_rp ng_hci_le_clear_white_list_rp; 1577 #define NG_HCI_OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011 1578 typedef struct { 1579 u_int8_t address_type; 1580 bdaddr_t address; 1581 } __attribute__ ((packed)) ng_hci_le_add_device_to_white_list_cp; 1582 typedef ng_hci_status_rp ng_hci_le_add_device_to_white_list_rp; 1583 1584 #define NG_HCI_OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012 1585 typedef struct { 1586 u_int8_t address_type; 1587 bdaddr_t address; 1588 } __attribute__ ((packed)) ng_hci_le_remove_device_from_white_list_cp; 1589 typedef ng_hci_status_rp ng_hci_le_remove_device_from_white_list_rp; 1590 1591 #define NG_HCI_OCF_LE_CONNECTION_UPDATE 0x0013 1592 typedef struct { 1593 u_int16_t connection_handle; 1594 u_int16_t conn_interval_min; 1595 u_int16_t conn_interval_max; 1596 u_int16_t conn_latency; 1597 u_int16_t supervision_timeout; 1598 u_int16_t minimum_ce_length; 1599 u_int16_t maximum_ce_length; 1600 }__attribute__ ((packed)) ng_hci_le_connection_update_cp; 1601 /*no return parameter*/ 1602 1603 #define NG_HCI_OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014 1604 typedef struct{ 1605 u_int8_t le_channel_map[5]; 1606 }__attribute__ ((packed)) ng_hci_le_set_host_channel_classification_cp; 1607 typedef ng_hci_status_rp ng_hci_le_set_host_channel_classification_rp; 1608 1609 #define NG_HCI_OCF_LE_READ_CHANNEL_MAP 0x0015 1610 typedef struct { 1611 u_int16_t connection_handle; 1612 }__attribute__ ((packed)) ng_hci_le_read_channel_map_cp; 1613 typedef struct { 1614 u_int8_t status; 1615 u_int16_t connection_handle; 1616 u_int8_t le_channel_map[5]; 1617 } __attribute__ ((packed)) ng_hci_le_read_channel_map_rp; 1618 1619 #define NG_HCI_OCF_LE_READ_REMOTE_USED_FEATURES 0x0016 1620 typedef struct { 1621 u_int16_t connection_handle; 1622 }__attribute__ ((packed)) ng_hci_le_read_remote_used_features_cp; 1623 /*No return parameter*/ 1624 #define NG_HCI_128BIT 16 1625 #define NG_HCI_OCF_LE_ENCRYPT 0x0017 1626 typedef struct { 1627 u_int8_t key[NG_HCI_128BIT]; 1628 u_int8_t plaintext_data[NG_HCI_128BIT]; 1629 }__attribute__ ((packed)) ng_hci_le_encrypt_cp; 1630 typedef struct { 1631 u_int8_t status; 1632 u_int8_t plaintext_data[NG_HCI_128BIT]; 1633 }__attribute__ ((packed)) ng_hci_le_encrypt_rp; 1634 1635 #define NG_HCI_OCF_LE_RAND 0x0018 1636 /*No command parameter*/ 1637 typedef struct { 1638 u_int8_t status; 1639 u_int64_t random_number; 1640 }__attribute__ ((packed)) ng_hci_le_rand_rp; 1641 1642 #define NG_HCI_OCF_LE_START_ENCRYPTION 0x0019 1643 typedef struct { 1644 u_int16_t connection_handle; 1645 u_int64_t random_number; 1646 u_int16_t encrypted_diversifier; 1647 u_int8_t long_term_key[NG_HCI_128BIT]; 1648 }__attribute__ ((packed)) ng_hci_le_start_encryption_cp; 1649 /*No return parameter*/ 1650 #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY 0x001a 1651 typedef struct { 1652 u_int16_t connection_handle; 1653 u_int8_t long_term_key[NG_HCI_128BIT]; 1654 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_cp; 1655 typedef struct { 1656 u_int8_t status; 1657 u_int16_t connection_handle; 1658 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_reply_rp; 1659 1660 #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY 0x001b 1661 typedef struct{ 1662 u_int16_t connection_handle; 1663 }ng_hci_le_long_term_key_request_negative_reply_cp; 1664 typedef struct { 1665 u_int8_t status; 1666 u_int16_t connection_handle; 1667 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp; 1668 1669 1670 #define NG_HCI_OCF_LE_READ_SUPPORTED_STATUS 0x001c 1671 /*No command parameter*/ 1672 typedef struct { 1673 u_int8_t status; 1674 u_int64_t le_status; 1675 }__attribute__ ((packed)) ng_hci_le_read_supported_status_rp; 1676 1677 #define NG_HCI_OCF_LE_RECEIVER_TEST 0x001d 1678 typedef struct{ 1679 u_int8_t rx_frequency; 1680 } __attribute__((packed)) ng_le_receiver_test_cp; 1681 typedef ng_hci_status_rp ng_hci_le_receiver_test_rp; 1682 1683 #define NG_HCI_OCF_LE_TRANSMITTER_TEST 0x001e 1684 typedef struct{ 1685 u_int8_t tx_frequency; 1686 u_int8_t length_of_test_data; 1687 u_int8_t packet_payload; 1688 } __attribute__((packed)) ng_le_transmitter_test_cp; 1689 typedef ng_hci_status_rp ng_hci_le_transmitter_test_rp; 1690 1691 #define NG_HCI_OCF_LE_TEST_END 0x001f 1692 /* No command parameter. */ 1693 typedef struct { 1694 u_int8_t status; 1695 u_int16_t number_of_packets; 1696 }__attribute__ ((packed)) ng_hci_le_test_end_rp; 1697 1698 /************************************************************************** 1699 ************************************************************************** 1700 ** Special HCI OpCode group field values 1701 ************************************************************************** 1702 **************************************************************************/ 1703 1704 #define NG_HCI_OGF_BT_LOGO 0x3e 1705 1706 #define NG_HCI_OGF_VENDOR 0x3f 1707 1708 /************************************************************************** 1709 ************************************************************************** 1710 ** Events and event parameters 1711 ************************************************************************** 1712 **************************************************************************/ 1713 1714 #define NG_HCI_EVENT_INQUIRY_COMPL 0x01 1715 typedef struct { 1716 u_int8_t status; /* 0x00 - success */ 1717 } __attribute__ ((packed)) ng_hci_inquiry_compl_ep; 1718 1719 #define NG_HCI_EVENT_INQUIRY_RESULT 0x02 1720 typedef struct { 1721 u_int8_t num_responses; /* number of responses */ 1722 /* ng_hci_inquiry_response[num_responses] -- see below */ 1723 } __attribute__ ((packed)) ng_hci_inquiry_result_ep; 1724 1725 typedef struct { 1726 bdaddr_t bdaddr; /* unit address */ 1727 u_int8_t page_scan_rep_mode; /* page scan rep. mode */ 1728 u_int8_t page_scan_period_mode; /* page scan period mode */ 1729 u_int8_t page_scan_mode; /* page scan mode */ 1730 u_int8_t uclass[NG_HCI_CLASS_SIZE];/* unit class */ 1731 u_int16_t clock_offset; /* clock offset */ 1732 } __attribute__ ((packed)) ng_hci_inquiry_response; 1733 1734 #define NG_HCI_EVENT_CON_COMPL 0x03 1735 typedef struct { 1736 u_int8_t status; /* 0x00 - success */ 1737 u_int16_t con_handle; /* Connection handle */ 1738 bdaddr_t bdaddr; /* remote unit address */ 1739 u_int8_t link_type; /* Link type */ 1740 u_int8_t encryption_mode; /* Encryption mode */ 1741 } __attribute__ ((packed)) ng_hci_con_compl_ep; 1742 1743 #define NG_HCI_EVENT_CON_REQ 0x04 1744 typedef struct { 1745 bdaddr_t bdaddr; /* remote unit address */ 1746 u_int8_t uclass[NG_HCI_CLASS_SIZE]; /* remote unit class */ 1747 u_int8_t link_type; /* link type */ 1748 } __attribute__ ((packed)) ng_hci_con_req_ep; 1749 1750 #define NG_HCI_EVENT_DISCON_COMPL 0x05 1751 typedef struct { 1752 u_int8_t status; /* 0x00 - success */ 1753 u_int16_t con_handle; /* connection handle */ 1754 u_int8_t reason; /* reason to disconnect */ 1755 } __attribute__ ((packed)) ng_hci_discon_compl_ep; 1756 1757 #define NG_HCI_EVENT_AUTH_COMPL 0x06 1758 typedef struct { 1759 u_int8_t status; /* 0x00 - success */ 1760 u_int16_t con_handle; /* connection handle */ 1761 } __attribute__ ((packed)) ng_hci_auth_compl_ep; 1762 1763 #define NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x7 1764 typedef struct { 1765 u_int8_t status; /* 0x00 - success */ 1766 bdaddr_t bdaddr; /* remote unit address */ 1767 char name[NG_HCI_UNIT_NAME_SIZE]; /* remote unit name */ 1768 } __attribute__ ((packed)) ng_hci_remote_name_req_compl_ep; 1769 1770 #define NG_HCI_EVENT_ENCRYPTION_CHANGE 0x08 1771 typedef struct { 1772 u_int8_t status; /* 0x00 - success */ 1773 u_int16_t con_handle; /* Connection handle */ 1774 u_int8_t encryption_enable; /* 0x00 - disable */ 1775 } __attribute__ ((packed)) ng_hci_encryption_change_ep; 1776 1777 #define NG_HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x09 1778 typedef struct { 1779 u_int8_t status; /* 0x00 - success */ 1780 u_int16_t con_handle; /* Connection handle */ 1781 } __attribute__ ((packed)) ng_hci_change_con_link_key_compl_ep; 1782 1783 #define NG_HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a 1784 typedef struct { 1785 u_int8_t status; /* 0x00 - success */ 1786 u_int16_t con_handle; /* Connection handle */ 1787 u_int8_t key_flag; /* Key flag */ 1788 } __attribute__ ((packed)) ng_hci_master_link_key_compl_ep; 1789 1790 #define NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b 1791 typedef struct { 1792 u_int8_t status; /* 0x00 - success */ 1793 u_int16_t con_handle; /* Connection handle */ 1794 u_int8_t features[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ 1795 } __attribute__ ((packed)) ng_hci_read_remote_features_compl_ep; 1796 1797 #define NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c 1798 typedef struct { 1799 u_int8_t status; /* 0x00 - success */ 1800 u_int16_t con_handle; /* Connection handle */ 1801 u_int8_t lmp_version; /* LMP version */ 1802 u_int16_t manufacturer; /* Hardware manufacturer name */ 1803 u_int16_t lmp_subversion; /* LMP sub-version */ 1804 } __attribute__ ((packed)) ng_hci_read_remote_ver_info_compl_ep; 1805 1806 #define NG_HCI_EVENT_QOS_SETUP_COMPL 0x0d 1807 typedef struct { 1808 u_int8_t status; /* 0x00 - success */ 1809 u_int16_t con_handle; /* connection handle */ 1810 u_int8_t flags; /* reserved for future use */ 1811 u_int8_t service_type; /* service type */ 1812 u_int32_t token_rate; /* bytes per second */ 1813 u_int32_t peak_bandwidth; /* bytes per second */ 1814 u_int32_t latency; /* microseconds */ 1815 u_int32_t delay_variation; /* microseconds */ 1816 } __attribute__ ((packed)) ng_hci_qos_setup_compl_ep; 1817 1818 #define NG_HCI_EVENT_COMMAND_COMPL 0x0e 1819 typedef struct { 1820 u_int8_t num_cmd_pkts; /* # of HCI command packets */ 1821 u_int16_t opcode; /* command OpCode */ 1822 /* command return parameters (if any) */ 1823 } __attribute__ ((packed)) ng_hci_command_compl_ep; 1824 1825 #define NG_HCI_EVENT_COMMAND_STATUS 0x0f 1826 typedef struct { 1827 u_int8_t status; /* 0x00 - pending */ 1828 u_int8_t num_cmd_pkts; /* # of HCI command packets */ 1829 u_int16_t opcode; /* command OpCode */ 1830 } __attribute__ ((packed)) ng_hci_command_status_ep; 1831 1832 #define NG_HCI_EVENT_HARDWARE_ERROR 0x10 1833 typedef struct { 1834 u_int8_t hardware_code; /* hardware error code */ 1835 } __attribute__ ((packed)) ng_hci_hardware_error_ep; 1836 1837 #define NG_HCI_EVENT_FLUSH_OCCUR 0x11 1838 typedef struct { 1839 u_int16_t con_handle; /* connection handle */ 1840 } __attribute__ ((packed)) ng_hci_flush_occur_ep; 1841 1842 #define NG_HCI_EVENT_ROLE_CHANGE 0x12 1843 typedef struct { 1844 u_int8_t status; /* 0x00 - success */ 1845 bdaddr_t bdaddr; /* address of remote unit */ 1846 u_int8_t role; /* new connection role */ 1847 } __attribute__ ((packed)) ng_hci_role_change_ep; 1848 1849 #define NG_HCI_EVENT_NUM_COMPL_PKTS 0x13 1850 typedef struct { 1851 u_int8_t num_con_handles; /* # of connection handles */ 1852 /* these are repeated "num_con_handles" times 1853 u_int16_t con_handle; --- connection handle(s) 1854 u_int16_t compl_pkt; --- # of completed packets */ 1855 } __attribute__ ((packed)) ng_hci_num_compl_pkts_ep; 1856 1857 #define NG_HCI_EVENT_MODE_CHANGE 0x14 1858 typedef struct { 1859 u_int8_t status; /* 0x00 - success */ 1860 u_int16_t con_handle; /* connection handle */ 1861 u_int8_t unit_mode; /* remote unit mode */ 1862 u_int16_t interval; /* interval * 0.625 msec */ 1863 } __attribute__ ((packed)) ng_hci_mode_change_ep; 1864 1865 #define NG_HCI_EVENT_RETURN_LINK_KEYS 0x15 1866 typedef struct { 1867 u_int8_t num_keys; /* # of keys */ 1868 /* these are repeated "num_keys" times 1869 bdaddr_t bdaddr; --- remote address(es) 1870 u_int8_t key[NG_HCI_KEY_SIZE]; --- key(s) */ 1871 } __attribute__ ((packed)) ng_hci_return_link_keys_ep; 1872 1873 #define NG_HCI_EVENT_PIN_CODE_REQ 0x16 1874 typedef struct { 1875 bdaddr_t bdaddr; /* remote unit address */ 1876 } __attribute__ ((packed)) ng_hci_pin_code_req_ep; 1877 1878 #define NG_HCI_EVENT_LINK_KEY_REQ 0x17 1879 typedef struct { 1880 bdaddr_t bdaddr; /* remote unit address */ 1881 } __attribute__ ((packed)) ng_hci_link_key_req_ep; 1882 1883 #define NG_HCI_EVENT_LINK_KEY_NOTIFICATION 0x18 1884 typedef struct { 1885 bdaddr_t bdaddr; /* remote unit address */ 1886 u_int8_t key[NG_HCI_KEY_SIZE]; /* link key */ 1887 u_int8_t key_type; /* type of the key */ 1888 } __attribute__ ((packed)) ng_hci_link_key_notification_ep; 1889 1890 #define NG_HCI_EVENT_LOOPBACK_COMMAND 0x19 1891 typedef struct { 1892 u_int8_t command[0]; /* Command packet */ 1893 } __attribute__ ((packed)) ng_hci_loopback_command_ep; 1894 1895 #define NG_HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a 1896 typedef struct { 1897 u_int8_t link_type; /* Link type */ 1898 } __attribute__ ((packed)) ng_hci_data_buffer_overflow_ep; 1899 1900 #define NG_HCI_EVENT_MAX_SLOT_CHANGE 0x1b 1901 typedef struct { 1902 u_int16_t con_handle; /* connection handle */ 1903 u_int8_t lmp_max_slots; /* Max. # of slots allowed */ 1904 } __attribute__ ((packed)) ng_hci_max_slot_change_ep; 1905 1906 #define NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c 1907 typedef struct { 1908 u_int8_t status; /* 0x00 - success */ 1909 u_int16_t con_handle; /* Connection handle */ 1910 u_int16_t clock_offset; /* Clock offset */ 1911 } __attribute__ ((packed)) ng_hci_read_clock_offset_compl_ep; 1912 1913 #define NG_HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d 1914 typedef struct { 1915 u_int8_t status; /* 0x00 - success */ 1916 u_int16_t con_handle; /* connection handle */ 1917 u_int16_t pkt_type; /* packet type */ 1918 } __attribute__ ((packed)) ng_hci_con_pkt_type_changed_ep; 1919 1920 #define NG_HCI_EVENT_QOS_VIOLATION 0x1e 1921 typedef struct { 1922 u_int16_t con_handle; /* connection handle */ 1923 } __attribute__ ((packed)) ng_hci_qos_violation_ep; 1924 1925 #define NG_HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f 1926 typedef struct { 1927 bdaddr_t bdaddr; /* destination address */ 1928 u_int8_t page_scan_mode; /* page scan mode */ 1929 } __attribute__ ((packed)) ng_hci_page_scan_mode_change_ep; 1930 1931 #define NG_HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20 1932 typedef struct { 1933 bdaddr_t bdaddr; /* destination address */ 1934 u_int8_t page_scan_rep_mode; /* page scan repetition mode */ 1935 } __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep; 1936 #define NG_HCI_EVENT_LE 0x3e 1937 typedef struct { 1938 u_int8_t subevent_code; 1939 }__attribute__ ((packed)) ng_hci_le_ep; 1940 1941 #define NG_HCI_LEEV_CON_COMPL 0x01 1942 1943 typedef struct { 1944 u_int8_t status; 1945 u_int16_t handle; 1946 u_int8_t role; 1947 u_int8_t address_type; 1948 bdaddr_t address; 1949 u_int16_t interval; 1950 u_int8_t latency; 1951 u_int16_t supervision_timeout; 1952 u_int8_t master_clock_accracy; 1953 1954 } __attribute__ ((packed)) ng_hci_le_connection_complete_ep; 1955 1956 #define NG_HCI_LEEV_ADVREP 0x02 1957 typedef struct { 1958 u_int8_t num_reports; 1959 1960 }__attribute__ ((packed)) ng_hci_le_advertising_report_ep; 1961 #define NG_HCI_SCAN_RESPONSE_DATA_MAX 0x1f 1962 1963 typedef struct { 1964 u_int8_t event_type; 1965 u_int8_t addr_type; 1966 bdaddr_t bdaddr; 1967 u_int8_t length_data; 1968 u_int8_t data[NG_HCI_SCAN_RESPONSE_DATA_MAX]; 1969 }__attribute__((packed)) ng_hci_le_advreport; 1970 1971 #define NG_HCI_LEEV_CON_UPDATE_COMPL 0x03 1972 typedef struct { 1973 u_int8_t status; 1974 u_int16_t connection_handle; 1975 u_int16_t conn_interval; 1976 u_int16_t conn_latency; 1977 u_int16_t supervision_timeout; 1978 }__attribute__((packed)) ng_hci_connection_update_complete_ep; 1979 #define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x04 1980 //TBD 1981 #define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x05 1982 //TBD 1983 1984 1985 #define NG_HCI_EVENT_BT_LOGO 0xfe 1986 1987 #define NG_HCI_EVENT_VENDOR 0xff 1988 1989 #endif /* ndef _NETGRAPH_HCI_H_ */ 1990