1little_endian_packets 2 3custom_field Address : 48 "hci/" 4custom_field ClassOfDevice : 24 "hci/" 5 6enum Enable : 8 { 7 DISABLED = 0x00, 8 ENABLED = 0x01, 9} 10 11// https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile 12enum GapDataType : 8 { 13 INVALID = 0x00, 14 FLAGS = 0x01, 15 INCOMPLETE_LIST_16_BIT_UUIDS = 0x02, 16 COMPLETE_LIST_16_BIT_UUIDS = 0x03, 17 INCOMPLETE_LIST_32_BIT_UUIDS = 0x04, 18 COMPLETE_LIST_32_BIT_UUIDS = 0x05, 19 INCOMPLETE_LIST_128_BIT_UUIDS = 0x06, 20 COMPLETE_LIST_128_BIT_UUIDS = 0x07, 21 SHORTENED_LOCAL_NAME = 0x08, 22 COMPLETE_LOCAL_NAME = 0x09, 23 TX_POWER_LEVEL = 0x0A, 24 CLASS_OF_DEVICE = 0x0D, 25 SERVICE_DATA_16_BIT_UUIDS = 0x16, 26 APPEARANCE = 0x19, 27 SERVICE_DATA_32_BIT_UUIDS = 0x20, 28 SERVICE_DATA_128_BIT_UUIDS = 0x21, 29 MANUFACTURER_SPECIFIC_DATA = 0xFF, 30} 31 32struct GapData { 33 _size_(data) : 8, // Including one byte for data_type 34 data_type : GapDataType, 35 data : 8[+1*8], 36} 37 38// HCI ACL Packets 39 40enum PacketBoundaryFlag : 2 { 41 FIRST_NON_AUTOMATICALLY_FLUSHABLE = 0, 42 CONTINUING_FRAGMENT = 1, 43 FIRST_AUTOMATICALLY_FLUSHABLE = 2, 44} 45 46enum BroadcastFlag : 2 { 47 POINT_TO_POINT = 0, 48 ACTIVE_SLAVE_BROADCAST = 1, 49} 50 51packet AclPacket { 52 handle : 12, 53 packet_boundary_flag : PacketBoundaryFlag, 54 broadcast_flag : BroadcastFlag, 55 _size_(_payload_) : 16, 56 _payload_, 57} 58 59// HCI SCO Packets 60 61enum PacketStatusFlag : 2 { 62 CORRECTLY_RECEIVED = 0, 63 POSSIBLY_INCOMPLETE = 1, 64 NO_DATA = 2, 65 PARTIALLY_LOST = 3, 66} 67 68packet ScoPacket { 69 handle : 12, 70 packet_status_flag : PacketStatusFlag, 71 _reserved_ : 2, // BroadcastFlag 72 _size_(data) : 8, 73 data : 8[], 74} 75 76// HCI Command Packets 77 78enum OpCode : 16 { 79 NONE = 0x0000, 80 81 // LINK_CONTROL 82 INQUIRY = 0x0401, 83 INQUIRY_CANCEL = 0x0402, 84 PERIODIC_INQUIRY_MODE = 0x0403, 85 EXIT_PERIODIC_INQUIRY_MODE = 0x0404, 86 CREATE_CONNECTION = 0x0405, 87 DISCONNECT = 0x0406, 88 CREATE_CONNECTION_CANCEL = 0x0408, 89 ACCEPT_CONNECTION_REQUEST = 0x0409, 90 REJECT_CONNECTION_REQUEST = 0x040A, 91 LINK_KEY_REQUEST_REPLY = 0x040B, 92 LINK_KEY_REQUEST_NEGATIVE_REPLY = 0x040C, 93 PIN_CODE_REQUEST_REPLY = 0x040D, 94 PIN_CODE_REQUEST_NEGATIVE_REPLY = 0x040E, 95 CHANGE_CONNECTION_PACKET_TYPE = 0x040F, 96 AUTHENTICATION_REQUESTED = 0x0411, 97 SET_CONNECTION_ENCRYPTION = 0x0413, 98 CHANGE_CONNECTION_LINK_KEY = 0x0415, 99 MASTER_LINK_KEY = 0x0417, 100 REMOTE_NAME_REQUEST = 0x0419, 101 REMOTE_NAME_REQUEST_CANCEL = 0x041A, 102 READ_REMOTE_SUPPORTED_FEATURES = 0x041B, 103 READ_REMOTE_EXTENDED_FEATURES = 0x041C, 104 READ_REMOTE_VERSION_INFORMATION = 0x041D, 105 READ_CLOCK_OFFSET = 0x041F, 106 READ_LMP_HANDLE = 0x0420, 107 SETUP_SYNCHRONOUS_CONNECTION = 0x0428, 108 ACCEPT_SYNCHRONOUS_CONNECTION = 0x0429, 109 REJECT_SYNCHRONOUS_CONNECTION = 0x042A, 110 IO_CAPABILITY_REQUEST_REPLY = 0x042B, 111 USER_CONFIRMATION_REQUEST_REPLY = 0x042C, 112 USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY = 0x042D, 113 USER_PASSKEY_REQUEST_REPLY = 0x042E, 114 USER_PASSKEY_REQUEST_NEGATIVE_REPLY = 0x042F, 115 REMOTE_OOB_DATA_REQUEST_REPLY = 0x0430, 116 REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY = 0x0433, 117 IO_CAPABILITY_REQUEST_NEGATIVE_REPLY = 0x0434, 118 ENHANCED_SETUP_SYNCHRONOUS_CONNECTION = 0x043D, 119 ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION = 0x043E, 120 121 // LINK_POLICY 122 HOLD_MODE = 0x0801, 123 SNIFF_MODE = 0x0803, 124 EXIT_SNIFF_MODE = 0x0804, 125 QOS_SETUP = 0x0807, 126 ROLE_DISCOVERY = 0x0809, 127 SWITCH_ROLE = 0x080B, 128 READ_LINK_POLICY_SETTINGS = 0x080C, 129 WRITE_LINK_POLICY_SETTINGS = 0x080D, 130 READ_DEFAULT_LINK_POLICY_SETTINGS = 0x080E, 131 WRITE_DEFAULT_LINK_POLICY_SETTINGS = 0x080F, 132 FLOW_SPECIFICATION = 0x0810, 133 SNIFF_SUBRATING = 0x0811, 134 135 // CONTROLLER_AND_BASEBAND 136 SET_EVENT_MASK = 0x0C01, 137 RESET = 0x0C03, 138 SET_EVENT_FILTER = 0x0C05, 139 FLUSH = 0x0C08, 140 READ_PIN_TYPE = 0x0C09, 141 WRITE_PIN_TYPE = 0x0C0A, 142 CREATE_NEW_UNIT_KEY = 0x0C0B, 143 READ_STORED_LINK_KEY = 0x0C0D, 144 WRITE_STORED_LINK_KEY = 0x0C11, 145 DELETE_STORED_LINK_KEY = 0x0C12, 146 WRITE_LOCAL_NAME = 0x0C13, 147 READ_LOCAL_NAME = 0x0C14, 148 READ_CONNECTION_ACCEPT_TIMEOUT = 0x0C15, 149 WRITE_CONNECTION_ACCEPT_TIMEOUT = 0x0C16, 150 READ_PAGE_TIMEOUT = 0x0C17, 151 WRITE_PAGE_TIMEOUT = 0x0C18, 152 READ_SCAN_ENABLE = 0x0C19, 153 WRITE_SCAN_ENABLE = 0x0C1A, 154 READ_PAGE_SCAN_ACTIVITY = 0x0C1B, 155 WRITE_PAGE_SCAN_ACTIVITY = 0x0C1C, 156 READ_INQUIRY_SCAN_ACTIVITY = 0x0C1D, 157 WRITE_INQUIRY_SCAN_ACTIVITY = 0x0C1E, 158 READ_AUTHENTICATION_ENABLE = 0x0C1F, 159 WRITE_AUTHENTICATION_ENABLE = 0x0C20, 160 READ_CLASS_OF_DEVICE = 0x0C23, 161 WRITE_CLASS_OF_DEVICE = 0x0C24, 162 READ_VOICE_SETTING = 0x0C25, 163 WRITE_VOICE_SETTING = 0x0C26, 164 READ_AUTOMATIC_FLUSH_TIMEOUT = 0x0C27, 165 WRITE_AUTOMATIC_FLUSH_TIMEOUT = 0x0C28, 166 READ_NUM_BROADCAST_RETRANSMITS = 0x0C29, 167 WRITE_NUM_BROADCAST_RETRANSMITS = 0x0C2A, 168 READ_HOLD_MODE_ACTIVITY = 0x0C2B, 169 WRITE_HOLD_MODE_ACTIVITY = 0x0C2C, 170 READ_TRANSMIT_POWER_LEVEL = 0x0C2D, 171 READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE = 0x0C2E, 172 WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE = 0x0C2F, 173 SET_CONTROLLER_TO_HOST_FLOW_CONTROL = 0x0C31, 174 HOST_BUFFER_SIZE = 0x0C33, 175 HOST_NUM_COMPLETED_PACKETS = 0x0C35, 176 READ_LINK_SUPERVISION_TIMEOUT = 0x0C36, 177 WRITE_LINK_SUPERVISION_TIMEOUT = 0x0C37, 178 READ_NUMBER_OF_SUPPORTED_IAC = 0x0C38, 179 READ_CURRENT_IAC_LAP = 0x0C39, 180 WRITE_CURRENT_IAC_LAP = 0x0C3A, 181 SET_AFH_HOST_CHANNEL_CLASSIFICATION = 0x0C3F, 182 READ_INQUIRY_SCAN_TYPE = 0x0C42, 183 WRITE_INQUIRY_SCAN_TYPE = 0x0C43, 184 READ_INQUIRY_MODE = 0x0C44, 185 WRITE_INQUIRY_MODE = 0x0C45, 186 READ_PAGE_SCAN_TYPE = 0x0C46, 187 WRITE_PAGE_SCAN_TYPE = 0x0C47, 188 READ_AFH_CHANNEL_ASSESSMENT_MODE = 0x0C48, 189 WRITE_AFH_CHANNEL_ASSESSMENT_MODE = 0x0C49, 190 READ_EXTENDED_INQUIRY_RESPONSE = 0x0C51, 191 WRITE_EXTENDED_INQUIRY_RESPONSE = 0x0C52, 192 REFRESH_ENCRYPTION_KEY = 0x0C53, 193 READ_SIMPLE_PAIRING_MODE = 0x0C55, 194 WRITE_SIMPLE_PAIRING_MODE = 0x0C56, 195 READ_LOCAL_OOB_DATA = 0x0C57, 196 READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL = 0x0C58, 197 WRITE_INQUIRY_TRANSMIT_POWER_LEVEL = 0x0C59, 198 SEND_KEYPRESS_NOTIFICATION = 0x0C60, 199 200 READ_LE_HOST_SUPPORT = 0x0C6C, 201 WRITE_LE_HOST_SUPPORT = 0x0C6D, 202 203 READ_SECURE_CONNECTIONS_HOST_SUPPORT = 0x0C79, 204 WRITE_SECURE_CONNECTIONS_HOST_SUPPORT = 0x0C7A, 205 READ_LOCAL_OOB_EXTENDED_DATA = 0x0C7D, 206 207 // INFORMATIONAL_PARAMETERS 208 READ_LOCAL_VERSION_INFORMATION = 0x1001, 209 READ_LOCAL_SUPPORTED_COMMANDS = 0x1002, 210 READ_LOCAL_SUPPORTED_FEATURES = 0x1003, 211 READ_LOCAL_EXTENDED_FEATURES = 0x1004, 212 READ_BUFFER_SIZE = 0x1005, 213 READ_BD_ADDR = 0x1009, 214 READ_DATA_BLOCK_SIZE = 0x100A, 215 READ_LOCAL_SUPPORTED_CODECS = 0x100B, 216 217 // STATUS_PARAMETERS 218 READ_FAILED_CONTACT_COUNTER = 0x1401, 219 RESET_FAILED_CONTACT_COUNTER = 0x1402, 220 READ_LINK_QUALITY = 0x1403, 221 READ_RSSI = 0x1405, 222 READ_AFH_CHANNEL_MAP = 0x1406, 223 READ_CLOCK = 0x1407, 224 READ_ENCRYPTION_KEY_SIZE = 0x1408, 225 226 // TESTING 227 READ_LOOPBACK_MODE = 0x1801, 228 WRITE_LOOPBACK_MODE = 0x1802, 229 ENABLE_DEVICE_UNDER_TEST_MODE = 0x1803, 230 WRITE_SIMPLE_PAIRING_DEBUG_MODE = 0x1804, 231 WRITE_SECURE_CONNECTIONS_TEST_MODE = 0x180A, 232 233 // LE_CONTROLLER 234 LE_SET_EVENT_MASK = 0x2001, 235 LE_READ_BUFFER_SIZE = 0x2002, 236 LE_READ_LOCAL_SUPPORTED_FEATURES = 0x2003, 237 LE_SET_RANDOM_ADDRESS = 0x2005, 238 LE_SET_ADVERTISING_PARAMETERS = 0x2006, 239 LE_READ_ADVERTISING_CHANNEL_TX_POWER = 0x2007, 240 LE_SET_ADVERTISING_DATA = 0x2008, 241 LE_SET_SCAN_RESPONSE_DATA = 0x2009, 242 LE_SET_ADVERTISING_ENABLE = 0x200A, 243 LE_SET_SCAN_PARAMETERS = 0x200B, 244 LE_SET_SCAN_ENABLE = 0x200C, 245 LE_CREATE_CONNECTION = 0x200D, 246 LE_CREATE_CONNECTION_CANCEL = 0x200E, 247 LE_READ_WHITE_LIST_SIZE = 0x200F, 248 LE_CLEAR_WHITE_LIST = 0x2010, 249 LE_ADD_DEVICE_TO_WHITE_LIST = 0x2011, 250 LE_REMOVE_DEVICE_FROM_WHITE_LIST = 0x2012, 251 LE_CONNECTION_UPDATE = 0x2013, 252 LE_SET_HOST_CHANNEL_CLASSIFICATION = 0x2014, 253 LE_READ_CHANNEL_MAP = 0x2015, 254 LE_READ_REMOTE_FEATURES = 0x2016, 255 LE_ENCRYPT = 0x2017, 256 LE_RAND = 0x2018, 257 LE_START_ENCRYPTION = 0x2019, 258 LE_LONG_TERM_KEY_REQUEST_REPLY = 0x201A, 259 LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY = 0x201B, 260 LE_READ_SUPPORTED_STATES = 0x201C, 261 LE_RECEIVER_TEST = 0x201D, 262 LE_TRANSMITTER_TEST = 0x201E, 263 LE_TEST_END = 0x201F, 264 LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY = 0x2020, 265 LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY = 0x2021, 266 267 LE_SET_DATA_LENGTH = 0x2022, 268 LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH = 0x2023, 269 LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH = 0x2024, 270 LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND = 0x2025, 271 LE_GENERATE_DHKEY_COMMAND_V1 = 0x2026, 272 LE_ADD_DEVICE_TO_RESOLVING_LIST = 0x2027, 273 LE_REMOVE_DEVICE_FROM_RESOLVING_LIST = 0x2028, 274 LE_CLEAR_RESOLVING_LIST = 0x2029, 275 LE_READ_RESOLVING_LIST_SIZE = 0x202A, 276 LE_READ_PEER_RESOLVABLE_ADDRESS = 0x202B, 277 LE_READ_LOCAL_RESOLVABLE_ADDRESS = 0x202C, 278 LE_SET_ADDRESS_RESOLUTION_ENABLE = 0x202D, 279 LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT = 0x202E, 280 LE_READ_MAXIMUM_DATA_LENGTH = 0x202F, 281 LE_READ_PHY = 0x2030, 282 LE_SET_DEFAULT_PHY = 0x2031, 283 LE_SET_PHY = 0x2032, 284 LE_ENHANCED_RECEIVER_TEST = 0x2033, 285 LE_ENHANCED_TRANSMITTER_TEST = 0x2034, 286 LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS = 0x2035, 287 LE_SET_EXTENDED_ADVERTISING_PARAMETERS = 0x2036, 288 LE_SET_EXTENDED_ADVERTISING_DATA = 0x2037, 289 LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE = 0x2038, 290 LE_SET_EXTENDED_ADVERTISING_ENABLE = 0x2039, 291 LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH = 0x203A, 292 LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS = 0x203B, 293 LE_REMOVE_ADVERTISING_SET = 0x203C, 294 LE_CLEAR_ADVERTISING_SETS = 0x203D, 295 LE_SET_PERIODIC_ADVERTISING_PARAM = 0x203E, 296 LE_SET_PERIODIC_ADVERTISING_DATA = 0x203F, 297 LE_SET_PERIODIC_ADVERTISING_ENABLE = 0x2040, 298 LE_SET_EXTENDED_SCAN_PARAMETERS = 0x2041, 299 LE_SET_EXTENDED_SCAN_ENABLE = 0x2042, 300 LE_EXTENDED_CREATE_CONNECTION = 0x2043, 301 LE_PERIODIC_ADVERTISING_CREATE_SYNC = 0x2044, 302 LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL = 0x2045, 303 LE_PERIODIC_ADVERTISING_TERMINATE_SYNC = 0x2046, 304 LE_ADD_DEVICE_TO_PERIODIC_ADVERTISING_LIST = 0x2047, 305 LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISING_LIST = 0x2048, 306 LE_CLEAR_PERIODIC_ADVERTISING_LIST = 0x2049, 307 LE_READ_PERIODIC_ADVERTISING_LIST_SIZE = 0x204A, 308 LE_READ_TRANSMIT_POWER = 0x204B, 309 LE_READ_RF_PATH_COMPENSATION_POWER = 0x204C, 310 LE_WRITE_RF_PATH_COMPENSATION_POWER = 0x204D, 311 LE_SET_PRIVACY_MODE = 0x204E, 312 LE_GENERATE_DHKEY_COMMAND = 0x205E, 313 314 // VENDOR_SPECIFIC 315 LE_GET_VENDOR_CAPABILITIES = 0xFD53, 316 LE_MULTI_ADVT = 0xFD54, 317 LE_BATCH_SCAN = 0xFD56, 318 LE_ADV_FILTER = 0xFD57, 319 LE_TRACK_ADV = 0xFD58, 320 LE_ENERGY_INFO = 0xFD59, 321 LE_EXTENDED_SCAN_PARAMS = 0xFD5A, 322 CONTROLLER_DEBUG_INFO = 0xFD5B, 323 CONTROLLER_A2DP_OPCODE = 0xFD5D, 324 CONTROLLER_BQR = 0xFD5E, 325} 326 327// For mapping Local Supported Commands command 328// Value = Octet * 10 + bit 329enum OpCodeIndex : 16 { 330 INQUIRY = 0, 331 INQUIRY_CANCEL = 1, 332 PERIODIC_INQUIRY_MODE = 2, 333 EXIT_PERIODIC_INQUIRY_MODE = 3, 334 CREATE_CONNECTION = 4, 335 DISCONNECT = 5, 336 CREATE_CONNECTION_CANCEL = 7, 337 ACCEPT_CONNECTION_REQUEST = 10, 338 REJECT_CONNECTION_REQUEST = 11, 339 LINK_KEY_REQUEST_REPLY = 12, 340 LINK_KEY_REQUEST_NEGATIVE_REPLY = 13, 341 PIN_CODE_REQUEST_REPLY = 14, 342 PIN_CODE_REQUEST_NEGATIVE_REPLY = 15, 343 CHANGE_CONNECTION_PACKET_TYPE = 16, 344 AUTHENTICATION_REQUESTED = 17, 345 SET_CONNECTION_ENCRYPTION = 20, 346 CHANGE_CONNECTION_LINK_KEY = 21, 347 MASTER_LINK_KEY = 22, 348 REMOTE_NAME_REQUEST = 23, 349 REMOTE_NAME_REQUEST_CANCEL = 24, 350 READ_REMOTE_SUPPORTED_FEATURES = 25, 351 READ_REMOTE_EXTENDED_FEATURES = 26, 352 READ_REMOTE_VERSION_INFORMATION = 27, 353 READ_CLOCK_OFFSET = 30, 354 READ_LMP_HANDLE = 31, 355 HOLD_MODE = 41, 356 SNIFF_MODE = 42, 357 EXIT_SNIFF_MODE = 43, 358 QOS_SETUP = 46, 359 ROLE_DISCOVERY = 47, 360 SWITCH_ROLE = 50, 361 READ_LINK_POLICY_SETTINGS = 51, 362 WRITE_LINK_POLICY_SETTINGS = 52, 363 READ_DEFAULT_LINK_POLICY_SETTINGS = 53, 364 WRITE_DEFAULT_LINK_POLICY_SETTINGS = 54, 365 FLOW_SPECIFICATION = 55, 366 SET_EVENT_MASK = 56, 367 RESET = 57, 368 SET_EVENT_FILTER = 60, 369 FLUSH = 61, 370 READ_PIN_TYPE = 62, 371 WRITE_PIN_TYPE = 63, 372 READ_STORED_LINK_KEY = 65, 373 WRITE_STORED_LINK_KEY = 66, 374 DELETE_STORED_LINK_KEY = 67, 375 WRITE_LOCAL_NAME = 70, 376 READ_LOCAL_NAME = 71, 377 READ_CONNECTION_ACCEPT_TIMEOUT = 72, 378 WRITE_CONNECTION_ACCEPT_TIMEOUT = 73, 379 READ_PAGE_TIMEOUT = 74, 380 WRITE_PAGE_TIMEOUT = 75, 381 READ_SCAN_ENABLE = 76, 382 WRITE_SCAN_ENABLE = 77, 383 READ_PAGE_SCAN_ACTIVITY = 80, 384 WRITE_PAGE_SCAN_ACTIVITY = 81, 385 READ_INQUIRY_SCAN_ACTIVITY = 82, 386 WRITE_INQUIRY_SCAN_ACTIVITY = 83, 387 READ_AUTHENTICATION_ENABLE = 84, 388 WRITE_AUTHENTICATION_ENABLE = 85, 389 READ_CLASS_OF_DEVICE = 90, 390 WRITE_CLASS_OF_DEVICE = 91, 391 READ_VOICE_SETTING = 92, 392 WRITE_VOICE_SETTING = 93, 393 READ_AUTOMATIC_FLUSH_TIMEOUT = 94, 394 WRITE_AUTOMATIC_FLUSH_TIMEOUT = 95, 395 READ_NUM_BROADCAST_RETRANSMITS = 96, 396 WRITE_NUM_BROADCAST_RETRANSMITS = 97, 397 READ_HOLD_MODE_ACTIVITY = 100, 398 WRITE_HOLD_MODE_ACTIVITY = 101, 399 READ_TRANSMIT_POWER_LEVEL = 102, 400 READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE = 103, 401 WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE = 104, 402 SET_CONTROLLER_TO_HOST_FLOW_CONTROL = 105, 403 HOST_BUFFER_SIZE = 106, 404 HOST_NUM_COMPLETED_PACKETS = 107, 405 READ_LINK_SUPERVISION_TIMEOUT = 110, 406 WRITE_LINK_SUPERVISION_TIMEOUT = 111, 407 READ_NUMBER_OF_SUPPORTED_IAC = 112, 408 READ_CURRENT_IAC_LAP = 113, 409 WRITE_CURRENT_IAC_LAP = 114, 410 SET_AFH_HOST_CHANNEL_CLASSIFICATION = 121, 411 READ_INQUIRY_SCAN_TYPE = 124, 412 WRITE_INQUIRY_SCAN_TYPE = 125, 413 READ_INQUIRY_MODE = 126, 414 WRITE_INQUIRY_MODE = 127, 415 READ_PAGE_SCAN_TYPE = 130, 416 WRITE_PAGE_SCAN_TYPE = 131, 417 READ_AFH_CHANNEL_ASSESSMENT_MODE = 132, 418 WRITE_AFH_CHANNEL_ASSESSMENT_MODE = 133, 419 READ_LOCAL_VERSION_INFORMATION = 143, 420 READ_LOCAL_SUPPORTED_FEATURES = 145, 421 READ_LOCAL_EXTENDED_FEATURES = 146, 422 READ_BUFFER_SIZE = 147, 423 READ_BD_ADDR = 151, 424 READ_FAILED_CONTACT_COUNTER = 152, 425 RESET_FAILED_CONTACT_COUNTER = 153, 426 READ_LINK_QUALITY = 154, 427 READ_RSSI = 155, 428 READ_AFH_CHANNEL_MAP = 156, 429 READ_CLOCK = 157, 430 READ_LOOPBACK_MODE = 160, 431 WRITE_LOOPBACK_MODE = 161, 432 ENABLE_DEVICE_UNDER_TEST_MODE = 162, 433 SETUP_SYNCHRONOUS_CONNECTION = 163, 434 ACCEPT_SYNCHRONOUS_CONNECTION = 164, 435 REJECT_SYNCHRONOUS_CONNECTION = 165, 436 READ_EXTENDED_INQUIRY_RESPONSE = 170, 437 WRITE_EXTENDED_INQUIRY_RESPONSE = 171, 438 REFRESH_ENCRYPTION_KEY = 172, 439 SNIFF_SUBRATING = 174, 440 READ_SIMPLE_PAIRING_MODE = 175, 441 WRITE_SIMPLE_PAIRING_MODE = 176, 442 READ_LOCAL_OOB_DATA = 177, 443 READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL = 180, 444 WRITE_INQUIRY_TRANSMIT_POWER_LEVEL = 181, 445 IO_CAPABILITY_REQUEST_REPLY = 187, 446 USER_CONFIRMATION_REQUEST_REPLY = 190, 447 USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY = 191, 448 USER_PASSKEY_REQUEST_REPLY = 192, 449 USER_PASSKEY_REQUEST_NEGATIVE_REPLY = 193, 450 REMOTE_OOB_DATA_REQUEST_REPLY = 194, 451 WRITE_SIMPLE_PAIRING_DEBUG_MODE = 195, 452 REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY = 197, 453 SEND_KEYPRESS_NOTIFICATION = 202, 454 IO_CAPABILITY_REQUEST_NEGATIVE_REPLY = 203, 455 READ_ENCRYPTION_KEY_SIZE = 204, 456 READ_DATA_BLOCK_SIZE = 232, 457 READ_LE_HOST_SUPPORT = 245, 458 WRITE_LE_HOST_SUPPORT = 246, 459 LE_SET_EVENT_MASK = 250, 460 LE_READ_BUFFER_SIZE = 251, 461 LE_READ_LOCAL_SUPPORTED_FEATURES = 252, 462 LE_SET_RANDOM_ADDRESS = 254, 463 LE_SET_ADVERTISING_PARAMETERS = 255, 464 LE_READ_ADVERTISING_CHANNEL_TX_POWER = 256, 465 LE_SET_ADVERTISING_DATA = 257, 466 LE_SET_SCAN_RESPONSE_DATA = 260, 467 LE_SET_ADVERTISING_ENABLE = 261, 468 LE_SET_SCAN_PARAMETERS = 262, 469 LE_SET_SCAN_ENABLE = 263, 470 LE_CREATE_CONNECTION = 264, 471 LE_CREATE_CONNECTION_CANCEL = 265, 472 LE_READ_WHITE_LIST_SIZE = 266, 473 LE_CLEAR_WHITE_LIST = 267, 474 LE_ADD_DEVICE_TO_WHITE_LIST = 270, 475 LE_REMOVE_DEVICE_FROM_WHITE_LIST = 271, 476 LE_CONNECTION_UPDATE = 272, 477 LE_SET_HOST_CHANNEL_CLASSIFICATION = 273, 478 LE_READ_CHANNEL_MAP = 274, 479 LE_READ_REMOTE_FEATURES = 275, 480 LE_ENCRYPT = 276, 481 LE_RAND = 277, 482 LE_START_ENCRYPTION = 280, 483 LE_LONG_TERM_KEY_REQUEST_REPLY = 281, 484 LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY = 282, 485 LE_READ_SUPPORTED_STATES = 283, 486 LE_RECEIVER_TEST = 284, 487 LE_TRANSMITTER_TEST = 285, 488 LE_TEST_END = 286, 489 ENHANCED_SETUP_SYNCHRONOUS_CONNECTION = 293, 490 ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION = 294, 491 READ_LOCAL_SUPPORTED_CODECS = 295, 492 READ_SECURE_CONNECTIONS_HOST_SUPPORT = 322, 493 WRITE_SECURE_CONNECTIONS_HOST_SUPPORT = 323, 494 READ_LOCAL_OOB_EXTENDED_DATA = 326, 495 WRITE_SECURE_CONNECTIONS_TEST_MODE = 327, 496 LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY = 334, 497 LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY = 335, 498 LE_SET_DATA_LENGTH = 336, 499 LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH = 337, 500 LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH = 340, 501 LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND = 341, 502 LE_GENERATE_DHKEY_COMMAND_V1 = 342, 503 LE_ADD_DEVICE_TO_RESOLVING_LIST = 343, 504 LE_REMOVE_DEVICE_FROM_RESOLVING_LIST = 344, 505 LE_CLEAR_RESOLVING_LIST = 345, 506 LE_READ_RESOLVING_LIST_SIZE = 346, 507 LE_READ_PEER_RESOLVABLE_ADDRESS = 347, 508 LE_READ_LOCAL_RESOLVABLE_ADDRESS = 350, 509 LE_SET_ADDRESS_RESOLUTION_ENABLE = 351, 510 LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT = 352, 511 LE_READ_MAXIMUM_DATA_LENGTH = 353, 512 LE_READ_PHY = 354, 513 LE_SET_DEFAULT_PHY = 355, 514 LE_SET_PHY = 356, 515 LE_ENHANCED_RECEIVER_TEST = 357, 516 LE_ENHANCED_TRANSMITTER_TEST = 360, 517 LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS = 361, 518 LE_SET_EXTENDED_ADVERTISING_PARAMETERS = 362, 519 LE_SET_EXTENDED_ADVERTISING_DATA = 363, 520 LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE = 364, 521 LE_SET_EXTENDED_ADVERTISING_ENABLE = 365, 522 LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH = 366, 523 LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS = 367, 524 LE_REMOVE_ADVERTISING_SET = 370, 525 LE_CLEAR_ADVERTISING_SETS = 371, 526 LE_SET_PERIODIC_ADVERTISING_PARAM = 372, 527 LE_SET_PERIODIC_ADVERTISING_DATA = 373, 528 LE_SET_PERIODIC_ADVERTISING_ENABLE = 374, 529 LE_SET_EXTENDED_SCAN_PARAMETERS = 375, 530 LE_SET_EXTENDED_SCAN_ENABLE = 376, 531 LE_EXTENDED_CREATE_CONNECTION = 377, 532 LE_PERIODIC_ADVERTISING_CREATE_SYNC = 380, 533 LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL = 381, 534 LE_PERIODIC_ADVERTISING_TERMINATE_SYNC = 382, 535 LE_ADD_DEVICE_TO_PERIODIC_ADVERTISING_LIST = 383, 536 LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISING_LIST = 384, 537 LE_CLEAR_PERIODIC_ADVERTISING_LIST = 385, 538 LE_READ_PERIODIC_ADVERTISING_LIST_SIZE = 386, 539 LE_READ_TRANSMIT_POWER = 387, 540 LE_READ_RF_PATH_COMPENSATION_POWER = 390, 541 LE_WRITE_RF_PATH_COMPENSATION_POWER = 391, 542 LE_SET_PRIVACY_MODE = 392, 543 LE_GENERATE_DHKEY_COMMAND = 412, 544} 545 546packet CommandPacket { 547 op_code : OpCode, 548 _size_(_payload_) : 8, 549 _payload_, 550} 551 552// Packets for interfaces 553 554packet DiscoveryCommand : CommandPacket { _payload_, } 555packet ConnectionManagementCommand : CommandPacket { _payload_, } 556packet SecurityCommand : CommandPacket { _payload_, } 557packet ScoConnectionCommand : CommandPacket { _payload_, } 558packet LeAdvertisingCommand : CommandPacket { _payload_, } 559packet LeScanningCommand : CommandPacket { _payload_, } 560packet LeConnectionManagementCommand : CommandPacket { _payload_, } 561packet LeSecurityCommand : CommandPacket { _payload_, } 562packet VendorCommand : CommandPacket { _payload_, } 563 564// HCI Event Packets 565 566enum EventCode : 8 { 567 INQUIRY_COMPLETE = 0x01, 568 INQUIRY_RESULT = 0x02, 569 CONNECTION_COMPLETE = 0x03, 570 CONNECTION_REQUEST = 0x04, 571 DISCONNECTION_COMPLETE = 0x05, 572 AUTHENTICATION_COMPLETE = 0x06, 573 REMOTE_NAME_REQUEST_COMPLETE = 0x07, 574 ENCRYPTION_CHANGE = 0x08, 575 CHANGE_CONNECTION_LINK_KEY_COMPLETE = 0x09, 576 MASTER_LINK_KEY_COMPLETE = 0x0A, 577 READ_REMOTE_SUPPORTED_FEATURES_COMPLETE = 0x0B, 578 READ_REMOTE_VERSION_INFORMATION_COMPLETE = 0x0C, 579 QOS_SETUP_COMPLETE = 0x0D, 580 COMMAND_COMPLETE = 0x0E, 581 COMMAND_STATUS = 0x0F, 582 HARDWARE_ERROR = 0x10, 583 FLUSH_OCCURRED = 0x11, 584 ROLE_CHANGE = 0x12, 585 NUMBER_OF_COMPLETED_PACKETS = 0x13, 586 MODE_CHANGE = 0x14, 587 RETURN_LINK_KEYS = 0x15, 588 PIN_CODE_REQUEST = 0x16, 589 LINK_KEY_REQUEST = 0x17, 590 LINK_KEY_NOTIFICATION = 0x18, 591 LOOPBACK_COMMAND = 0x19, 592 DATA_BUFFER_OVERFLOW = 0x1A, 593 MAX_SLOTS_CHANGE = 0x1B, 594 READ_CLOCK_OFFSET_COMPLETE = 0x1C, 595 CONNECTION_PACKET_TYPE_CHANGED = 0x1D, 596 QOS_VIOLATION = 0x1E, 597 PAGE_SCAN_REPETITION_MODE_CHANGE = 0x20, 598 FLOW_SPECIFICATION_COMPLETE = 0x21, 599 INQUIRY_RESULT_WITH_RSSI = 0x22, 600 READ_REMOTE_EXTENDED_FEATURES_COMPLETE = 0x23, 601 SYNCHRONOUS_CONNECTION_COMPLETE = 0x2C, 602 SYNCHRONOUS_CONNECTION_CHANGED = 0x2D, 603 SNIFF_SUBRATING = 0x2E, 604 EXTENDED_INQUIRY_RESULT = 0x2F, 605 ENCRYPTION_KEY_REFRESH_COMPLETE = 0x30, 606 IO_CAPABILITY_REQUEST = 0x31, 607 IO_CAPABILITY_RESPONSE = 0x32, 608 USER_CONFIRMATION_REQUEST = 0x33, 609 USER_PASSKEY_REQUEST = 0x34, 610 REMOTE_OOB_DATA_REQUEST = 0x35, 611 SIMPLE_PAIRING_COMPLETE = 0x36, 612 LINK_SUPERVISION_TIMEOUT_CHANGED = 0x38, 613 ENHANCED_FLUSH_COMPLETE = 0x39, 614 USER_PASSKEY_NOTIFICATION = 0x3B, 615 KEYPRESS_NOTIFICATION = 0x3C, 616 REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION = 0x3D, 617 LE_META_EVENT = 0x3e, 618 NUMBER_OF_COMPLETED_DATA_BLOCKS = 0x48, 619 VENDOR_SPECIFIC = 0xFF, 620} 621 622packet EventPacket { 623 event_code : EventCode, 624 _size_(_payload_) : 8, 625 _payload_, 626} 627 628// LE Events 629 630enum SubeventCode : 8 { 631 CONNECTION_COMPLETE = 0x01, 632 ADVERTISING_REPORT = 0x02, 633 CONNECTION_UPDATE_COMPLETE = 0x03, 634 READ_REMOTE_FEATURES_COMPLETE = 0x04, 635 LONG_TERM_KEY_REQUEST = 0x05, 636 REMOTE_CONNECTION_PARAMETER_REQUEST = 0x06, 637 DATA_LENGTH_CHANGE = 0x07, 638 READ_LOCAL_P256_PUBLIC_KEY_COMPLETE = 0x08, 639 GENERATE_DHKEY_COMPLETE = 0x09, 640 ENHANCED_CONNECTION_COMPLETE = 0x0a, 641 DIRECTED_ADVERTISING_REPORT = 0x0b, 642 PHY_UPDATE_COMPLETE = 0x0c, 643 EXTENDED_ADVERTISING_REPORT = 0x0D, 644 PERIODIC_ADVERTISING_SYNC_ESTABLISHED = 0x0E, 645 PERIODIC_ADVERTISING_REPORT = 0x0F, 646 PERIODIC_ADVERTISING_SYNC_LOST = 0x10, 647 SCAN_TIMEOUT = 0x11, 648 ADVERTISING_SET_TERMINATED = 0x12, 649 SCAN_REQUEST_RECEIVED = 0x13, 650} 651 652// Vendor specific events 653enum VseSubeventCode : 8 { 654 BLE_THRESHOLD = 0x54, 655 BLE_TRACKING = 0x56, 656 DEBUG_INFO = 0x57, 657 BQR_EVENT = 0x58, 658} 659 660// Common definitions for commands and events 661 662enum FeatureFlag : 1 { 663 UNSUPPORTED = 0, 664 SUPPORTED = 1, 665} 666 667enum ErrorCode: 8 { 668 SUCCESS = 0x00, 669 UNKNOWN_HCI_COMMAND = 0x01, 670 UNKNOWN_CONNECTION = 0x02, 671 HARDWARE_FAILURE = 0x03, 672 PAGE_TIMEOUT = 0x04, 673 AUTHENTICATION_FAILURE = 0x05, 674 PIN_OR_KEY_MISSING = 0x06, 675 MEMORY_CAPACITY_EXCEEDED = 0x07, 676 CONNECTION_TIMEOUT = 0x08, 677 CONNECTION_LIMIT_EXCEEDED = 0x09, 678 SYNCHRONOUS_CONNECTION_LIMIT_EXCEEDED = 0x0A, 679 CONNECTION_ALREADY_EXISTS = 0x0B, 680 COMMAND_DISALLOWED = 0x0C, 681 CONNECTION_REJECTED_LIMITED_RESOURCES = 0x0D, 682 CONNECTION_REJECTED_SECURITY_REASONS = 0x0E, 683 CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR = 0x0F, 684 CONNECTION_ACCEPT_TIMEOUT = 0x10, 685 UNSUPORTED_FEATURE_OR_PARAMETER_VALUE = 0x11, 686 INVALID_HCI_COMMAND_PARAMETERS = 0x12, 687 REMOTE_USER_TERMINATED_CONNECTION = 0x13, 688 REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES = 0x14, 689 REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF = 0x15, 690 CONNECTION_TERMINATED_BY_LOCAL_HOST = 0x16, 691 REPEATED_ATTEMPTS = 0x17, 692 PAIRING_NOT_ALLOWED = 0x18, 693 UNKNOWN_LMP_PDU = 0x19, 694 UNSUPPORTED_REMOTE_OR_LMP_FEATURE = 0x1A, 695 SCO_OFFSET_REJECTED = 0x1B, 696 SCO_INTERVAL_REJECTED = 0x1C, 697 SCO_AIR_MODE_REJECTED = 0x1D, 698 INVALID_LMP_OR_LL_PARAMETERS = 0x1E, 699 UNSPECIFIED_ERROR = 0x1F, 700 UNSUPPORTED_LMP_OR_LL_PARAMETER = 0x20, 701 ROLE_CHANGE_NOT_ALLOWED = 0x21, 702 LINK_LAYER_COLLISION = 0x23, 703 ENCRYPTION_MODE_NOT_ACCEPTABLE = 0x25, 704 CONTROLLER_BUSY = 0x3A, 705} 706 707// Events that are defined with their respective commands 708 709packet CommandComplete : EventPacket (event_code = COMMAND_COMPLETE){ 710 num_hci_command_packets : 8, 711 command_op_code : OpCode, 712 _payload_, 713} 714 715packet CommandStatus : EventPacket (event_code = COMMAND_STATUS){ 716 status : ErrorCode, // SUCCESS means PENDING 717 num_hci_command_packets : 8, 718 command_op_code : OpCode, 719 _payload_, 720} 721 722 // Credits 723packet NoCommandComplete : CommandComplete (command_op_code = NONE){ 724} 725 726struct Lap { // Lower Address Part 727 lap : 6, 728 _reserved_ : 2, 729 _fixed_ = 0x9e8b : 16, 730} 731 732 // LINK_CONTROL 733packet Inquiry : DiscoveryCommand (op_code = INQUIRY) { 734 lap : Lap, 735 inquiry_length : 8, // 0x1 - 0x30 (times 1.28s) 736 num_responses : 8, // 0x00 unlimited 737} 738 739packet InquiryStatus : CommandStatus (command_op_code = INQUIRY) { 740} 741 742packet InquiryCancel : DiscoveryCommand (op_code = INQUIRY_CANCEL) { 743} 744 745packet InquiryCancelComplete : CommandComplete (command_op_code = INQUIRY_CANCEL) { 746 status : ErrorCode, 747} 748 749packet PeriodicInquiryMode : DiscoveryCommand (op_code = PERIODIC_INQUIRY_MODE) { 750 max_period_length : 16, // Range 0x0003 to 0xffff (times 1.28s) 751 min_period_length : 16, // Range 0x0002 to 0xfffe (times 1.28s) 752 lap : Lap, 753 inquiry_length : 8, // 0x1 - 0x30 (times 1.28s) 754 num_responses : 8, // 0x00 unlimited 755} 756 757packet PeriodicInquiryModeComplete : CommandComplete (command_op_code = PERIODIC_INQUIRY_MODE) { 758 status : ErrorCode, 759} 760 761packet ExitPeriodicInquiryMode : DiscoveryCommand (op_code = EXIT_PERIODIC_INQUIRY_MODE) { 762} 763 764packet ExitPeriodicInquiryModeComplete : CommandComplete (command_op_code = EXIT_PERIODIC_INQUIRY_MODE) { 765 status : ErrorCode, 766} 767 768enum PageScanRepetitionMode : 8 { 769 R0 = 0x00, 770 R1 = 0x01, 771 R2 = 0x02, 772} 773 774enum ClockOffsetValid : 1 { 775 INVALID = 0, 776 VALID = 1, 777} 778 779enum CreateConnectionRoleSwitch : 8 { 780 REMAIN_MASTER = 0x00, 781 ALLOW_ROLE_SWITCH = 0x01, 782} 783 784packet CreateConnection : ConnectionManagementCommand (op_code = CREATE_CONNECTION) { 785 bd_addr : Address, 786 packet_type : 16, 787 page_scan_repetition_mode : PageScanRepetitionMode, 788 _reserved_ : 8, 789 clock_offset : 15, 790 clock_offset_valid : ClockOffsetValid, 791 allow_role_switch : CreateConnectionRoleSwitch, 792} 793 794packet CreateConnectionStatus : CommandStatus (command_op_code = CREATE_CONNECTION) { 795} 796 797enum DisconnectReason : 8 { 798 AUTHENTICATION_FAILURE = 0x05, 799 REMOTE_USER_TERMINATED_CONNECTION = 0x13, 800 REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES = 0x14, 801 REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF = 0x15, 802 UNSUPPORTED_REMOTE_FEATURE = 0x1A, 803 PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED = 0x29, 804 UNACCEPTABLE_CONNECTION_PARAMETERS = 0x3B, 805} 806 807packet Disconnect : ConnectionManagementCommand (op_code = DISCONNECT) { 808 connection_handle : 12, 809 _reserved_ : 4, 810 reason : DisconnectReason, 811} 812 813packet DisconnectStatus : CommandStatus (command_op_code = DISCONNECT) { 814} 815 816packet CreateConnectionCancel : ConnectionManagementCommand (op_code = CREATE_CONNECTION_CANCEL) { 817 bd_addr : Address, 818} 819 820packet CreateConnectionCancelComplete : CommandComplete (command_op_code = CREATE_CONNECTION_CANCEL) { 821 status : ErrorCode, 822 bd_addr : Address, 823} 824 825enum AcceptConnectionRequestRole : 8 { 826 BECOME_MASTER = 0x00, 827 REMAIN_SLAVE = 0x01, 828} 829 830packet AcceptConnectionRequest : ConnectionManagementCommand (op_code = ACCEPT_CONNECTION_REQUEST) { 831 bd_addr : Address, 832 role : AcceptConnectionRequestRole, 833} 834 835packet AcceptConnectionRequestStatus : CommandStatus (command_op_code = ACCEPT_CONNECTION_REQUEST) { 836} 837 838enum RejectConnectionReason : 8 { 839 LIMITED_RESOURCES = 0x0D, 840 SECURITY_REASONS = 0x0E, 841 UNACCEPTABLE_BD_ADDR = 0x0F, 842} 843 844packet RejectConnectionRequest : ConnectionManagementCommand (op_code = REJECT_CONNECTION_REQUEST) { 845 bd_addr : Address, 846 reason : RejectConnectionReason, 847} 848 849packet RejectConnectionRequestStatus : CommandStatus (command_op_code = REJECT_CONNECTION_REQUEST) { 850} 851 852packet LinkKeyRequestReply : SecurityCommand (op_code = LINK_KEY_REQUEST_REPLY) { 853 bd_addr : Address, 854 link_key : 8[16], 855} 856 857packet LinkKeyRequestReplyComplete : CommandComplete (command_op_code = LINK_KEY_REQUEST_REPLY) { 858 status : ErrorCode, 859} 860 861packet LinkKeyRequestNegativeReply : SecurityCommand (op_code = LINK_KEY_REQUEST_NEGATIVE_REPLY) { 862 bd_addr : Address, 863} 864 865packet LinkKeyRequestNegativeReplyComplete : CommandComplete (command_op_code = LINK_KEY_REQUEST_NEGATIVE_REPLY) { 866 status : ErrorCode, 867 bd_addr : Address, 868} 869 870packet PinCodeRequestReply : SecurityCommand (op_code = PIN_CODE_REQUEST_REPLY) { 871 bd_addr : Address, 872 pin_code_length : 5, // 0x01 - 0x10 873 _reserved_ : 3, 874 pin_code : 8[16], // string parameter, first octet first 875} 876 877packet PinCodeRequestReplyComplete : CommandComplete (command_op_code = PIN_CODE_REQUEST_REPLY) { 878 status : ErrorCode, 879 bd_addr : Address, 880} 881 882packet PinCodeRequestNegativeReply : SecurityCommand (op_code = PIN_CODE_REQUEST_NEGATIVE_REPLY) { 883 bd_addr : Address, 884} 885 886packet PinCodeRequestNegativeReplyComplete : CommandComplete (command_op_code = PIN_CODE_REQUEST_NEGATIVE_REPLY) { 887 status : ErrorCode, 888 bd_addr : Address, 889} 890 891packet ChangeConnectionPacketType : ConnectionManagementCommand (op_code = CHANGE_CONNECTION_PACKET_TYPE) { 892 connection_handle : 12, 893 _reserved_ : 4, 894 packet_type : 16, 895} 896 897packet ChangeConnectionPacketTypeStatus : CommandStatus (command_op_code = CHANGE_CONNECTION_PACKET_TYPE) { 898} 899 900packet AuthenticationRequested : ConnectionManagementCommand (op_code = AUTHENTICATION_REQUESTED) { 901 connection_handle : 12, 902 _reserved_ : 4, 903} 904 905packet AuthenticationRequestedStatus : CommandStatus (command_op_code = AUTHENTICATION_REQUESTED) { 906} 907 908packet SetConnectionEncryption : ConnectionManagementCommand (op_code = SET_CONNECTION_ENCRYPTION) { 909 connection_handle : 12, 910 _reserved_ : 4, 911 encryption_enable : Enable, 912} 913 914packet SetConnectionEncryptionStatus : CommandStatus (command_op_code = SET_CONNECTION_ENCRYPTION) { 915} 916 917packet ChangeConnectionLinkKey : ConnectionManagementCommand (op_code = CHANGE_CONNECTION_LINK_KEY) { 918 connection_handle : 12, 919 _reserved_ : 4, 920} 921 922packet ChangeConnectionLinkKeyStatus : CommandStatus (command_op_code = CHANGE_CONNECTION_LINK_KEY) { 923} 924 925enum KeyFlag : 8 { 926 SEMI_PERMANENT = 0x00, 927 TEMPORARY = 0x01, 928} 929 930packet MasterLinkKey : ConnectionManagementCommand (op_code = MASTER_LINK_KEY) { 931 key_flag : KeyFlag, 932} 933 934packet MasterLinkKeyStatus : CommandStatus (command_op_code = MASTER_LINK_KEY) { 935} 936 937packet RemoteNameRequest : DiscoveryCommand (op_code = REMOTE_NAME_REQUEST) { 938 bd_addr : Address, 939 page_scan_repetition_mode : PageScanRepetitionMode, 940 _reserved_ : 8, 941 clock_offset : 15, 942 clock_offset_valid : ClockOffsetValid, 943} 944 945packet RemoteNameRequestStatus : CommandStatus (command_op_code = REMOTE_NAME_REQUEST) { 946} 947 948packet RemoteNameRequestCancel : DiscoveryCommand (op_code = REMOTE_NAME_REQUEST_CANCEL) { 949 bd_addr : Address, 950} 951 952packet RemoteNameRequestCancelComplete : CommandComplete (command_op_code = REMOTE_NAME_REQUEST_CANCEL) { 953 status : ErrorCode, 954 bd_addr : Address, 955} 956 957packet ReadRemoteSupportedFeatures : DiscoveryCommand (op_code = READ_REMOTE_SUPPORTED_FEATURES) { 958 connection_handle : 12, 959 _reserved_ : 4, 960} 961 962packet ReadRemoteSupportedFeaturesStatus : CommandStatus (command_op_code = READ_REMOTE_SUPPORTED_FEATURES) { 963} 964 965packet ReadRemoteExtendedFeatures : DiscoveryCommand (op_code = READ_REMOTE_EXTENDED_FEATURES) { 966 connection_handle : 12, 967 _reserved_ : 4, 968 page_number : 8, 969} 970 971packet ReadRemoteExtendedFeaturesStatus : CommandStatus (command_op_code = READ_REMOTE_EXTENDED_FEATURES) { 972} 973 974packet ReadRemoteVersionInformation : DiscoveryCommand (op_code = READ_REMOTE_VERSION_INFORMATION) { 975 connection_handle : 12, 976 _reserved_ : 4, 977} 978 979packet ReadRemoteVersionInformationStatus : CommandStatus (command_op_code = READ_REMOTE_VERSION_INFORMATION) { 980} 981 982packet ReadClockOffset : ConnectionManagementCommand (op_code = READ_CLOCK_OFFSET) { 983 connection_handle : 12, 984 _reserved_ : 4, 985} 986 987packet ReadClockOffsetStatus : CommandStatus (command_op_code = READ_CLOCK_OFFSET) { 988} 989 990packet ReadLmpHandle : ConnectionManagementCommand (op_code = READ_LMP_HANDLE) { 991 connection_handle : 12, 992 _reserved_ : 4, 993} 994 995packet ReadLmpHandleComplete : CommandComplete (command_op_code = READ_LMP_HANDLE) { 996 status : ErrorCode, 997 connection_handle : 12, 998 _reserved_ : 4, 999 lmp_handle : 8, 1000 _reserved_ : 32, 1001} 1002 1003packet SetupSynchronousConnection : ScoConnectionCommand (op_code = SETUP_SYNCHRONOUS_CONNECTION) { 1004 _payload_, // placeholder (unimplemented) 1005} 1006 1007packet AcceptSynchronousConnection : ScoConnectionCommand (op_code = ACCEPT_SYNCHRONOUS_CONNECTION) { 1008 _payload_, // placeholder (unimplemented) 1009} 1010 1011packet RejectSynchronousConnection : ScoConnectionCommand (op_code = REJECT_SYNCHRONOUS_CONNECTION) { 1012 _payload_, // placeholder (unimplemented) 1013} 1014 1015enum IoCapability : 8 { 1016 DISPLAY_ONLY = 0x00, 1017 DISPLAY_YES_NO = 0x01, 1018 KEYBOARD_ONLY = 0x02, 1019 NO_INPUT_NO_OUTPUT = 0x03, 1020} 1021 1022enum OobDataPresent : 8 { 1023 NOT_PRESENT = 0x00, 1024 P_192_PRESENT = 0x01, 1025 P_256_PRESENT = 0x02, 1026 P_192_AND_256_PRESENT = 0x03, 1027} 1028 1029enum AuthenticationRequirements : 8 { 1030 NO_BONDING = 0x00, 1031 NO_BONDING_MITM_PROTECTION = 0x01, 1032 DEDICATED_BONDING = 0x02, 1033 DEDICATED_BONDING_MITM_PROTECTION = 0x03, 1034 GENERAL_BONDING = 0x04, 1035 GENERAL_BONDING_MITM_PROTECTION = 0x05, 1036} 1037 1038packet IoCapabilityRequestReply : SecurityCommand (op_code = IO_CAPABILITY_REQUEST_REPLY) { 1039 bd_addr : Address, 1040 io_capability : IoCapability, 1041 oob_present : OobDataPresent, 1042 authentication_requirements : AuthenticationRequirements, 1043} 1044 1045packet IoCapabilityRequestReplyComplete : CommandComplete (command_op_code = IO_CAPABILITY_REQUEST_REPLY) { 1046 status : ErrorCode, 1047 bd_addr : Address, 1048} 1049 1050packet UserConfirmationRequestReply : SecurityCommand (op_code = USER_CONFIRMATION_REQUEST_REPLY) { 1051 bd_addr : Address, 1052} 1053 1054packet UserConfirmationRequestReplyComplete : CommandComplete (command_op_code = USER_CONFIRMATION_REQUEST_REPLY) { 1055 status : ErrorCode, 1056 bd_addr : Address, 1057} 1058 1059packet UserConfirmationRequestNegativeReply : SecurityCommand (op_code = USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY) { 1060 bd_addr : Address, 1061} 1062 1063packet UserConfirmationRequestNegativeReplyComplete : CommandComplete (command_op_code = USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY) { 1064 status : ErrorCode, 1065 bd_addr : Address, 1066} 1067 1068packet UserPasskeyRequestReply : SecurityCommand (op_code = USER_PASSKEY_REQUEST_REPLY) { 1069 bd_addr : Address, 1070 numeric_value : 32, // 000000-999999 decimal or 0x0-0xF423F 1071} 1072 1073packet UserPasskeyRequestReplyComplete : CommandComplete (command_op_code = USER_PASSKEY_REQUEST_REPLY) { 1074 status : ErrorCode, 1075 bd_addr : Address, 1076} 1077 1078packet UserPasskeyRequestNegativeReply : SecurityCommand (op_code = USER_PASSKEY_REQUEST_NEGATIVE_REPLY) { 1079 bd_addr : Address, 1080} 1081 1082packet UserPasskeyRequestNegativeReplyComplete : CommandComplete (command_op_code = USER_PASSKEY_REQUEST_NEGATIVE_REPLY) { 1083 status : ErrorCode, 1084 bd_addr : Address, 1085} 1086 1087packet RemoteOobDataRequestReply : SecurityCommand (op_code = REMOTE_OOB_DATA_REQUEST_REPLY) { 1088 bd_addr : Address, 1089 c : 8[16], 1090 r : 8[16], 1091} 1092 1093packet RemoteOobDataRequestReplyComplete : CommandComplete (command_op_code = REMOTE_OOB_DATA_REQUEST_REPLY) { 1094 status : ErrorCode, 1095 bd_addr : Address, 1096} 1097 1098packet RemoteOobDataRequestNegativeReply : SecurityCommand (op_code = REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY) { 1099 bd_addr : Address, 1100} 1101 1102packet RemoteOobDataRequestNegativeReplyComplete : CommandComplete (command_op_code = REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY) { 1103 status : ErrorCode, 1104 bd_addr : Address, 1105} 1106 1107packet IoCapabilityRequestNegativeReply : SecurityCommand (op_code = IO_CAPABILITY_REQUEST_NEGATIVE_REPLY) { 1108 bd_addr : Address, 1109 reason : ErrorCode, 1110} 1111 1112packet IoCapabilityRequestNegativeReplyComplete : CommandComplete (command_op_code = IO_CAPABILITY_REQUEST_NEGATIVE_REPLY) { 1113 status : ErrorCode, 1114 bd_addr : Address, 1115} 1116 1117packet EnhancedSetupSynchronousConnection : ScoConnectionCommand (op_code = ENHANCED_SETUP_SYNCHRONOUS_CONNECTION) { 1118 _payload_, // placeholder (unimplemented) 1119} 1120 1121packet EnhancedAcceptSynchronousConnection : ScoConnectionCommand (op_code = ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION) { 1122 _payload_, // placeholder (unimplemented) 1123} 1124 1125 1126 // LINK_POLICY 1127packet HoldMode : ConnectionManagementCommand (op_code = HOLD_MODE) { 1128 connection_handle : 12, 1129 _reserved_ : 4, 1130 hold_mode_max_interval: 16, // 0x0002-0xFFFE (1.25ms-40.9s) 1131 hold_mode_min_interval: 16, // 0x0002-0xFFFE (1.25ms-40.9s) 1132} 1133 1134packet HoldModeStatus : CommandStatus (command_op_code = HOLD_MODE) { 1135} 1136 1137 1138packet SniffMode : ConnectionManagementCommand (op_code = SNIFF_MODE) { 1139 connection_handle : 12, 1140 _reserved_ : 4, 1141 sniff_max_interval: 16, // 0x0002-0xFFFE (1.25ms-40.9s) 1142 sniff_min_interval: 16, // 0x0002-0xFFFE (1.25ms-40.9s) 1143 sniff_attempt: 16, // 0x0001-0x7FFF (1.25ms-40.9s) 1144 sniff_timeout: 16, // 0x0000-0x7FFF (0ms-40.9s) 1145} 1146 1147packet SniffModeStatus : CommandStatus (command_op_code = SNIFF_MODE) { 1148} 1149 1150 1151packet ExitSniffMode : ConnectionManagementCommand (op_code = EXIT_SNIFF_MODE) { 1152 connection_handle : 12, 1153 _reserved_ : 4, 1154} 1155 1156packet ExitSniffModeStatus : CommandStatus (command_op_code = EXIT_SNIFF_MODE) { 1157} 1158 1159enum ServiceType : 8 { 1160 NO_TRAFFIC = 0x00, 1161 BEST_EFFORT = 0x01, 1162 GUARANTEED = 0x02, 1163} 1164 1165packet QosSetup : ConnectionManagementCommand (op_code = QOS_SETUP) { 1166 connection_handle : 12, 1167 _reserved_ : 4, 1168 _reserved_ : 8, 1169 service_type : ServiceType, 1170 token_rate : 32, // Octets/s 1171 peak_bandwidth : 32, // Octets/s 1172 latency : 32, // Octets/s 1173 delay_variation : 32, // microseconds 1174} 1175 1176packet QosSetupStatus : CommandStatus (command_op_code = QOS_SETUP) { 1177} 1178 1179packet RoleDiscovery : ConnectionManagementCommand (op_code = ROLE_DISCOVERY) { 1180 connection_handle : 12, 1181 _reserved_ : 4, 1182} 1183 1184enum Role : 8 { 1185 MASTER = 0x00, 1186 SLAVE = 0x01, 1187} 1188 1189packet RoleDiscoveryComplete : CommandComplete (command_op_code = ROLE_DISCOVERY) { 1190 status : ErrorCode, 1191 connection_handle : 12, 1192 _reserved_ : 4, 1193 current_role : Role, 1194} 1195 1196packet SwitchRole : ConnectionManagementCommand (op_code = SWITCH_ROLE) { 1197 bd_addr : Address, 1198 role : Role, 1199} 1200 1201packet SwitchRoleStatus : CommandStatus (command_op_code = SWITCH_ROLE) { 1202} 1203 1204 1205packet ReadLinkPolicySettings : ConnectionManagementCommand (op_code = READ_LINK_POLICY_SETTINGS) { 1206 connection_handle : 12, 1207 _reserved_ : 4, 1208} 1209 1210enum LinkPolicy : 16 { 1211 ENABLE_ROLE_SWITCH = 0x01, 1212 ENABLE_HOLD_MODE = 0x02, 1213 ENABLE_SNIFF_MODE = 0x04, 1214 ENABLE_PARK_MODE = 0x08, // deprecated after 5.0 1215} 1216 1217packet ReadLinkPolicySettingsComplete : CommandComplete (command_op_code = READ_LINK_POLICY_SETTINGS) { 1218 status : ErrorCode, 1219 connection_handle : 12, 1220 _reserved_ : 4, 1221 link_policy_settings : 16, 1222} 1223 1224packet WriteLinkPolicySettings : ConnectionManagementCommand (op_code = WRITE_LINK_POLICY_SETTINGS) { 1225 connection_handle : 12, 1226 _reserved_ : 4, 1227 link_policy_settings : 16, 1228} 1229 1230packet WriteLinkPolicySettingsComplete : CommandComplete (command_op_code = WRITE_LINK_POLICY_SETTINGS) { 1231 status : ErrorCode, 1232 connection_handle : 12, 1233 _reserved_ : 4, 1234} 1235 1236packet ReadDefaultLinkPolicySettings : ConnectionManagementCommand (op_code = READ_DEFAULT_LINK_POLICY_SETTINGS) { 1237} 1238 1239packet ReadDefaultLinkPolicySettingsComplete : CommandComplete (command_op_code = READ_DEFAULT_LINK_POLICY_SETTINGS) { 1240 status : ErrorCode, 1241 default_link_policy_settings : 16, 1242} 1243 1244packet WriteDefaultLinkPolicySettings : ConnectionManagementCommand (op_code = WRITE_DEFAULT_LINK_POLICY_SETTINGS) { 1245 default_link_policy_settings : 16, 1246} 1247 1248packet WriteDefaultLinkPolicySettingsComplete : CommandComplete (command_op_code = WRITE_DEFAULT_LINK_POLICY_SETTINGS) { 1249 status : ErrorCode, 1250} 1251 1252enum FlowDirection : 8 { 1253 OUTGOING_FLOW = 0x00, 1254 INCOMING_FLOW = 0x01, 1255} 1256 1257packet FlowSpecification : ConnectionManagementCommand (op_code = FLOW_SPECIFICATION) { 1258 connection_handle : 12, 1259 _reserved_ : 4, 1260 _reserved_ : 8, 1261 flow_direction : FlowDirection, 1262 service_type : ServiceType, 1263 token_rate : 32, // Octets/s 1264 token_bucket_size : 32, 1265 peak_bandwidth : 32, // Octets/s 1266 access_latency : 32, // Octets/s 1267} 1268 1269packet FlowSpecificationStatus : CommandStatus (command_op_code = FLOW_SPECIFICATION) { 1270} 1271 1272packet SniffSubrating : ConnectionManagementCommand (op_code = SNIFF_SUBRATING) { 1273 connection_handle : 12, 1274 _reserved_ : 4, 1275 maximum_latency : 16, // 0x0002-0xFFFE (1.25ms-40.9s) 1276 minimum_remote_timeout : 16, // 0x0000-0xFFFE (0-40.9s) 1277 minimum_local_timeout: 16, // 0x0000-0xFFFE (0-40.9s) 1278} 1279 1280packet SniffSubratingComplete : CommandComplete (command_op_code = SNIFF_SUBRATING) { 1281 status : ErrorCode, 1282 connection_handle : 12, 1283 _reserved_ : 4, 1284} 1285 1286 // CONTROLLER_AND_BASEBAND 1287packet SetEventMask : CommandPacket (op_code = SET_EVENT_MASK) { 1288 event_mask : 64, 1289} 1290 1291packet SetEventMaskComplete : CommandComplete (command_op_code = SET_EVENT_MASK) { 1292 status : ErrorCode, 1293} 1294 1295packet Reset : CommandPacket (op_code = RESET) { 1296} 1297 1298packet ResetComplete : CommandComplete (command_op_code = RESET) { 1299 status : ErrorCode, 1300} 1301 1302enum FilterType : 8 { 1303 CLEAR_ALL_FILTERS = 0x00, 1304 INQUIRY_RESULT = 0x01, 1305 CONNECTION_SETUP = 0x02, 1306} 1307 1308packet SetEventFilter : CommandPacket (op_code = SET_EVENT_FILTER) { 1309 filter_type : FilterType, 1310 _body_, 1311} 1312 1313packet SetEventFilterComplete : CommandComplete (command_op_code = SET_EVENT_FILTER) { 1314 status : ErrorCode, 1315} 1316 1317packet SetEventFilterClearAll : SetEventFilter (filter_type = CLEAR_ALL_FILTERS) { 1318} 1319 1320enum FilterConditionType : 8 { 1321 ALL_DEVICES = 0x00, 1322 CLASS_OF_DEVICE = 0x01, 1323 ADDRESS = 0x02, 1324} 1325 1326packet SetEventFilterInquiryResult : SetEventFilter (filter_type = INQUIRY_RESULT) { 1327 filter_condition_type : FilterConditionType, 1328 _body_, 1329} 1330 1331packet SetEventFilterInquiryResultAllDevices : SetEventFilterInquiryResult (filter_condition_type = ALL_DEVICES) { 1332} 1333 1334packet SetEventFilterInquiryResultClassOfDevice : SetEventFilterInquiryResult (filter_condition_type = CLASS_OF_DEVICE) { 1335 class_of_device : ClassOfDevice, 1336 class_of_device_mask : ClassOfDevice, 1337} 1338 1339packet SetEventFilterInquiryResultAddress : SetEventFilterInquiryResult (filter_condition_type = ADDRESS) { 1340 address : Address, 1341} 1342 1343packet SetEventFilterConnectionSetup : SetEventFilter (filter_type = CONNECTION_SETUP) { 1344 filter_condition_type : FilterConditionType, 1345 _body_, 1346} 1347 1348enum AutoAcceptFlag : 8 { 1349 AUTO_ACCEPT_OFF = 0x01, 1350 AUTO_ACCEPT_ON_ROLE_SWITCH_DISABLED = 0x02, 1351 AUTO_ACCEPT_ON_ROLE_SWITCH_ENABLED = 0x03, 1352} 1353 1354packet SetEventFilterConnectionSetupAllDevices : SetEventFilterConnectionSetup (filter_condition_type = ALL_DEVICES) { 1355 auto_accept_flag : AutoAcceptFlag, 1356} 1357 1358packet SetEventFilterConnectionSetupClassOfDevice : SetEventFilterConnectionSetup (filter_condition_type = CLASS_OF_DEVICE) { 1359 class_of_device : ClassOfDevice, 1360 class_of_device_mask : ClassOfDevice, 1361 auto_accept_flag : AutoAcceptFlag, 1362} 1363 1364packet SetEventFilterConnectionSetupAddress : SetEventFilterConnectionSetup (filter_condition_type = ADDRESS) { 1365 address : Address, 1366 auto_accept_flag : AutoAcceptFlag, 1367} 1368 1369packet Flush : ConnectionManagementCommand (op_code = FLUSH) { 1370 connection_handle : 12, 1371 _reserved_ : 4, 1372} 1373 1374packet FlushComplete : CommandComplete (command_op_code = FLUSH) { 1375 status : ErrorCode, 1376 connection_handle : 12, 1377 _reserved_ : 4, 1378} 1379 1380enum PinType : 8 { 1381 VARIABLE = 0, 1382 FIXED = 1, 1383} 1384 1385packet ReadPinType : CommandPacket (op_code = READ_PIN_TYPE) { 1386} 1387 1388packet ReadPinTypeComplete : CommandComplete (command_op_code = READ_PIN_TYPE) { 1389 status : ErrorCode, 1390 pin_type : PinType, 1391} 1392 1393packet WritePinType : CommandPacket (op_code = WRITE_PIN_TYPE) { 1394 pin_type : PinType, 1395} 1396 1397packet WritePinTypeComplete : CommandComplete (command_op_code = WRITE_PIN_TYPE) { 1398 status : ErrorCode, 1399} 1400 1401packet CreateNewUnitKey : CommandPacket (op_code = CREATE_NEW_UNIT_KEY) { 1402 _payload_, // placeholder (unimplemented) 1403} 1404 1405enum ReadStoredLinkKeyReadAllFlag : 8 { 1406 SPECIFIED_BD_ADDR = 0x00, 1407 ALL = 0x01, 1408} 1409 1410packet ReadStoredLinkKey : SecurityCommand (op_code = READ_STORED_LINK_KEY) { 1411 bd_addr : Address, 1412 read_all_flag : ReadStoredLinkKeyReadAllFlag, 1413} 1414 1415packet ReadStoredLinkKeyComplete : CommandComplete (command_op_code = READ_STORED_LINK_KEY) { 1416 status : ErrorCode, 1417 max_num_keys : 16, 1418 num_keys_read : 16, 1419} 1420 1421struct KeyAndAddress { 1422 address : Address, 1423 link_key : 8[16], 1424} 1425 1426packet WriteStoredLinkKey : SecurityCommand (op_code = WRITE_STORED_LINK_KEY) { 1427 _count_(keys_to_write) : 8, // 0x01-0x0B 1428 keys_to_write : KeyAndAddress[], 1429} 1430 1431packet WriteStoredLinkKeyComplete : CommandComplete (command_op_code = WRITE_STORED_LINK_KEY) { 1432 status : ErrorCode, 1433 num_keys_written : 8, 1434} 1435 1436enum DeleteStoredLinkKeyDeleteAllFlag : 8 { 1437 SPECIFIED_BD_ADDR = 0x00, 1438 ALL = 0x01, 1439} 1440 1441packet DeleteStoredLinkKey : SecurityCommand (op_code = DELETE_STORED_LINK_KEY) { 1442 bd_addr : Address, 1443 delete_all_flag : DeleteStoredLinkKeyDeleteAllFlag, 1444} 1445 1446packet DeleteStoredLinkKeyComplete : CommandComplete (command_op_code = DELETE_STORED_LINK_KEY) { 1447 status : ErrorCode, 1448 num_keys_deleted : 16, 1449} 1450 1451packet WriteLocalName : CommandPacket (op_code = WRITE_LOCAL_NAME) { 1452 local_name : 8[248], // Null-terminated UTF-8 encoded name 1453} 1454 1455packet WriteLocalNameComplete : CommandComplete (command_op_code = WRITE_LOCAL_NAME) { 1456 status : ErrorCode, 1457} 1458 1459packet ReadLocalName : CommandPacket (op_code = READ_LOCAL_NAME) { 1460} 1461 1462packet ReadLocalNameComplete : CommandComplete (command_op_code = READ_LOCAL_NAME) { 1463 status : ErrorCode, 1464 local_name : 8[248], // Null-terminated UTF-8 encoded name 1465} 1466 1467packet ReadConnectionAcceptTimeout : ConnectionManagementCommand (op_code = READ_CONNECTION_ACCEPT_TIMEOUT) { 1468} 1469 1470packet ReadConnectionAcceptTimeoutComplete : CommandComplete (command_op_code = READ_CONNECTION_ACCEPT_TIMEOUT) { 1471 status : ErrorCode, 1472 conn_accept_timeout : 16, // 0x0001 to 0xB540 (N * 0.625 ms) 0.625 ms to 29 s 1473} 1474 1475packet WriteConnectionAcceptTimeout : ConnectionManagementCommand (op_code = WRITE_CONNECTION_ACCEPT_TIMEOUT) { 1476 conn_accept_timeout : 16, // 0x0001 to 0xB540 (N * 0.625 ms) 0.625 ms to 29 s, Default 0x1FA0, 5.06s 1477} 1478 1479packet WriteConnectionAcceptTimeoutComplete : CommandComplete (command_op_code = WRITE_CONNECTION_ACCEPT_TIMEOUT) { 1480 status : ErrorCode, 1481} 1482 1483packet ReadPageTimeout : DiscoveryCommand (op_code = READ_PAGE_TIMEOUT) { 1484} 1485 1486packet ReadPageTimeoutComplete : CommandComplete (command_op_code = READ_PAGE_TIMEOUT) { 1487 status : ErrorCode, 1488 page_timeout : 16, 1489} 1490 1491packet WritePageTimeout : DiscoveryCommand (op_code = WRITE_PAGE_TIMEOUT) { 1492 page_timeout : 16, 1493} 1494 1495packet WritePageTimeoutComplete : CommandComplete (command_op_code = WRITE_PAGE_TIMEOUT) { 1496 status : ErrorCode, 1497} 1498 1499enum ScanEnable : 8 { 1500 NO_SCANS = 0x00, 1501 INQUIRY_SCAN_ONLY = 0x01, 1502 PAGE_SCAN_ONLY = 0x02, 1503 INQUIRY_AND_PAGE_SCAN = 0x03, 1504} 1505 1506packet ReadScanEnable : DiscoveryCommand (op_code = READ_SCAN_ENABLE) { 1507} 1508 1509packet ReadScanEnableComplete : CommandComplete (command_op_code = READ_SCAN_ENABLE) { 1510 status : ErrorCode, 1511 scan_enable : ScanEnable, 1512} 1513 1514packet WriteScanEnable : DiscoveryCommand (op_code = WRITE_SCAN_ENABLE) { 1515 scan_enable : ScanEnable, 1516} 1517 1518packet WriteScanEnableComplete : CommandComplete (command_op_code = WRITE_SCAN_ENABLE) { 1519 status : ErrorCode, 1520} 1521 1522packet ReadPageScanActivity : DiscoveryCommand (op_code = READ_PAGE_SCAN_ACTIVITY) { 1523} 1524 1525packet ReadPageScanActivityComplete : CommandComplete (command_op_code = READ_PAGE_SCAN_ACTIVITY) { 1526 status : ErrorCode, 1527 page_scan_interval : 16, // Range: 0x0012 to 0x1000; only even values are valid * 0x625 ms 1528 page_scan_window : 16, // 0x0011 to PageScanInterval 1529} 1530 1531packet WritePageScanActivity : DiscoveryCommand (op_code = WRITE_PAGE_SCAN_ACTIVITY) { 1532 page_scan_interval : 16, // Range: 0x0012 to 0x1000; only even values are valid * 0x625 ms 1533 page_scan_window : 16, // 0x0011 to PageScanInterval 1534} 1535 1536packet WritePageScanActivityComplete : CommandComplete (command_op_code = WRITE_PAGE_SCAN_ACTIVITY) { 1537 status : ErrorCode, 1538} 1539 1540packet ReadInquiryScanActivity : DiscoveryCommand (op_code = READ_INQUIRY_SCAN_ACTIVITY) { 1541} 1542 1543packet ReadInquiryScanActivityComplete : CommandComplete (command_op_code = READ_INQUIRY_SCAN_ACTIVITY) { 1544 status : ErrorCode, 1545 inquiry_scan_interval : 16, // Range: 0x0012 to 0x1000; only even values are valid * 0x625 ms 1546 inquiry_scan_window : 16, // Range: 0x0011 to 0x1000 1547} 1548 1549packet WriteInquiryScanActivity : DiscoveryCommand (op_code = WRITE_INQUIRY_SCAN_ACTIVITY) { 1550 inquiry_scan_interval : 16, // Range: 0x0012 to 0x1000; only even values are valid * 0x625 ms 1551 inquiry_scan_window : 16, // Range: 0x0011 to 0x1000 1552} 1553 1554packet WriteInquiryScanActivityComplete : CommandComplete (command_op_code = WRITE_INQUIRY_SCAN_ACTIVITY) { 1555 status : ErrorCode, 1556} 1557 1558enum AuthenticationEnable : 8 { 1559 NOT_REQUIRED = 0x00, 1560 REQUIRED = 0x01, 1561} 1562 1563packet ReadAuthenticationEnable : CommandPacket (op_code = READ_AUTHENTICATION_ENABLE) { 1564} 1565 1566packet ReadAuthenticationEnableComplete : CommandComplete (command_op_code = READ_AUTHENTICATION_ENABLE) { 1567 status : ErrorCode, 1568 authentication_enable : AuthenticationEnable, 1569} 1570 1571packet WriteAuthenticationEnable : SecurityCommand (op_code = WRITE_AUTHENTICATION_ENABLE) { 1572 authentication_enable : AuthenticationEnable, 1573} 1574 1575packet WriteAuthenticationEnableComplete : CommandComplete (command_op_code = WRITE_AUTHENTICATION_ENABLE) { 1576 status : ErrorCode, 1577} 1578 1579packet ReadClassOfDevice : DiscoveryCommand (op_code = READ_CLASS_OF_DEVICE) { 1580} 1581 1582packet ReadClassOfDeviceComplete : CommandComplete (command_op_code = READ_CLASS_OF_DEVICE) { 1583 status : ErrorCode, 1584 class_of_device : ClassOfDevice, 1585} 1586 1587packet WriteClassOfDevice : DiscoveryCommand (op_code = WRITE_CLASS_OF_DEVICE) { 1588 class_of_device : ClassOfDevice, 1589} 1590 1591packet WriteClassOfDeviceComplete : CommandComplete (command_op_code = WRITE_CLASS_OF_DEVICE) { 1592 status : ErrorCode, 1593} 1594 1595packet ReadVoiceSetting : CommandPacket (op_code = READ_VOICE_SETTING) { 1596 _payload_, // placeholder (unimplemented) 1597} 1598 1599packet WriteVoiceSetting : CommandPacket (op_code = WRITE_VOICE_SETTING) { 1600 _payload_, // placeholder (unimplemented) 1601} 1602 1603packet WriteVoiceSettingComplete : CommandComplete (command_op_code = WRITE_VOICE_SETTING) { 1604 status : ErrorCode, 1605} 1606 1607packet ReadAutomaticFlushTimeout : ConnectionManagementCommand (op_code = READ_AUTOMATIC_FLUSH_TIMEOUT) { 1608 connection_handle : 12, 1609 _reserved_ : 4, 1610} 1611 1612packet ReadAutomaticFlushTimeoutComplete : CommandComplete (command_op_code = READ_AUTOMATIC_FLUSH_TIMEOUT) { 1613 status : ErrorCode, 1614 connection_handle : 12, 1615 _reserved_ : 4, 1616 flush_timeout : 16, 1617} 1618 1619packet WriteAutomaticFlushTimeout : ConnectionManagementCommand (op_code = WRITE_AUTOMATIC_FLUSH_TIMEOUT) { 1620 connection_handle : 12, 1621 _reserved_ : 4, 1622 flush_timeout : 16, // 0x0000-0x07FF Default 0x0000 (No Automatic Flush) 1623} 1624 1625packet WriteAutomaticFlushTimeoutComplete : CommandComplete (command_op_code = WRITE_AUTOMATIC_FLUSH_TIMEOUT) { 1626 status : ErrorCode, 1627 connection_handle : 12, 1628 _reserved_ : 4, 1629} 1630 1631packet ReadNumBroadcastRetransmits : CommandPacket (op_code = READ_NUM_BROADCAST_RETRANSMITS) { 1632 _payload_, // placeholder (unimplemented) 1633} 1634 1635packet WriteNumBroadcastRetransmits : CommandPacket (op_code = WRITE_NUM_BROADCAST_RETRANSMITS) { 1636 _payload_, // placeholder (unimplemented) 1637} 1638 1639packet ReadHoldModeActivity : CommandPacket (op_code = READ_HOLD_MODE_ACTIVITY) { 1640 _payload_, // placeholder (unimplemented) 1641} 1642 1643packet WriteHoldModeActivity : CommandPacket (op_code = WRITE_HOLD_MODE_ACTIVITY) { 1644 _payload_, // placeholder (unimplemented) 1645} 1646 1647 1648enum TransmitPowerLevelType : 8 { 1649 CURRENT = 0x00, 1650 MAXIMUM = 0x01, 1651} 1652 1653packet ReadTransmitPowerLevel : ConnectionManagementCommand (op_code = READ_TRANSMIT_POWER_LEVEL) { 1654 connection_handle : 12, 1655 _reserved_ : 4, 1656 type : TransmitPowerLevelType, 1657 1658} 1659 1660packet ReadTransmitPowerLevelComplete : CommandComplete (command_op_code = READ_TRANSMIT_POWER_LEVEL) { 1661 status : ErrorCode, 1662 connection_handle : 12, 1663 _reserved_ : 4, 1664 transmit_power_level : 8, 1665} 1666 1667packet ReadSynchronousFlowControlEnable : CommandPacket (op_code = READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE) { 1668 _payload_, // placeholder (unimplemented) 1669} 1670 1671packet WriteSynchronousFlowControlEnable : CommandPacket (op_code = WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE) { 1672 _payload_, // placeholder (unimplemented) 1673} 1674 1675packet SetControllerToHostFlowControl : CommandPacket (op_code = SET_CONTROLLER_TO_HOST_FLOW_CONTROL) { 1676 _payload_, // placeholder (unimplemented) 1677} 1678 1679packet HostBufferSize : CommandPacket (op_code = HOST_BUFFER_SIZE) { 1680 host_acl_data_packet_length : 16, 1681 host_synchronous_data_packet_length : 8, 1682 host_total_num_acl_data_packets : 16, 1683 host_total_num_synchronous_data_packets : 16, 1684} 1685 1686packet HostBufferSizeComplete : CommandComplete (command_op_code = HOST_BUFFER_SIZE) { 1687 status : ErrorCode, 1688} 1689 1690struct CompletedPackets { 1691 connection_handle : 12, 1692 _reserved_ : 4, 1693 host_num_of_completed_packets : 16, 1694} 1695 1696packet HostNumCompletedPackets : CommandPacket (op_code = HOST_NUM_COMPLETED_PACKETS) { 1697 _count_(completed_packets) : 8, 1698 completed_packets : CompletedPackets[], 1699} 1700 1701packet HostNumCompletedPacketsError : CommandComplete (command_op_code = HOST_NUM_COMPLETED_PACKETS) { 1702 error_code : ErrorCode, 1703} 1704 1705packet ReadLinkSupervisionTimeout : ConnectionManagementCommand (op_code = READ_LINK_SUPERVISION_TIMEOUT) { 1706 connection_handle : 12, 1707 _reserved_ : 4, 1708} 1709 1710packet ReadLinkSupervisionTimeoutComplete : CommandComplete (command_op_code = READ_LINK_SUPERVISION_TIMEOUT) { 1711 status : ErrorCode, 1712 connection_handle : 12, 1713 _reserved_ : 4, 1714 link_supervision_timeout : 16, // 0x001-0xFFFF (0.625ms-40.9s) 1715} 1716 1717packet WriteLinkSupervisionTimeout : ConnectionManagementCommand (op_code = WRITE_LINK_SUPERVISION_TIMEOUT) { 1718 handle : 12, 1719 _reserved_ : 4, 1720 link_supervision_timeout : 16, // 0x001-0xFFFF (0.625ms-40.9s) 1721} 1722 1723packet WriteLinkSupervisionTimeoutComplete : CommandComplete (command_op_code = WRITE_LINK_SUPERVISION_TIMEOUT) { 1724 status : ErrorCode, 1725 connection_handle : 12, 1726 _reserved_ : 4, 1727} 1728 1729packet ReadNumberOfSupportedIac : DiscoveryCommand (op_code = READ_NUMBER_OF_SUPPORTED_IAC) { 1730} 1731 1732packet ReadNumberOfSupportedIacComplete : CommandComplete (command_op_code = READ_NUMBER_OF_SUPPORTED_IAC) { 1733 status : ErrorCode, 1734 num_support_iac : 8, 1735} 1736 1737packet ReadCurrentIacLap : DiscoveryCommand (op_code = READ_CURRENT_IAC_LAP) { 1738} 1739 1740packet ReadCurrentIacLapComplete : CommandComplete (command_op_code = READ_CURRENT_IAC_LAP) { 1741 status : ErrorCode, 1742 _count_(laps_to_read) : 8, 1743 laps_to_read : Lap[], 1744} 1745 1746packet WriteCurrentIacLap : DiscoveryCommand (op_code = WRITE_CURRENT_IAC_LAP) { 1747 _count_(laps_to_write) : 8, 1748 laps_to_write : Lap[], 1749} 1750 1751packet WriteCurrentIacLapComplete : CommandComplete (command_op_code = WRITE_CURRENT_IAC_LAP) { 1752 status : ErrorCode, 1753} 1754 1755packet SetAfhHostChannelClassification : CommandPacket (op_code = SET_AFH_HOST_CHANNEL_CLASSIFICATION) { 1756 afh_host_channel_classification : 8[10], 1757} 1758 1759packet SetAfhHostChannelClassificationComplete : CommandComplete (command_op_code = SET_AFH_HOST_CHANNEL_CLASSIFICATION) { 1760 status : ErrorCode, 1761} 1762 1763enum InquiryScanType : 8 { 1764 STANDARD = 0x00, 1765 INTERLACED = 0x01, 1766} 1767 1768packet ReadInquiryScanType : DiscoveryCommand (op_code = READ_INQUIRY_SCAN_TYPE) { 1769} 1770 1771packet ReadInquiryScanTypeComplete : CommandComplete (command_op_code = READ_INQUIRY_SCAN_TYPE) { 1772 status : ErrorCode, 1773 inquiry_scan_type : InquiryScanType, 1774} 1775 1776packet WriteInquiryScanType : DiscoveryCommand (op_code = WRITE_INQUIRY_SCAN_TYPE) { 1777 inquiry_scan_type : InquiryScanType, 1778} 1779 1780packet WriteInquiryScanTypeComplete : CommandComplete (command_op_code = WRITE_INQUIRY_SCAN_TYPE) { 1781 status : ErrorCode, 1782} 1783 1784enum InquiryMode : 8 { 1785 STANDARD = 0x00, 1786 RSSI = 0x01, 1787 RSSI_OR_EXTENDED = 0x02, 1788} 1789 1790packet ReadInquiryMode : DiscoveryCommand (op_code = READ_INQUIRY_MODE) { 1791} 1792 1793packet ReadInquiryModeComplete : CommandComplete (command_op_code = READ_INQUIRY_MODE) { 1794 status : ErrorCode, 1795 inquiry_mode : InquiryMode, 1796} 1797 1798packet WriteInquiryMode : DiscoveryCommand (op_code = WRITE_INQUIRY_MODE) { 1799 inquiry_mode : InquiryMode, 1800} 1801 1802packet WriteInquiryModeComplete : CommandComplete (command_op_code = WRITE_INQUIRY_MODE) { 1803 status : ErrorCode, 1804} 1805 1806enum PageScanType : 8 { 1807 STANDARD = 0x00, 1808 INTERLACED = 0x01, 1809} 1810 1811packet ReadPageScanType : DiscoveryCommand (op_code = READ_PAGE_SCAN_TYPE) { 1812} 1813 1814packet ReadPageScanTypeComplete : CommandComplete (command_op_code = READ_PAGE_SCAN_TYPE) { 1815 status : ErrorCode, 1816 page_scan_type : PageScanType, 1817} 1818 1819packet WritePageScanType : DiscoveryCommand (op_code = WRITE_PAGE_SCAN_TYPE) { 1820 page_scan_type : PageScanType, 1821} 1822 1823packet WritePageScanTypeComplete : CommandComplete (command_op_code = WRITE_PAGE_SCAN_TYPE) { 1824 status : ErrorCode, 1825} 1826 1827packet ReadAfhChannelAssessmentMode : CommandPacket (op_code = READ_AFH_CHANNEL_ASSESSMENT_MODE) { 1828 _payload_, // placeholder (unimplemented) 1829} 1830 1831packet WriteAfhChannelAssessmentMode : CommandPacket (op_code = WRITE_AFH_CHANNEL_ASSESSMENT_MODE) { 1832 _payload_, // placeholder (unimplemented) 1833} 1834 1835enum FecRequired : 8 { 1836 NOT_REQUIRED = 0x00, 1837 REQUIRED = 0x01, 1838} 1839 1840packet ReadExtendedInquiryResponse : CommandPacket (op_code = READ_EXTENDED_INQUIRY_RESPONSE) { 1841} 1842 1843packet ReadExtendedInquiryResponseComplete : CommandComplete (command_op_code = READ_EXTENDED_INQUIRY_RESPONSE) { 1844 status : ErrorCode, 1845 fec_required : FecRequired, 1846 extended_inquiry_response : GapData[], 1847} 1848 1849packet WriteExtendedInquiryResponse : CommandPacket (op_code = WRITE_EXTENDED_INQUIRY_RESPONSE) { 1850 fec_required : FecRequired, 1851 extended_inquiry_response : GapData[], 1852 _padding_[244], // Zero padding to be 240 octets (GapData[]) + 2 (opcode) + 1 (size) + 1 (FecRequired) 1853} 1854 1855packet WriteExtendedInquiryResponseComplete : CommandComplete (command_op_code = WRITE_EXTENDED_INQUIRY_RESPONSE) { 1856 status : ErrorCode, 1857} 1858 1859packet RefreshEncryptionKey : SecurityCommand (op_code = REFRESH_ENCRYPTION_KEY) { 1860 connection_handle : 12, 1861 _reserved_ : 4, 1862} 1863 1864packet RefreshEncryptionKeyStatus : CommandStatus (command_op_code = REFRESH_ENCRYPTION_KEY) { 1865} 1866 1867packet ReadSimplePairingMode : SecurityCommand (op_code = READ_SIMPLE_PAIRING_MODE) { 1868} 1869 1870packet ReadSimplePairingModeComplete : CommandComplete (command_op_code = READ_SIMPLE_PAIRING_MODE) { 1871 status : ErrorCode, 1872 simple_pairing_mode : Enable, 1873} 1874 1875packet WriteSimplePairingMode : SecurityCommand (op_code = WRITE_SIMPLE_PAIRING_MODE) { 1876 simple_pairing_mode : Enable, 1877} 1878 1879packet WriteSimplePairingModeComplete : CommandComplete (command_op_code = WRITE_SIMPLE_PAIRING_MODE) { 1880 status : ErrorCode, 1881} 1882 1883packet ReadLocalOobData : SecurityCommand (op_code = READ_LOCAL_OOB_DATA) { 1884} 1885 1886packet ReadLocalOobDataComplete : CommandComplete (command_op_code = READ_LOCAL_OOB_DATA) { 1887 status : ErrorCode, 1888 c : 8[16], 1889 r : 8[16], 1890} 1891 1892packet ReadInquiryResponseTransmitPowerLevel : DiscoveryCommand (op_code = READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL) { 1893} 1894 1895packet ReadInquiryResponseTransmitPowerLevelComplete : CommandComplete (command_op_code = READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL) { 1896 status : ErrorCode, 1897 tx_power : 8, // (-70dBm to 20dBm) 1898} 1899 1900packet WriteInquiryTransmitPowerLevel : DiscoveryCommand (op_code = WRITE_INQUIRY_TRANSMIT_POWER_LEVEL) { 1901 tx_power : 8, 1902} 1903 1904packet WriteInquiryResponseTransmitPowerLevelComplete : CommandComplete (command_op_code = WRITE_INQUIRY_TRANSMIT_POWER_LEVEL) { 1905 status : ErrorCode, 1906} 1907 1908enum KeypressNotificationType : 8 { 1909 ENTRY_STARTED = 0, 1910 DIGIT_ENTERED = 1, 1911 DIGIT_ERASED = 2, 1912 CLEARED = 3, 1913 ENTRY_COMPLETED = 4, 1914} 1915 1916packet SendKeypressNotification : SecurityCommand (op_code = SEND_KEYPRESS_NOTIFICATION) { 1917 bd_addr : Address, 1918 notification_type : KeypressNotificationType, 1919} 1920 1921packet SendKeypressNotificationComplete : CommandComplete (command_op_code = SEND_KEYPRESS_NOTIFICATION) { 1922 status : ErrorCode, 1923 bd_addr : Address, 1924} 1925 1926enum SimultaneousLeHost : 8 { 1927 DISABLED = 0x00, 1928} 1929 1930packet ReadLeHostSupport : CommandPacket (op_code = READ_LE_HOST_SUPPORT) { 1931} 1932 1933packet ReadLeHostSupportComplete : CommandComplete (command_op_code = READ_LE_HOST_SUPPORT) { 1934 status : ErrorCode, 1935 le_supported_host : Enable, 1936 simultaneous_le_host : SimultaneousLeHost, 1937} 1938 1939packet WriteLeHostSupport : CommandPacket (op_code = WRITE_LE_HOST_SUPPORT) { 1940 le_supported_host : Enable, 1941 simultaneous_le_host : SimultaneousLeHost, 1942} 1943 1944packet WriteLeHostSupportComplete : CommandComplete (command_op_code = WRITE_LE_HOST_SUPPORT) { 1945 status : ErrorCode, 1946} 1947 1948packet ReadSecureConnectionsHostSupport : CommandPacket (op_code = READ_SECURE_CONNECTIONS_HOST_SUPPORT) { 1949} 1950 1951packet ReadSecureConnectionsHostSupportComplete : CommandComplete (command_op_code = READ_SECURE_CONNECTIONS_HOST_SUPPORT) { 1952 status : ErrorCode, 1953 secure_connections_host_support : Enable, 1954} 1955 1956packet WriteSecureConnectionsHostSupport : SecurityCommand (op_code = WRITE_SECURE_CONNECTIONS_HOST_SUPPORT) { 1957 secure_connections_host_support : Enable, 1958} 1959 1960packet WriteSecureConnectionsHostSupportComplete : CommandComplete (command_op_code = WRITE_SECURE_CONNECTIONS_HOST_SUPPORT) { 1961 status : ErrorCode, 1962} 1963 1964packet ReadLocalOobExtendedData : SecurityCommand (op_code = READ_LOCAL_OOB_EXTENDED_DATA) { 1965} 1966 1967packet ReadLocalOobExtendedDataComplete : CommandComplete (command_op_code = READ_LOCAL_OOB_EXTENDED_DATA) { 1968 status : ErrorCode, 1969 c_192 : 8[16], 1970 r_192 : 8[16], 1971 c_256 : 8[16], 1972 r_256 : 8[16], 1973} 1974 1975 1976 // INFORMATIONAL_PARAMETERS 1977packet ReadLocalVersionInformation : CommandPacket (op_code = READ_LOCAL_VERSION_INFORMATION) { 1978} 1979 1980enum HciVersion : 8 { 1981 V_1_0B = 0x00, 1982 V_1_1 = 0x01, 1983 V_1_2 = 0x02, 1984 V_2_0 = 0x03, // + EDR 1985 V_2_1 = 0x04, // + EDR 1986 V_3_0 = 0x05, // + HS 1987 V_4_0 = 0x06, 1988 V_4_1 = 0x07, 1989 V_4_2 = 0x08, 1990 V_5_0 = 0x09, 1991 V_5_1 = 0x0a, 1992} 1993 1994enum LmpVersion : 8 { 1995 V_1_0B = 0x00, // withdrawn 1996 V_1_1 = 0x01, // withdrawn 1997 V_1_2 = 0x02, // withdrawn 1998 V_2_0 = 0x03, // + EDR 1999 V_2_1 = 0x04, // + EDR 2000 V_3_0 = 0x05, // + HS 2001 V_4_0 = 0x06, 2002 V_4_1 = 0x07, 2003 V_4_2 = 0x08, 2004 V_5_0 = 0x09, 2005 V_5_1 = 0x0a, 2006} 2007 2008struct LocalVersionInformation { 2009 hci_version : HciVersion, 2010 hci_revision : 16, 2011 lmp_version : LmpVersion, 2012 manufacturer_name : 16, 2013 lmp_subversion : 16, 2014} 2015 2016packet ReadLocalVersionInformationComplete : CommandComplete (command_op_code = READ_LOCAL_VERSION_INFORMATION) { 2017 status : ErrorCode, 2018 local_version_information : LocalVersionInformation, 2019} 2020 2021packet ReadLocalSupportedCommands : CommandPacket (op_code = READ_LOCAL_SUPPORTED_COMMANDS) { 2022} 2023 2024packet ReadLocalSupportedCommandsComplete : CommandComplete (command_op_code = READ_LOCAL_SUPPORTED_COMMANDS) { 2025 status : ErrorCode, 2026 supported_commands : 8[64], 2027} 2028 2029packet ReadLocalSupportedFeatures : CommandPacket (op_code = READ_LOCAL_SUPPORTED_FEATURES) { 2030} 2031 2032packet ReadLocalSupportedFeaturesComplete : CommandComplete (command_op_code = READ_LOCAL_SUPPORTED_FEATURES) { 2033 status : ErrorCode, 2034 lmp_features : 64, 2035} 2036 2037packet ReadLocalExtendedFeatures : CommandPacket (op_code = READ_LOCAL_EXTENDED_FEATURES) { 2038 page_number : 8, 2039} 2040 2041packet ReadLocalExtendedFeaturesComplete : CommandComplete (command_op_code = READ_LOCAL_EXTENDED_FEATURES) { 2042 status : ErrorCode, 2043 page_number : 8, 2044 maximum_page_number : 8, 2045 extended_lmp_features : 64, 2046} 2047 2048packet ReadBufferSize : CommandPacket (op_code = READ_BUFFER_SIZE) { 2049} 2050 2051packet ReadBufferSizeComplete : CommandComplete (command_op_code = READ_BUFFER_SIZE) { 2052 status : ErrorCode, 2053 acl_data_packet_length : 16, 2054 synchronous_data_packet_length : 8, 2055 total_num_acl_data_packets : 16, 2056 total_num_synchronous_data_packets : 16, 2057} 2058 2059packet ReadBdAddr : CommandPacket (op_code = READ_BD_ADDR) { 2060} 2061 2062packet ReadBdAddrComplete : CommandComplete (command_op_code = READ_BD_ADDR) { 2063 status : ErrorCode, 2064 bd_addr : Address, 2065} 2066 2067packet ReadDataBlockSize : CommandPacket (op_code = READ_DATA_BLOCK_SIZE) { 2068} 2069 2070packet ReadLocalSupportedCodecs : CommandPacket (op_code = READ_LOCAL_SUPPORTED_CODECS) { 2071} 2072 2073packet ReadLocalSupportedCodecsComplete : CommandComplete (command_op_code = READ_LOCAL_SUPPORTED_CODECS) { 2074 status : ErrorCode, 2075 _size_(supported_codecs) : 8, 2076 supported_codecs : 8[], 2077 _size_(vendor_specific_codecs) : 8, 2078 vendor_specific_codecs : 32[], 2079} 2080 2081 // STATUS_PARAMETERS 2082packet ReadFailedContactCounter : ConnectionManagementCommand (op_code = READ_FAILED_CONTACT_COUNTER) { 2083 connection_handle : 12, 2084 _reserved_ : 4, 2085} 2086 2087packet ReadFailedContactCounterComplete : CommandComplete (command_op_code = READ_FAILED_CONTACT_COUNTER) { 2088 status : ErrorCode, 2089 connection_handle : 12, 2090 _reserved_ : 4, 2091 failed_contact_counter : 16, 2092} 2093 2094packet ResetFailedContactCounter : ConnectionManagementCommand (op_code = RESET_FAILED_CONTACT_COUNTER) { 2095 connection_handle : 12, 2096 _reserved_ : 4, 2097} 2098 2099packet ResetFailedContactCounterComplete : CommandComplete (command_op_code = RESET_FAILED_CONTACT_COUNTER) { 2100 status : ErrorCode, 2101 connection_handle : 12, 2102 _reserved_ : 4, 2103} 2104 2105packet ReadLinkQuality : ConnectionManagementCommand (op_code = READ_LINK_QUALITY) { 2106 connection_handle : 12, 2107 _reserved_ : 4, 2108} 2109 2110packet ReadLinkQualityComplete : CommandComplete (command_op_code = READ_LINK_QUALITY) { 2111 status : ErrorCode, 2112 connection_handle : 12, 2113 _reserved_ : 4, 2114 link_quality : 8, 2115} 2116 2117packet ReadRssi : ConnectionManagementCommand (op_code = READ_RSSI) { 2118 connection_handle : 12, 2119 _reserved_ : 4, 2120} 2121 2122packet ReadRssiComplete : CommandComplete (command_op_code = READ_RSSI) { 2123 status : ErrorCode, 2124 connection_handle : 12, 2125 _reserved_ : 4, 2126 rssi : 8, 2127} 2128 2129packet ReadAfhChannelMap : ConnectionManagementCommand (op_code = READ_AFH_CHANNEL_MAP) { 2130 connection_handle : 12, 2131 _reserved_ : 4, 2132} 2133 2134enum AfhMode : 8 { 2135 AFH_DISABLED = 0x00, 2136 AFH_ENABLED = 0x01, 2137} 2138 2139packet ReadAfhChannelMapComplete : CommandComplete (command_op_code = READ_AFH_CHANNEL_MAP) { 2140 status : ErrorCode, 2141 connection_handle : 12, 2142 _reserved_ : 4, 2143 afh_mode : AfhMode, 2144 afh_channel_map : 8[10], 2145} 2146 2147 2148enum WhichClock : 8 { 2149 LOCAL = 0x00, 2150 PICONET = 0x01, 2151} 2152 2153packet ReadClock : ConnectionManagementCommand (op_code = READ_CLOCK) { 2154 connection_handle : 12, 2155 _reserved_ : 4, 2156 which_clock : WhichClock, 2157} 2158 2159packet ReadClockComplete : CommandComplete (command_op_code = READ_CLOCK) { 2160 status : ErrorCode, 2161 connection_handle : 12, 2162 _reserved_ : 4, 2163 clock : 28, 2164 _reserved_ : 4, 2165 accuracy : 16, 2166} 2167 2168packet ReadEncryptionKeySize : SecurityCommand (op_code = READ_ENCRYPTION_KEY_SIZE) { 2169 connection_handle : 12, 2170 _reserved_ : 4, 2171} 2172 2173packet ReadEncryptionKeySizeComplete : CommandComplete (command_op_code = READ_ENCRYPTION_KEY_SIZE) { 2174 status : ErrorCode, 2175 connection_handle : 12, 2176 _reserved_ : 4, 2177 key_size : 8, 2178} 2179 2180 // TESTING 2181enum LoopbackMode : 8 { 2182 NO_LOOPBACK = 0x00, 2183 ENABLE_LOCAL = 0x01, 2184 ENABLE_REMOTE = 0x02, 2185} 2186 2187packet ReadLoopbackMode : CommandPacket (op_code = READ_LOOPBACK_MODE) { 2188} 2189 2190packet ReadLoopbackModeComplete : CommandComplete (command_op_code = READ_LOOPBACK_MODE) { 2191 status : ErrorCode, 2192 loopback_mode : LoopbackMode, 2193} 2194 2195packet WriteLoopbackMode : CommandPacket (op_code = WRITE_LOOPBACK_MODE) { 2196 loopback_mode : LoopbackMode, 2197} 2198 2199packet WriteLoopbackModeComplete : CommandComplete (command_op_code = WRITE_LOOPBACK_MODE) { 2200 status : ErrorCode, 2201} 2202 2203packet EnableDeviceUnderTestMode : CommandPacket (op_code = ENABLE_DEVICE_UNDER_TEST_MODE) { 2204} 2205 2206packet EnableDeviceUnderTestModeComplete : CommandComplete (command_op_code = ENABLE_DEVICE_UNDER_TEST_MODE) { 2207 status : ErrorCode, 2208} 2209 2210packet WriteSimplePairingDebugMode : SecurityCommand (op_code = WRITE_SIMPLE_PAIRING_DEBUG_MODE) { 2211 simple_pairing_debug_mode : Enable, 2212} 2213 2214packet WriteSimplePairingDebugModeComplete : CommandComplete (command_op_code = WRITE_SIMPLE_PAIRING_DEBUG_MODE) { 2215 status : ErrorCode, 2216} 2217 2218packet WriteSecureConnectionsTestMode : CommandPacket (op_code = WRITE_SECURE_CONNECTIONS_TEST_MODE) { 2219 connection_handle : 12, 2220 _reserved_ : 4, 2221 dm1_aclu_mode : Enable, 2222 esco_loopback_mode : Enable, 2223} 2224 2225packet WriteSecureConnectionsTestModeComplete : CommandComplete (command_op_code = WRITE_SECURE_CONNECTIONS_TEST_MODE) { 2226 status : ErrorCode, 2227} 2228 2229 // LE_CONTROLLER 2230packet LeSetEventMask : CommandPacket (op_code = LE_SET_EVENT_MASK) { 2231 le_event_mask : 64, 2232} 2233 2234packet LeSetEventMaskComplete : CommandComplete (command_op_code = LE_SET_EVENT_MASK) { 2235 status : ErrorCode, 2236} 2237 2238packet LeReadBufferSize : CommandPacket (op_code = LE_READ_BUFFER_SIZE) { 2239} 2240 2241struct LeBufferSize { 2242 le_data_packet_length : 16, 2243 total_num_le_packets : 8, 2244} 2245 2246packet LeReadBufferSizeComplete : CommandComplete (command_op_code = LE_READ_BUFFER_SIZE) { 2247 status : ErrorCode, 2248 le_buffer_size : LeBufferSize, 2249} 2250 2251packet LeReadLocalSupportedFeatures : CommandPacket (op_code = LE_READ_LOCAL_SUPPORTED_FEATURES) { 2252} 2253 2254packet LeReadLocalSupportedFeaturesComplete : CommandComplete (command_op_code = LE_READ_LOCAL_SUPPORTED_FEATURES) { 2255 status : ErrorCode, 2256 le_features : 64, 2257} 2258 2259packet LeSetRandomAddress : LeAdvertisingCommand (op_code = LE_SET_RANDOM_ADDRESS) { 2260 random_address : Address, 2261} 2262 2263packet LeSetRandomAddressComplete : CommandComplete (command_op_code = LE_SET_RANDOM_ADDRESS) { 2264 status : ErrorCode, 2265} 2266 2267enum AdvertisingFilterPolicy : 2 { 2268 ALL_DEVICES = 0, // Default 2269 WHITELISTED_SCAN = 1, 2270 WHITELISTED_CONNECT = 2, 2271 WHITELISTED_SCAN_AND_CONNECT = 3, 2272} 2273 2274enum PeerAddressType : 8 { 2275 PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0x00, 2276 RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x01, 2277} 2278 2279enum AdvertisingEventType : 8 { 2280 ADV_IND = 0x00, 2281 ADV_DIRECT_IND = 0x01, 2282 ADV_SCAN_IND = 0x02, 2283 ADV_NONCONN_IND = 0x03, 2284 ADV_DIRECT_IND_LOW = 0x04, 2285} 2286 2287enum AddressType : 8 { 2288 PUBLIC_DEVICE_ADDRESS = 0x00, 2289 RANDOM_DEVICE_ADDRESS = 0x01, 2290 PUBLIC_IDENTITY_ADDRESS = 0x02, 2291 RANDOM_IDENTITY_ADDRESS = 0x03, 2292} 2293 2294packet LeSetAdvertisingParameters : LeAdvertisingCommand (op_code = LE_SET_ADVERTISING_PARAMETERS) { 2295 interval_min : 16, 2296 interval_max : 16, 2297 type : AdvertisingEventType, 2298 own_address_type : AddressType, 2299 peer_address_type : PeerAddressType, 2300 peer_address : Address, 2301 channel_map : 8, 2302 filter_policy : AdvertisingFilterPolicy, 2303 _reserved_ : 6, 2304} 2305 2306packet LeSetAdvertisingParametersComplete : CommandComplete (command_op_code = LE_SET_ADVERTISING_PARAMETERS) { 2307 status : ErrorCode, 2308} 2309 2310packet LeReadAdvertisingChannelTxPower : LeAdvertisingCommand (op_code = LE_READ_ADVERTISING_CHANNEL_TX_POWER) { 2311} 2312 2313packet LeReadAdvertisingChannelTxPowerComplete : CommandComplete (command_op_code = LE_READ_ADVERTISING_CHANNEL_TX_POWER) { 2314 status : ErrorCode, 2315 transmit_power_level : 8, // (-20dBm to 10dBm) Accuracy: +/-4dB 2316} 2317 2318packet LeSetAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_ADVERTISING_DATA) { 2319 _size_(advertising_data) : 8, 2320 advertising_data : GapData[], 2321 _padding_[35], // Zero padding to 31 bytes of advertising_data + 1 size + 2 opcode + 1 total_size 2322} 2323 2324packet LeSetAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_ADVERTISING_DATA) { 2325 status : ErrorCode, 2326} 2327 2328packet LeSetScanResponseData : LeAdvertisingCommand (op_code = LE_SET_SCAN_RESPONSE_DATA) { 2329 _size_(advertising_data) : 8, 2330 advertising_data : GapData[], 2331 _padding_[35], // Zero padding to 31 bytes of advertising_data + 1 size + 2 opcode + 1 total_size 2332} 2333 2334packet LeSetScanResponseDataComplete : CommandComplete (command_op_code = LE_SET_SCAN_RESPONSE_DATA) { 2335 status : ErrorCode, 2336} 2337 2338packet LeSetAdvertisingEnable : LeAdvertisingCommand (op_code = LE_SET_ADVERTISING_ENABLE) { 2339 advertising_enable : Enable, // Default DISABLED 2340} 2341 2342packet LeSetAdvertisingEnableComplete : CommandComplete (command_op_code = LE_SET_ADVERTISING_ENABLE) { 2343 status : ErrorCode, 2344} 2345 2346enum LeScanType : 8 { 2347 PASSIVE = 0x00, // Default 2348 ACTIVE = 0x01, 2349} 2350 2351enum LeSetScanningFilterPolicy : 8 { 2352 ACCEPT_ALL = 0x00, // Default 2353 WHITE_LIST_ONLY = 0x01, 2354 CHECK_INITIATORS_IDENTITY = 0x02, 2355 WHITE_LIST_AND_INITIATORS_IDENTITY = 0x03, 2356} 2357 2358packet LeSetScanParameters : LeScanningCommand (op_code = LE_SET_SCAN_PARAMETERS) { 2359 le_scan_type : LeScanType, 2360 le_scan_interval : 16, // 0x0004-0x4000 Default 0x10 (10ms) 2361 le_scan_window : 16, // Default 0x10 (10ms) 2362 own_address_type : AddressType, 2363 scanning_filter_policy : LeSetScanningFilterPolicy, 2364} 2365 2366packet LeSetScanParametersComplete : CommandComplete (command_op_code = LE_SET_SCAN_PARAMETERS) { 2367 status : ErrorCode, 2368} 2369 2370packet LeSetScanEnable : LeScanningCommand (op_code = LE_SET_SCAN_ENABLE) { 2371 le_scan_enable : Enable, 2372 filter_duplicates : Enable, 2373} 2374 2375packet LeSetScanEnableComplete : CommandComplete (command_op_code = LE_SET_SCAN_ENABLE) { 2376 status : ErrorCode, 2377} 2378 2379enum InitiatorFilterPolicy : 8 { 2380 USE_PEER_ADDRESS = 0x00, 2381 USE_WHITE_LIST = 0x01, 2382} 2383 2384enum OwnAddressType : 8 { 2385 PUBLIC_DEVICE_ADDRESS = 0x00, 2386 RANDOM_DEVICE_ADDRESS = 0x01, 2387 RESOLVABLE_OR_PUBLIC_ADDRESS = 0x02, 2388 RESOLVABLE_OR_RANDOM_ADDRESS = 0x03, 2389} 2390 2391packet LeCreateConnection : LeConnectionManagementCommand (op_code = LE_CREATE_CONNECTION) { 2392 le_scan_interval : 16, // 0x0004-0x4000 2393 le_scan_window : 16, // < = LeScanInterval 2394 initiator_filter_policy : InitiatorFilterPolicy, 2395 peer_address_type : AddressType, 2396 peer_address : Address, 2397 own_address_type : OwnAddressType, 2398 conn_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s) 2399 conn_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s) 2400 conn_latency : 16, // 0x0006-0x01F3 2401 supervision_timeout : 16, // 0x00A to 0x0C80 (100ms to 32s) 2402 minimum_ce_length : 16, // 0.625ms 2403 maximum_ce_length : 16, // 0.625ms 2404} 2405 2406packet LeCreateConnectionStatus : CommandStatus (command_op_code = LE_CREATE_CONNECTION) { 2407} 2408 2409packet LeCreateConnectionCancel : LeConnectionManagementCommand (op_code = LE_CREATE_CONNECTION_CANCEL) { 2410} 2411 2412packet LeCreateConnectionCancelStatus : CommandStatus (command_op_code = LE_CREATE_CONNECTION_CANCEL) { 2413} 2414 2415packet LeCreateConnectionCancelComplete : CommandComplete (command_op_code = LE_CREATE_CONNECTION_CANCEL) { 2416 status : ErrorCode, 2417} 2418 2419packet LeReadWhiteListSize : LeConnectionManagementCommand (op_code = LE_READ_WHITE_LIST_SIZE) { 2420} 2421 2422packet LeReadWhiteListSizeComplete : CommandComplete (command_op_code = LE_READ_WHITE_LIST_SIZE) { 2423 status : ErrorCode, 2424 white_list_size : 8, 2425} 2426 2427packet LeClearWhiteList : LeConnectionManagementCommand (op_code = LE_CLEAR_WHITE_LIST) { 2428} 2429 2430packet LeClearWhiteListComplete : CommandComplete (command_op_code = LE_CLEAR_WHITE_LIST) { 2431 status : ErrorCode, 2432} 2433 2434enum WhiteListAddressType : 8 { 2435 PUBLIC = 0x00, 2436 RANDOM = 0x01, 2437 ANONYMOUS_ADVERTISERS = 0xFF, 2438} 2439 2440packet LeAddDeviceToWhiteList : LeConnectionManagementCommand (op_code = LE_ADD_DEVICE_TO_WHITE_LIST) { 2441 address_type : WhiteListAddressType, 2442 address : Address, 2443} 2444 2445packet LeAddDeviceToWhiteListComplete : CommandComplete (command_op_code = LE_ADD_DEVICE_TO_WHITE_LIST) { 2446 status : ErrorCode, 2447} 2448 2449packet LeRemoveDeviceFromWhiteList : LeConnectionManagementCommand (op_code = LE_REMOVE_DEVICE_FROM_WHITE_LIST) { 2450 address_type : WhiteListAddressType, 2451 address : Address, 2452} 2453 2454packet LeRemoveDeviceFromWhiteListComplete : CommandComplete (command_op_code = LE_REMOVE_DEVICE_FROM_WHITE_LIST) { 2455 status : ErrorCode, 2456} 2457 2458packet LeConnectionUpdate : LeConnectionManagementCommand (op_code = LE_CONNECTION_UPDATE) { 2459 connection_handle : 12, 2460 _reserved_ : 4, 2461 conn_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s) 2462 conn_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s) 2463 conn_latency : 16, // 0x0006-0x01F3 2464 supervision_timeout : 16, // 0x00A to 0x0C80 (100ms to 32s) 2465 minimum_ce_length : 16, // 0.625ms 2466 maximum_ce_length : 16, // 0.625ms 2467} 2468 2469packet LeConnectionUpdateStatus : CommandStatus (command_op_code = LE_CONNECTION_UPDATE) { 2470} 2471 2472packet LeSetHostChannelClassification : LeConnectionManagementCommand (op_code = LE_SET_HOST_CHANNEL_CLASSIFICATION) { 2473 channel_map : 8[5], 2474} 2475 2476packet LeSetHostChannelClassificationComplete : CommandComplete (command_op_code = LE_SET_HOST_CHANNEL_CLASSIFICATION) { 2477 status : ErrorCode, 2478} 2479 2480packet LeReadChannelMap : LeConnectionManagementCommand (op_code = LE_READ_CHANNEL_MAP) { 2481} 2482 2483packet LeReadChannelMapComplete : CommandComplete (command_op_code = LE_SET_HOST_CHANNEL_CLASSIFICATION) { 2484 status : ErrorCode, 2485 connection_handle : 12, 2486 _reserved_ : 4, 2487 channel_map : 8[5], 2488} 2489 2490packet LeReadRemoteFeatures : LeConnectionManagementCommand (op_code = LE_READ_REMOTE_FEATURES) { 2491 connection_handle : 12, 2492 _reserved_ : 4, 2493} 2494 2495packet LeEncrypt : LeSecurityCommand (op_code = LE_ENCRYPT) { 2496 key : 8[16], 2497 plaintext_data : 8[16], 2498} 2499 2500packet LeEncryptComplete : CommandComplete (command_op_code = LE_ENCRYPT) { 2501 status : ErrorCode, 2502 encrypted_data : 8[16], 2503} 2504 2505packet LeRand : LeSecurityCommand (op_code = LE_RAND) { 2506} 2507 2508packet LeRandComplete : CommandComplete (command_op_code = LE_RAND) { 2509 status : ErrorCode, 2510 random_number : 64, 2511} 2512 2513packet LeStartEncryption : LeSecurityCommand (op_code = LE_START_ENCRYPTION) { 2514 connection_handle: 16, 2515 rand: 8[8], 2516 ediv: 16, 2517 ltk: 8[16], 2518} 2519 2520packet LeStartEncryptionStatus : CommandStatus (command_op_code = LE_START_ENCRYPTION) { 2521} 2522 2523packet LeLongTermKeyRequestReply : LeSecurityCommand (op_code = LE_LONG_TERM_KEY_REQUEST_REPLY) { 2524 connection_handle: 16, 2525 long_term_key: 8[16], 2526} 2527 2528packet LeLongTermKeyRequestReplyComplete : CommandComplete (command_op_code = LE_LONG_TERM_KEY_REQUEST_REPLY) { 2529 status : ErrorCode, 2530 connection_handle : 12, 2531 _reserved_ : 4, 2532} 2533 2534packet LeLongTermKeyRequestNegativeReply : LeSecurityCommand (op_code = LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY) { 2535 connection_handle : 12, 2536 _reserved_ : 4, 2537} 2538 2539packet LeLongTermKeyRequestNegativeReplyComplete : CommandComplete (command_op_code = LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY) { 2540 status : ErrorCode, 2541 connection_handle : 12, 2542 _reserved_ : 4, 2543} 2544 2545packet LeReadSupportedStates : CommandPacket (op_code = LE_READ_SUPPORTED_STATES) { 2546} 2547 2548packet LeReadSupportedStatesComplete : CommandComplete (command_op_code = LE_READ_SUPPORTED_STATES) { 2549 status : ErrorCode, 2550 le_states : 64, 2551} 2552 2553packet LeReceiverTest : CommandPacket (op_code = LE_RECEIVER_TEST) { 2554 _payload_, // placeholder (unimplemented) 2555} 2556 2557packet LeTransmitterTest : CommandPacket (op_code = LE_TRANSMITTER_TEST) { 2558 _payload_, // placeholder (unimplemented) 2559} 2560 2561packet LeTestEnd : CommandPacket (op_code = LE_TEST_END) { 2562 _payload_, // placeholder (unimplemented) 2563} 2564 2565packet LeRemoteConnectionParameterRequestReply : LeConnectionManagementCommand (op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY) { 2566 connection_handle : 12, 2567 _reserved_ : 4, 2568 interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s) 2569 interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s) 2570 latency : 16, // 0x0006-0x01F3 2571 timeout : 16, // 0x00A to 0x0C80 (100ms to 32s) 2572 minimum_ce_length : 16, // 0.625ms 2573 maximum_ce_length : 16, // 0.625ms 2574} 2575 2576packet LeRemoteConnectionParameterRequestReplyComplete : CommandComplete (command_op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY) { 2577 status : ErrorCode, 2578 connection_handle : 12, 2579 _reserved_ : 4, 2580} 2581 2582packet LeRemoteConnectionParameterRequestNegativeReply : LeConnectionManagementCommand (op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY) { 2583 connection_handle : 12, 2584 _reserved_ : 4, 2585 reason : ErrorCode, 2586} 2587 2588packet LeRemoteConnectionParameterRequestNegativeReplyComplete : CommandComplete (command_op_code = LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY) { 2589 status : ErrorCode, 2590 connection_handle : 12, 2591 _reserved_ : 4, 2592} 2593 2594packet LeSetDataLength : LeConnectionManagementCommand (op_code = LE_SET_DATA_LENGTH) { 2595 connection_handle : 12, 2596 _reserved_ : 4, 2597 tx_octets : 16, // payload octets per single PDU 0x1B to 0x00FB 2598 tx_time : 16, // microseconds used to transmit a single PDU 0x0148 to 0x4290 2599} 2600 2601packet LeSetDataLengthComplete : CommandComplete (command_op_code = LE_SET_DATA_LENGTH) { 2602 status : ErrorCode, 2603 connection_handle : 12, 2604 _reserved_ : 4, 2605} 2606 2607packet LeReadSuggestedDefaultDataLength : LeConnectionManagementCommand (op_code = LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) { 2608} 2609 2610packet LeReadSuggestedDefaultDataLengthComplete : CommandComplete (command_op_code = LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) { 2611 status : ErrorCode, 2612 tx_octets : 16, // payload octets per single PDU 0x1B to 0x00FB 2613 tx_time : 16, // microseconds used to transmit a single PDU 0x0148 to 0x4290 2614} 2615 2616packet LeWriteSuggestedDefaultDataLength : LeConnectionManagementCommand (op_code = LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH) { 2617 tx_octets : 16, // payload octets per single PDU 0x1B to 0x00FB 2618 tx_time : 16, // microseconds used to transmit a single PDU 0x0148 to 0x4290 2619} 2620 2621packet LeWriteSuggestedDefaultDataLengthComplete : CommandComplete (command_op_code = LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH) { 2622 status : ErrorCode, 2623} 2624 2625packet LeReadLocalP256PublicKeyCommand : LeSecurityCommand (op_code = LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND) { 2626} 2627 2628packet LeGenerateDhkeyV1Command : LeSecurityCommand (op_code = LE_GENERATE_DHKEY_COMMAND_V1) { 2629 remote_p_256_public_key : 8[64], 2630} 2631 2632packet LeGenerateDhkeyV1CommandStatus : CommandStatus (command_op_code = LE_GENERATE_DHKEY_COMMAND_V1) { 2633} 2634 2635packet LeAddDeviceToResolvingList : LeSecurityCommand (op_code = LE_ADD_DEVICE_TO_RESOLVING_LIST) { 2636 peer_identity_address_type : PeerAddressType, 2637 peer_identity_address : Address, 2638 peer_irk : 8[16], 2639 local_irk : 8[16], 2640} 2641 2642packet LeAddDeviceToResolvingListComplete : CommandComplete (command_op_code = LE_ADD_DEVICE_TO_RESOLVING_LIST) { 2643 status : ErrorCode, 2644} 2645 2646packet LeRemoveDeviceFromResolvingList : LeSecurityCommand (op_code = LE_REMOVE_DEVICE_FROM_RESOLVING_LIST) { 2647 peer_identity_address_type : PeerAddressType, 2648 peer_identity_address : Address, 2649} 2650 2651packet LeRemoveDeviceFromResolvingListComplete : CommandComplete (command_op_code = LE_REMOVE_DEVICE_FROM_RESOLVING_LIST) { 2652 status : ErrorCode, 2653} 2654 2655packet LeClearResolvingList : LeSecurityCommand (op_code = LE_CLEAR_RESOLVING_LIST) { 2656} 2657 2658packet LeClearResolvingListComplete : CommandComplete (command_op_code = LE_CLEAR_RESOLVING_LIST) { 2659 status : ErrorCode, 2660} 2661 2662packet LeReadResolvingListSize : LeSecurityCommand (op_code = LE_READ_RESOLVING_LIST_SIZE) { 2663} 2664 2665packet LeReadResolvingListSizeComplete : CommandComplete (command_op_code = LE_READ_RESOLVING_LIST_SIZE) { 2666 status : ErrorCode, 2667} 2668 2669packet LeReadPeerResolvableAddress : LeSecurityCommand (op_code = LE_READ_PEER_RESOLVABLE_ADDRESS) { 2670 peer_identity_address_type : PeerAddressType, 2671 peer_identity_address : Address, 2672} 2673 2674packet LeReadPeerResolvableAddressComplete : CommandComplete (command_op_code = LE_READ_PEER_RESOLVABLE_ADDRESS) { 2675 status : ErrorCode, 2676 peer_resolvable_address : Address, 2677} 2678 2679packet LeReadLocalResolvableAddress : LeSecurityCommand (op_code = LE_READ_LOCAL_RESOLVABLE_ADDRESS) { 2680 peer_identity_address_type : PeerAddressType, 2681 peer_identity_address : Address, 2682} 2683 2684packet LeReadLocalResolvableAddressComplete : CommandComplete (command_op_code = LE_READ_LOCAL_RESOLVABLE_ADDRESS) { 2685 status : ErrorCode, 2686 local_resolvable_address : Address, 2687} 2688 2689packet LeSetAddressResolutionEnable : LeSecurityCommand (op_code = LE_SET_ADDRESS_RESOLUTION_ENABLE) { 2690 address_resolution_enable : Enable, 2691} 2692 2693packet LeSetAddressResolutionEnableComplete : CommandComplete (command_op_code = LE_SET_ADDRESS_RESOLUTION_ENABLE) { 2694 status : ErrorCode, 2695} 2696 2697packet LeSetResolvablePrivateAddressTimeout : LeSecurityCommand (op_code = LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT) { 2698 rpa_timeout : 16, // RPA_Timeout measured in seconds 0x0001 to 0xA1B8 1s to 11.5 hours 2699} 2700 2701packet LeSetResolvablePrivateAddressTimeoutComplete : CommandComplete (command_op_code = LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT) { 2702 status : ErrorCode, 2703} 2704 2705packet LeReadMaximumDataLength : CommandPacket (op_code = LE_READ_MAXIMUM_DATA_LENGTH) { 2706} 2707 2708struct LeMaximumDataLength { 2709 supported_max_tx_octets : 16, 2710 supported_max_tx_time: 16, 2711 supported_max_rx_octets : 16, 2712 supported_max_rx_time: 16, 2713} 2714 2715packet LeReadMaximumDataLengthComplete : CommandComplete (command_op_code = LE_READ_MAXIMUM_DATA_LENGTH) { 2716 status : ErrorCode, 2717 le_maximum_data_length : LeMaximumDataLength, 2718} 2719 2720packet LeReadPhy : LeConnectionManagementCommand (op_code = LE_READ_PHY) { 2721 _payload_, // placeholder (unimplemented) 2722} 2723 2724packet LeSetDefaultPhy : LeConnectionManagementCommand (op_code = LE_SET_DEFAULT_PHY) { 2725 _payload_, // placeholder (unimplemented) 2726} 2727 2728packet LeSetPhy : LeConnectionManagementCommand (op_code = LE_SET_PHY) { 2729 _payload_, // placeholder (unimplemented) 2730} 2731 2732packet LeEnhancedReceiverTest : CommandPacket (op_code = LE_ENHANCED_RECEIVER_TEST) { 2733 _payload_, // placeholder (unimplemented) 2734} 2735 2736packet LeEnhancedTransmitterTest : CommandPacket (op_code = LE_ENHANCED_TRANSMITTER_TEST) { 2737 _payload_, // placeholder (unimplemented) 2738} 2739 2740packet LeSetExtendedAdvertisingRandomAddress : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS) { 2741 advertising_handle : 8, 2742 advertising_random_address : Address, 2743} 2744 2745packet LeSetExtendedAdvertisingRandomAddressComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS) { 2746 status : ErrorCode, 2747} 2748 2749// The lower 4 bits of the advertising event properties 2750enum LegacyAdvertisingProperties : 4 { 2751 ADV_IND = 0x3, 2752 ADV_DIRECT_IND_LOW = 0x5, 2753 ADV_DIRECT_IND_HIGH = 0xD, 2754 ADV_SCAN_IND = 0x2, 2755 ADV_NONCONN_IND = 0, 2756} 2757 2758enum PrimaryPhyType : 8 { 2759 LE_1M = 0x01, 2760 LE_CODED = 0x03, 2761} 2762 2763enum SecondaryPhyType : 8 { 2764 NO_PACKETS = 0x00, 2765 LE_1M = 0x01, 2766 LE_2M = 0x02, 2767 LE_CODED = 0x03, 2768} 2769 2770packet LeSetExtendedAdvertisingLegacyParameters : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) { 2771 advertising_handle : 8, 2772 advertising_event_legacy_properties : LegacyAdvertisingProperties, 2773 _fixed_ = 0x1 : 1, // legacy bit set 2774 _reserved_ : 11, // advertising_event_properties 2775 primary_advertising_interval_min : 24, // 0x20 - 0xFFFFFF N * 0.625 ms 2776 primary_advertising_interval_max : 24, // 0x20 - 0xFFFFFF N * 0.625 ms 2777 primary_advertising_channel_map : 3, // bit 0 - Channel 37, bit 1 - 38, bit 2 - 39 2778 _reserved_ : 5, 2779 own_address_type : OwnAddressType, 2780 peer_address_type : PeerAddressType, 2781 peer_address : Address, 2782 advertising_filter_policy : AdvertisingFilterPolicy, 2783 _reserved_ : 6, 2784 advertising_tx_power : 8, // -127 to +20, 0x7F - no preference 2785 _fixed_ = 0x1 : 8, // PrimaryPhyType LE_1M 2786 _reserved_ : 8, // secondary_advertising_max_skip 2787 _fixed_ = 0x1 : 8, // secondary_advertising_phy LE_1M 2788 advertising_sid : 8, // SID subfield from the ADI field of the PDU 2789 scan_request_notification_enable : Enable, 2790} 2791 2792packet LeSetExtendedAdvertisingParameters : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) { 2793 advertising_handle : 8, 2794 advertising_event_legacy_properties : 4, 2795 _fixed_ = 0 : 1, // legacy bit cleared 2796 advertising_event_properties : 3, 2797 _reserved_ : 8, 2798 primary_advertising_interval_min : 24, // 0x20 - 0xFFFFFF N * 0.625 ms 2799 primary_advertising_interval_max : 24, // 0x20 - 0xFFFFFF N * 0.625 ms 2800 primary_advertising_channel_map : 3, // bit 0 - Channel 37, bit 1 - 38, bit 2 - 39 2801 _reserved_ : 5, 2802 own_address_type : OwnAddressType, 2803 peer_address_type : PeerAddressType, 2804 peer_address : Address, 2805 advertising_filter_policy : AdvertisingFilterPolicy, 2806 _reserved_ : 6, 2807 advertising_tx_power : 8, // -127 to +20, 0x7F - no preference 2808 primary_advertising_phy : PrimaryPhyType, 2809 secondary_advertising_max_skip : 8, // 1 to 255, 0x00 - AUX_ADV_IND sent before next advertising event 2810 secondary_advertising_phy : SecondaryPhyType, 2811 advertising_sid : 8, // SID subfield from the ADI field of the PDU 2812 scan_request_notification_enable : Enable, 2813} 2814 2815packet LeSetExtendedAdvertisingParametersComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) { 2816 status : ErrorCode, 2817 selected_tx_power : 8, // -127 to +20 2818} 2819 2820enum Operation : 3 { 2821 INTERMEDIATE_FRAGMENT = 0, 2822 FIRST_FRAGMENT = 1, 2823 LAST_FRAGMENT = 2, 2824 COMPLETE_ADVERTISEMENT = 3, 2825 UNCHANGED_DATA = 4, 2826} 2827 2828enum FragmentPreference : 1 { 2829 CONTROLLER_MAY_FRAGMENT = 0, 2830 CONTROLLER_SHOULD_NOT = 1, 2831} 2832 2833packet LeSetExtendedAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_DATA) { 2834 advertising_handle : 8, 2835 operation : Operation, 2836 _reserved_ : 5, 2837 fragment_preference : FragmentPreference, 2838 _reserved_ : 7, 2839 _size_(advertising_data) : 8, 2840 advertising_data : GapData[], 2841} 2842 2843packet LeSetExtendedAdvertisingDataRaw : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_DATA) { 2844 advertising_handle : 8, 2845 operation : Operation, 2846 _reserved_ : 5, 2847 fragment_preference : FragmentPreference, 2848 _reserved_ : 7, 2849 _size_(advertising_data) : 8, 2850 advertising_data : 8[], 2851} 2852 2853packet LeSetExtendedAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_DATA) { 2854 status : ErrorCode, 2855} 2856 2857packet LeSetExtendedAdvertisingScanResponse : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) { 2858 advertising_handle : 8, 2859 operation : Operation, 2860 _reserved_ : 5, 2861 fragment_preference : FragmentPreference, 2862 _reserved_ : 7, 2863 _size_(scan_response_data) : 8, 2864 scan_response_data : GapData[], 2865} 2866 2867packet LeSetExtendedAdvertisingScanResponseRaw : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) { 2868 advertising_handle : 8, 2869 operation : Operation, 2870 _reserved_ : 5, 2871 fragment_preference : FragmentPreference, 2872 _reserved_ : 7, 2873 _size_(scan_response_data) : 8, 2874 scan_response_data : 8[], 2875} 2876 2877packet LeSetExtendedAdvertisingScanResponseComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) { 2878 status : ErrorCode, 2879} 2880 2881packet LeSetExtendedAdvertisingEnableDisableAll : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) { 2882 _fixed_ = 0x00 : 8, // Enable::DISABLED 2883 _fixed_ = 0x00 : 8, // Disable all sets 2884} 2885 2886struct EnabledSet { 2887 advertising_handle : 8, 2888 duration : 16, 2889 max_extended_advertising_events : 8, 2890} 2891 2892struct DisabledSet { 2893 advertising_handle : 8, 2894 _fixed_ = 0x00 : 16, // duration 2895 _fixed_ = 0x00 : 8, // max_extended_advertising_events 2896} 2897 2898packet LeSetExtendedAdvertisingDisable : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) { 2899 _fixed_ = 0x00 : 8, // Enable::DISABLED 2900 _count_(disabled_sets) : 8, 2901 disabled_sets : DisabledSet[], 2902} 2903 2904packet LeSetExtendedAdvertisingEnable : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) { 2905 enable : Enable, 2906 _count_(enabled_sets) : 8, 2907 enabled_sets : EnabledSet[], 2908} 2909 2910packet LeSetExtendedAdvertisingEnableComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) { 2911 status : ErrorCode, 2912} 2913 2914packet LeReadMaximumAdvertisingDataLength : CommandPacket (op_code = LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH) { 2915} 2916 2917packet LeReadMaximumAdvertisingDataLengthComplete : CommandComplete (command_op_code = LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH) { 2918 status : ErrorCode, 2919 maximum_advertising_data_length : 16, 2920} 2921 2922packet LeReadNumberOfSupportedAdvertisingSets : CommandPacket (op_code = LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS) { 2923} 2924 2925packet LeReadNumberOfSupportedAdvertisingSetsComplete : CommandComplete (command_op_code = LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS) { 2926 status : ErrorCode, 2927 number_supported_advertising_sets : 8, 2928} 2929 2930packet LeRemoveAdvertisingSet : LeAdvertisingCommand (op_code = LE_REMOVE_ADVERTISING_SET) { 2931 advertising_handle : 8, 2932} 2933 2934packet LeRemoveAdvertisingSetComplete : CommandComplete (command_op_code = LE_REMOVE_ADVERTISING_SET) { 2935 status : ErrorCode, 2936} 2937 2938packet LeClearAdvertisingSets : LeAdvertisingCommand (op_code = LE_CLEAR_ADVERTISING_SETS) { 2939} 2940 2941packet LeClearAdvertisingSetsComplete : CommandComplete (command_op_code = LE_CLEAR_ADVERTISING_SETS) { 2942 status : ErrorCode, 2943} 2944 2945packet LeSetPeriodicAdvertisingParam : LeAdvertisingCommand (op_code = LE_SET_PERIODIC_ADVERTISING_PARAM) { 2946 advertising_handle : 8, 2947 periodic_advertising_interval_min : 16, // 0x006 to 0xFFFF (7.5 ms to 82s) 2948 periodic_advertising_interval_max : 16, // 0x006 to 0xFFFF (7.5 ms to 82s) 2949 _reserved_ : 6, 2950 include_tx_power : 1, 2951 _reserved_ : 9, 2952} 2953 2954packet LeSetPeriodicAdvertisingParamComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_PARAM) { 2955 status : ErrorCode, 2956} 2957 2958packet LeSetPeriodicAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_PERIODIC_ADVERTISING_DATA) { 2959 advertising_handle : 8, 2960 operation : Operation, 2961 _reserved_ : 5, 2962 _size_(scan_response_data) : 8, 2963 scan_response_data : 8[], 2964} 2965 2966packet LeSetPeriodicAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_DATA) { 2967 status : ErrorCode, 2968} 2969 2970packet LeSetPeriodicAdvertisingEnable : LeAdvertisingCommand (op_code = LE_SET_PERIODIC_ADVERTISING_ENABLE) { 2971 advertising_handle : 8, 2972 enable : Enable, 2973} 2974 2975packet LeSetPeriodicAdvertisingEnableComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_ENABLE) { 2976 status : ErrorCode, 2977} 2978 2979struct PhyScanParameters { 2980 le_scan_type : LeScanType, 2981 le_scan_interval : 16, // 0x0004-0xFFFF Default 0x10 (10ms) 2982 le_scan_window : 16, // 0x004-0xFFFF Default 0x10 (10ms) 2983} 2984 2985packet LeSetExtendedScanParameters : LeScanningCommand (op_code = LE_SET_EXTENDED_SCAN_PARAMETERS) { 2986 own_address_type : AddressType, 2987 scanning_filter_policy : LeSetScanningFilterPolicy, 2988 scanning_phys : 8, 2989 parameters : PhyScanParameters[], 2990} 2991 2992packet LeSetExtendedScanParametersComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_SCAN_PARAMETERS) { 2993 status : ErrorCode, 2994} 2995 2996enum FilterDuplicates : 8 { 2997 DISABLED = 0, 2998 ENABLED = 1, 2999 RESET_EACH_PERIOD = 2, 3000} 3001 3002packet LeSetExtendedScanEnable : LeScanningCommand (op_code = LE_SET_EXTENDED_SCAN_ENABLE) { 3003 enable : Enable, 3004 filter_duplicates : FilterDuplicates, 3005 duration : 16, // 0 - Scan continuously, N * 10 ms 3006 period : 16, // 0 - Scan continuously, N * 1.28 sec 3007} 3008 3009packet LeSetExtendedScanEnableComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_SCAN_ENABLE) { 3010 status : ErrorCode, 3011} 3012 3013struct LeCreateConnPhyScanParameters { 3014 scan_interval : 16, // 0x0004-0xFFFF 3015 scan_window : 16, // < = LeScanInterval 3016 conn_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s) 3017 conn_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s) 3018 conn_latency : 16, // 0x0006-0x01F3 3019 supervision_timeout : 16, // 0x00A to 0x0C80 (100ms to 32s) 3020 min_ce_length : 16, // 0.625ms 3021 max_ce_length : 16, // 0.625ms 3022} 3023 3024packet LeExtendedCreateConnection : LeConnectionManagementCommand (op_code = LE_EXTENDED_CREATE_CONNECTION) { 3025 initiator_filter_policy : InitiatorFilterPolicy, 3026 own_address_type : OwnAddressType, 3027 peer_address_type : AddressType, 3028 peer_address : Address, 3029 initiating_phys : 8, 3030 phy_scan_parameters : LeCreateConnPhyScanParameters[], 3031} 3032 3033packet LeExtendedCreateConnectionStatus : CommandStatus (command_op_code = LE_EXTENDED_CREATE_CONNECTION) { 3034} 3035 3036packet LePeriodicAdvertisingCreateSync : LeAdvertisingCommand (op_code = LE_PERIODIC_ADVERTISING_CREATE_SYNC) { 3037 _payload_, // placeholder (unimplemented) 3038} 3039 3040packet LePeriodicAdvertisingCreateSyncCancel : LeAdvertisingCommand (op_code = LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL) { 3041 _payload_, // placeholder (unimplemented) 3042} 3043 3044packet LePeriodicAdvertisingTerminateSync : LeAdvertisingCommand (op_code = LE_PERIODIC_ADVERTISING_TERMINATE_SYNC) { 3045 _payload_, // placeholder (unimplemented) 3046} 3047 3048packet LeAddDeviceToPeriodicAdvertisingList : LeAdvertisingCommand (op_code = LE_ADD_DEVICE_TO_PERIODIC_ADVERTISING_LIST) { 3049 _payload_, // placeholder (unimplemented) 3050} 3051 3052packet LeRemoveDeviceFromPeriodicAdvertisingList : LeAdvertisingCommand (op_code = LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISING_LIST) { 3053 _payload_, // placeholder (unimplemented) 3054} 3055 3056packet LeClearPeriodicAdvertisingList : LeAdvertisingCommand (op_code = LE_CLEAR_PERIODIC_ADVERTISING_LIST) { 3057 _payload_, // placeholder (unimplemented) 3058} 3059 3060packet LeReadPeriodicAdvertisingListSize : LeAdvertisingCommand (op_code = LE_READ_PERIODIC_ADVERTISING_LIST_SIZE) { 3061 _payload_, // placeholder (unimplemented) 3062} 3063 3064packet LeReadTransmitPower : LeAdvertisingCommand (op_code = LE_READ_TRANSMIT_POWER) { 3065 _payload_, // placeholder (unimplemented) 3066} 3067 3068packet LeReadRfPathCompensationPower : LeAdvertisingCommand (op_code = LE_READ_RF_PATH_COMPENSATION_POWER) { 3069 _payload_, // placeholder (unimplemented) 3070} 3071 3072packet LeWriteRfPathCompensationPower : LeAdvertisingCommand (op_code = LE_WRITE_RF_PATH_COMPENSATION_POWER) { 3073 _payload_, // placeholder (unimplemented) 3074} 3075 3076enum PrivacyMode : 8 { 3077 NETWORK = 0, 3078 DEVICE = 1, 3079} 3080 3081packet LeSetPrivacyMode : LeSecurityCommand (op_code = LE_SET_PRIVACY_MODE) { 3082 peer_identity_address_type : PeerAddressType, 3083 peer_identity_address : Address, 3084 privacy_mode : PrivacyMode, 3085} 3086 3087packet LeSetPrivacyModeComplete : CommandComplete (command_op_code = LE_SET_PRIVACY_MODE) { 3088 status : ErrorCode, 3089} 3090 3091enum UseDebugKey : 8 { 3092 USE_GENERATED_KEY = 0, 3093 USE_DEBUG_KEY = 1, 3094} 3095 3096packet LeGenerateDhkeyCommand : LeSecurityCommand (op_code = LE_GENERATE_DHKEY_COMMAND) { 3097 remote_p_256_public_key : 8[64], 3098 key_type : UseDebugKey, 3099} 3100 3101packet LeGenerateDhkeyCommandStatus : CommandStatus (command_op_code = LE_GENERATE_DHKEY_COMMAND) { 3102} 3103 3104 // VENDOR_SPECIFIC 3105packet LeGetVendorCapabilities : VendorCommand (op_code = LE_GET_VENDOR_CAPABILITIES) { 3106} 3107 3108struct VendorCapabilities { 3109 is_supported : 8, 3110 max_advt_instances: 8, 3111 offloaded_resolution_of_private_address : 8, 3112 total_scan_results_storage: 16, 3113 max_irk_list_sz: 8, 3114 filtering_support: 8, 3115 max_filter: 8, 3116 activity_energy_info_support: 8, 3117 version_supported: 16, 3118 total_num_of_advt_tracked: 16, 3119 extended_scan_support: 8, 3120 debug_logging_supported: 8, 3121 le_address_generation_offloading_support: 8, 3122 a2dp_source_offload_capability_mask: 32, 3123 bluetooth_quality_report_support: 8 3124} 3125 3126struct BaseVendorCapabilities { 3127 max_advt_instances: 8, 3128 offloaded_resolution_of_private_address : 8, 3129 total_scan_results_storage: 16, 3130 max_irk_list_sz: 8, 3131 filtering_support: 8, 3132 max_filter: 8, 3133 activity_energy_info_support: 8, 3134} 3135 3136packet LeGetVendorCapabilitiesComplete : CommandComplete (command_op_code = LE_GET_VENDOR_CAPABILITIES) { 3137 status : ErrorCode, 3138 base_vendor_capabilities : BaseVendorCapabilities, 3139 _payload_, 3140} 3141packet LeGetVendorCapabilitiesComplete095 : LeGetVendorCapabilitiesComplete { 3142 version_supported: 16, 3143 total_num_of_advt_tracked: 16, 3144 extended_scan_support: 8, 3145 debug_logging_supported: 8, 3146 _payload_, 3147} 3148packet LeGetVendorCapabilitiesComplete096 : LeGetVendorCapabilitiesComplete095 { 3149 le_address_generation_offloading_support: 8, 3150 _payload_, 3151} 3152 3153packet LeGetVendorCapabilitiesComplete098 : LeGetVendorCapabilitiesComplete096 { 3154 a2dp_source_offload_capability_mask: 32, 3155 bluetooth_quality_report_support: 8 3156} 3157 3158enum SubOcf : 8 { 3159 SET_PARAM = 0x01, 3160 SET_DATA = 0x02, 3161 SET_SCAN_RESP = 0x03, 3162 SET_RANDOM_ADDR = 0x04, 3163 SET_ENABLE = 0x05, 3164} 3165 3166packet LeMultiAdvt : LeAdvertisingCommand (op_code = LE_MULTI_ADVT) { 3167 sub_cmd : SubOcf, 3168 _body_, 3169} 3170 3171packet LeMultiAdvtComplete : CommandComplete (command_op_code = LE_MULTI_ADVT) { 3172 status : ErrorCode, 3173 sub_cmd : SubOcf, 3174} 3175 3176packet LeMultiAdvtParam : LeMultiAdvt (sub_cmd = SET_PARAM) { 3177 interval_min : 16, 3178 interval_max : 16, 3179 type : AdvertisingEventType, 3180 own_address_type : AddressType, 3181 peer_address_type : PeerAddressType, 3182 peer_address : Address, 3183 channel_map : 8, 3184 filter_policy : AdvertisingFilterPolicy, 3185 _reserved_ : 6, 3186 instance : 8, 3187 tx_power : 8, 3188} 3189 3190packet LeMultiAdvtParamComplete : LeMultiAdvtComplete (sub_cmd = SET_PARAM) { 3191} 3192 3193packet LeMultiAdvtSetData : LeMultiAdvt (sub_cmd = SET_DATA) { 3194 _size_(advertising_data) : 8, 3195 advertising_data : GapData[], 3196 _padding_[36], // Zero padding to 31 bytes of advertising_data + 1 size + 2 opcode + 1 total_size + 1 set 3197 advertising_instance : 8, 3198} 3199 3200packet LeMultiAdvtSetDataComplete : LeMultiAdvtComplete (sub_cmd = SET_DATA) { 3201} 3202 3203packet LeMultiAdvtSetScanResp : LeMultiAdvt (sub_cmd = SET_SCAN_RESP) { 3204 _size_(advertising_data) : 8, 3205 advertising_data : GapData[], 3206 _padding_[36], // Zero padding to 31 bytes of advertising_data + 1 size + 2 opcode + 1 total_size + 1 set 3207 advertising_instance : 8, 3208} 3209 3210packet LeMultiAdvtSetScanRespComplete : LeMultiAdvtComplete (sub_cmd = SET_SCAN_RESP) { 3211} 3212 3213packet LeMultiAdvtSetRandomAddr : LeMultiAdvt (sub_cmd = SET_RANDOM_ADDR) { 3214 random_address : Address, 3215 advertising_instance : 8, 3216} 3217 3218packet LeMultiAdvtSetRandomAddrComplete : LeMultiAdvtComplete (sub_cmd = SET_RANDOM_ADDR) { 3219} 3220 3221packet LeMultiAdvtSetEnable : LeMultiAdvt (sub_cmd = SET_ENABLE) { 3222 advertising_enable : Enable, // Default DISABLED 3223 advertising_instance : 8, 3224} 3225 3226packet LeMultiAdvtSetEnableComplete : LeMultiAdvtComplete (sub_cmd = SET_ENABLE) { 3227} 3228 3229packet LeBatchScan : VendorCommand (op_code = LE_BATCH_SCAN) { 3230 _payload_, // placeholder (unimplemented) 3231} 3232 3233enum ApcfOpcode : 8 { 3234 ENABLE = 0x00, 3235 SET_FILTERING_PARAMETERS = 0x01, 3236 BROADCASTER_ADDRESS = 0x02, 3237 SERVICE_UUID = 0x03, 3238 SERVICE_SOLICITATION_UUID = 0x04, 3239 LOCAL_NAME = 0x05, 3240 MANUFACTURER_DATA = 0x06, 3241 SERVICE_DATA = 0x07, 3242} 3243 3244packet LeAdvFilter : LeScanningCommand (op_code = LE_ADV_FILTER) { 3245 apcf_opcode : ApcfOpcode, 3246 _body_, 3247} 3248 3249packet LeAdvFilterComplete : CommandComplete (command_op_code = LE_ADV_FILTER) { 3250 status : ErrorCode, 3251 apcf_opcode : ApcfOpcode, 3252} 3253 3254packet LeTrackAdv : VendorCommand (op_code = LE_TRACK_ADV) { 3255 _payload_, // placeholder (unimplemented) 3256} 3257 3258packet LeEnergyInfo : VendorCommand (op_code = LE_ENERGY_INFO) { 3259 _payload_, // placeholder (unimplemented) 3260} 3261 3262packet LeExtendedScanParams : LeScanningCommand (op_code = LE_EXTENDED_SCAN_PARAMS) { 3263 le_scan_type : LeScanType, 3264 le_scan_interval : 32, // 0x0004-0x4000 Default 0x10 (10ms) 3265 le_scan_window : 32, // Default 0x10 (10ms) 3266 own_address_type : AddressType, 3267 scanning_filter_policy : LeSetScanningFilterPolicy, 3268} 3269 3270packet LeExtendedScanParamsComplete : CommandComplete (command_op_code = LE_EXTENDED_SCAN_PARAMS) { 3271 status : ErrorCode, 3272} 3273 3274packet ControllerDebugInfo : VendorCommand (op_code = CONTROLLER_DEBUG_INFO) { 3275 _payload_, // placeholder (unimplemented) 3276} 3277 3278packet ControllerA2DPOpcode : VendorCommand (op_code = CONTROLLER_A2DP_OPCODE) { 3279 _payload_, // placeholder (unimplemented) 3280} 3281 3282enum BqrReportAction : 8 { 3283 ADD = 0x00, 3284 DELETE = 0x01, 3285 CLEAR = 0x02, 3286} 3287 3288packet ControllerBqr : VendorCommand(op_code = CONTROLLER_BQR) { 3289 bqr_report_action : BqrReportAction, 3290 bqr_quality_event_mask : 32, 3291 bqr_minimum_report_interval : 16, 3292} 3293 3294packet ControllerBqrComplete : CommandComplete (command_op_code = CONTROLLER_BQR) { 3295 status : ErrorCode, 3296 current_quality_event_mask : 32 3297} 3298 3299// HCI Event Packets 3300 3301packet InquiryComplete : EventPacket (event_code = INQUIRY_COMPLETE){ 3302 status : ErrorCode, 3303} 3304 3305struct InquiryResult { 3306 bd_addr : Address, 3307 page_scan_repetition_mode : PageScanRepetitionMode, 3308 _reserved_ : 8, 3309 _reserved_ : 8, 3310 class_of_device : ClassOfDevice, 3311 clock_offset : 15, 3312 _reserved_ : 1, 3313} 3314 3315packet InquiryResult : EventPacket (event_code = INQUIRY_RESULT){ 3316 _count_(inquiry_results) : 8, 3317 inquiry_results : InquiryResult[], 3318} 3319 3320enum LinkType : 8 { 3321 SCO = 0x00, 3322 ACL = 0x01, 3323} 3324 3325packet ConnectionComplete : EventPacket (event_code = CONNECTION_COMPLETE){ 3326 status : ErrorCode, 3327 connection_handle : 12, 3328 _reserved_ : 4, 3329 bd_addr : Address, 3330 link_type : LinkType, 3331 encryption_enabled : Enable, 3332} 3333 3334enum ConnectionRequestLinkType : 8 { 3335 SCO = 0x00, 3336 ACL = 0x01, 3337 ESCO = 0x02, 3338} 3339 3340packet ConnectionRequest : EventPacket (event_code = CONNECTION_REQUEST){ 3341 bd_addr : Address, 3342 class_of_device : ClassOfDevice, 3343 link_type : ConnectionRequestLinkType, 3344} 3345 3346packet DisconnectionComplete : EventPacket (event_code = DISCONNECTION_COMPLETE){ 3347 status : ErrorCode, 3348 connection_handle : 12, 3349 _reserved_ : 4, 3350 reason : ErrorCode, 3351} 3352 3353packet AuthenticationComplete : EventPacket (event_code = AUTHENTICATION_COMPLETE){ 3354 status : ErrorCode, 3355 connection_handle : 12, 3356 _reserved_ : 4, 3357} 3358 3359packet RemoteNameRequestComplete : EventPacket (event_code = REMOTE_NAME_REQUEST_COMPLETE){ 3360 status : ErrorCode, 3361 bd_addr : Address, 3362 remote_name : 8[248], // UTF-8 encoded user-friendly descriptive name 3363} 3364 3365enum EncryptionEnabled : 8 { 3366 OFF = 0x00, 3367 ON = 0x01, // E0 for BR/EDR and AES-CCM for LE 3368 BR_EDR_AES_CCM = 0x02, 3369} 3370 3371packet EncryptionChange : EventPacket (event_code = ENCRYPTION_CHANGE){ 3372 status : ErrorCode, 3373 connection_handle : 12, 3374 _reserved_ : 4, 3375 encryption_enabled : EncryptionEnabled, 3376} 3377 3378packet ChangeConnectionLinkKeyComplete : EventPacket (event_code = CHANGE_CONNECTION_LINK_KEY_COMPLETE){ 3379 status : ErrorCode, 3380 connection_handle : 12, 3381 _reserved_ : 4, 3382} 3383 3384packet MasterLinkKeyComplete : EventPacket (event_code = MASTER_LINK_KEY_COMPLETE){ 3385 status : ErrorCode, 3386 connection_handle : 12, 3387 _reserved_ : 4, 3388 key_flag : KeyFlag, 3389} 3390 3391packet ReadRemoteSupportedFeaturesComplete : EventPacket (event_code = READ_REMOTE_SUPPORTED_FEATURES_COMPLETE){ 3392 status : ErrorCode, 3393 connection_handle : 12, 3394 _reserved_ : 4, 3395 lmp_features : 64, 3396} 3397 3398packet ReadRemoteVersionInformationComplete : EventPacket (event_code = READ_REMOTE_VERSION_INFORMATION_COMPLETE){ 3399 status : ErrorCode, 3400 connection_handle : 12, 3401 _reserved_ : 4, 3402 version : 8, 3403 manufacturer_name : 16, 3404 sub_version : 16, 3405} 3406 3407packet QosSetupComplete : EventPacket (event_code = QOS_SETUP_COMPLETE){ 3408 status : ErrorCode, 3409 connection_handle : 12, 3410 _reserved_ : 4, 3411 _reserved_ : 8, 3412 service_type : ServiceType, 3413 token_rate : 32, // Octets/s 3414 peak_bandwidth : 32, // Octets/s 3415 latency : 32, // Octets/s 3416 delay_variation : 32, // microseconds 3417} 3418 3419// Command Complete and Command Status Events are implemented above Commands. 3420 3421packet HardwareError : EventPacket (event_code = HARDWARE_ERROR){ 3422 hardware_code : 8, 3423} 3424 3425packet FlushOccurred : EventPacket (event_code = FLUSH_OCCURRED){ 3426 connection_handle : 12, 3427 _reserved_ : 4, 3428} 3429 3430packet RoleChange : EventPacket (event_code = ROLE_CHANGE){ 3431 status : ErrorCode, 3432 bd_addr : Address, 3433 new_role : Role, 3434} 3435 3436packet NumberOfCompletedPackets : EventPacket (event_code = NUMBER_OF_COMPLETED_PACKETS){ 3437 _count_(completed_packets) : 8, 3438 completed_packets : CompletedPackets[], 3439} 3440 3441enum Mode : 8 { 3442 ACTIVE = 0x00, 3443 HOLD = 0x01, 3444 SNIFF = 0x02, 3445} 3446 3447packet ModeChange : EventPacket (event_code = MODE_CHANGE){ 3448 status : ErrorCode, 3449 connection_handle : 12, 3450 _reserved_ : 4, 3451 current_mode : Mode, 3452 interval : 16, // 0x002 - 0xFFFE (1.25ms - 40.9s) 3453} 3454 3455struct ZeroKeyAndAddress { 3456 address : Address, 3457 _fixed_ = 0 : 64, 3458 _fixed_ = 0 : 64, 3459} 3460 3461packet ReturnLinkKeys : EventPacket (event_code = RETURN_LINK_KEYS){ 3462 _count_(keys) : 8, 3463 keys : ZeroKeyAndAddress[], 3464} 3465 3466packet PinCodeRequest : EventPacket (event_code = PIN_CODE_REQUEST){ 3467 bd_addr : Address, 3468} 3469 3470packet LinkKeyRequest : EventPacket (event_code = LINK_KEY_REQUEST){ 3471 bd_addr : Address, 3472} 3473 3474enum KeyType : 8 { 3475 COMBINATION = 0x00, 3476 DEBUG_COMBINATION = 0x03, 3477 UNAUTHENTICATED_P192 = 0x04, 3478 AUTHENTICATED_P192 = 0x05, 3479 CHANGED = 0x06, 3480 UNAUTHENTICATED_P256 = 0x07, 3481 AUTHENTICATED_P256 = 0x08, 3482} 3483 3484packet LinkKeyNotification : EventPacket (event_code = LINK_KEY_NOTIFICATION){ 3485 bd_addr : Address, 3486 link_key : 8[16], 3487 key_type : KeyType, 3488} 3489 3490packet LoopbackCommand : EventPacket (event_code = LOOPBACK_COMMAND){ 3491 _payload_, // Command packet, truncated if it was longer than 252 bytes 3492} 3493 3494packet DataBufferOverflow : EventPacket (event_code = DATA_BUFFER_OVERFLOW){ 3495 link_type : LinkType, 3496} 3497 3498packet MaxSlotsChange : EventPacket (event_code = MAX_SLOTS_CHANGE){ 3499 connection_handle : 12, 3500 _reserved_ : 4, 3501 lmp_max_slots : 8, 3502} 3503 3504packet ReadClockOffsetComplete : EventPacket (event_code = READ_CLOCK_OFFSET_COMPLETE){ 3505 status : ErrorCode, 3506 connection_handle : 12, 3507 _reserved_ : 4, 3508 clock_offset : 15, 3509 _reserved_ : 1, 3510} 3511 3512packet ConnectionPacketTypeChanged : EventPacket (event_code = CONNECTION_PACKET_TYPE_CHANGED){ 3513 status : ErrorCode, 3514 connection_handle : 12, 3515 _reserved_ : 4, 3516 packet_type : 16, 3517} 3518 3519packet QosViolation : EventPacket (event_code = QOS_VIOLATION){ 3520 _payload_, // placeholder (unimplemented) 3521} 3522 3523packet PageScanRepetitionModeChange : EventPacket (event_code = PAGE_SCAN_REPETITION_MODE_CHANGE){ 3524 _payload_, // placeholder (unimplemented) 3525} 3526 3527packet FlowSpecificationComplete : EventPacket (event_code = FLOW_SPECIFICATION_COMPLETE){ 3528 status : ErrorCode, 3529 connection_handle : 12, 3530 _reserved_ : 4, 3531 _reserved_ : 8, 3532 flow_direction : FlowDirection, 3533 service_type : ServiceType, 3534 token_rate : 32, // Octets/s 3535 token_bucket_size : 32, 3536 peak_bandwidth : 32, // Octets/s 3537 access_latency : 32, // Octets/s 3538} 3539 3540struct InquiryResultWithRssi { 3541 address : Address, 3542 page_scan_repetition_mode : PageScanRepetitionMode, 3543 _reserved_ : 8, 3544 class_of_device : ClassOfDevice, 3545 clock_offset : 15, 3546 _reserved_ : 1, 3547 rssi : 8, 3548} 3549 3550packet InquiryResultWithRssi : EventPacket (event_code = INQUIRY_RESULT_WITH_RSSI){ 3551 _count_(inquiry_results) : 8, 3552 inquiry_results : InquiryResultWithRssi[], 3553} 3554 3555packet ReadRemoteExtendedFeaturesComplete : EventPacket (event_code = READ_REMOTE_EXTENDED_FEATURES_COMPLETE){ 3556 status : ErrorCode, 3557 connection_handle : 12, 3558 _reserved_ : 4, 3559 page_number : 8, 3560 maximum_page_number : 8, 3561 extended_lmp_features : 64, 3562} 3563 3564packet SynchronousConnectionComplete : EventPacket (event_code = SYNCHRONOUS_CONNECTION_COMPLETE){ 3565 _payload_, // placeholder (unimplemented) 3566} 3567 3568packet SynchronousConnectionChanged : EventPacket (event_code = SYNCHRONOUS_CONNECTION_CHANGED){ 3569 _payload_, // placeholder (unimplemented) 3570} 3571 3572packet SniffSubratingEvent : EventPacket (event_code = SNIFF_SUBRATING){ 3573 status : ErrorCode, 3574 connection_handle : 12, 3575 _reserved_ : 4, 3576 maximum_transmit_latency : 16, // 0x000 - 0xFFFE (0s - 40.9s) 3577 maximum_receive_latency : 16, // 0x000 - 0xFFFE (0s - 40.9s) 3578 minimum_remote_timeout : 16, // 0x000 - 0xFFFE (0s - 40.9s) 3579 minimum_local_timeout : 16, // 0x000 - 0xFFFE (0s - 40.9s) 3580} 3581 3582packet ExtendedInquiryResult : EventPacket (event_code = EXTENDED_INQUIRY_RESULT) { 3583 _fixed_ = 0x01 : 8, 3584 address : Address, 3585 page_scan_repetition_mode : PageScanRepetitionMode, 3586 _reserved_ : 8, 3587 class_of_device : ClassOfDevice, 3588 clock_offset : 15, 3589 _reserved_ : 1, 3590 rssi : 8, 3591 extended_inquiry_response : GapData[], 3592} 3593 3594packet EncryptionKeyRefreshComplete : EventPacket (event_code = ENCRYPTION_KEY_REFRESH_COMPLETE){ 3595 status : ErrorCode, 3596 connection_handle : 12, 3597 _reserved_ : 4, 3598} 3599 3600packet IoCapabilityRequest : EventPacket (event_code = IO_CAPABILITY_REQUEST){ 3601 bd_addr : Address, 3602} 3603 3604packet IoCapabilityResponse : EventPacket (event_code = IO_CAPABILITY_RESPONSE){ 3605 bd_addr : Address, 3606 io_capability : IoCapability, 3607 oob_data_present : OobDataPresent, 3608 authentication_requirements : AuthenticationRequirements, 3609} 3610 3611packet UserConfirmationRequest : EventPacket (event_code = USER_CONFIRMATION_REQUEST){ 3612 bd_addr : Address, 3613 numeric_value : 20, // 0x00000-0xF423F (000000 - 999999) 3614 _reserved_ : 12, 3615} 3616 3617packet UserPasskeyRequest : EventPacket (event_code = USER_PASSKEY_REQUEST){ 3618 bd_addr : Address, 3619} 3620 3621packet RemoteOobDataRequest : EventPacket (event_code = REMOTE_OOB_DATA_REQUEST){ 3622 bd_addr : Address, 3623} 3624 3625packet SimplePairingComplete : EventPacket (event_code = SIMPLE_PAIRING_COMPLETE){ 3626 status : ErrorCode, 3627 bd_addr : Address, 3628} 3629 3630packet LinkSupervisionTimeoutChanged : EventPacket (event_code = LINK_SUPERVISION_TIMEOUT_CHANGED){ 3631 connection_handle : 12, 3632 _reserved_ : 4, 3633 link_supervision_timeout : 16, // 0x001-0xFFFF (0.625ms-40.9s) 3634} 3635 3636packet EnhancedFlushComplete : EventPacket (event_code = ENHANCED_FLUSH_COMPLETE){ 3637 connection_handle : 12, 3638 _reserved_ : 4, 3639} 3640 3641packet UserPasskeyNotification : EventPacket (event_code = USER_PASSKEY_NOTIFICATION){ 3642 bd_addr : Address, 3643 passkey : 20, // 0x00000-0xF423F (000000 - 999999) 3644 _reserved_ : 12, 3645} 3646 3647packet KeypressNotification : EventPacket (event_code = KEYPRESS_NOTIFICATION){ 3648 bd_addr : Address, 3649 notification_type : KeypressNotificationType, 3650} 3651 3652packet RemoteHostSupportedFeaturesNotification : EventPacket (event_code = REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION){ 3653 bd_addr : Address, 3654 host_supported_features : 64, 3655} 3656 3657packet LeMetaEvent : EventPacket (event_code = LE_META_EVENT) { 3658 subevent_code : SubeventCode, 3659 _payload_, 3660} 3661 3662packet NumberOfCompletedDataBlocks : EventPacket (event_code = NUMBER_OF_COMPLETED_DATA_BLOCKS){ 3663 _payload_, // placeholder (unimplemented) 3664} 3665 3666// LE Events 3667 3668enum MasterClockAccuracy : 8 { 3669 PPM_500 = 0x00, 3670 PPM_250 = 0x01, 3671 PPM_150 = 0x02, 3672 PPM_100 = 0x03, 3673 PPM_75 = 0x04, 3674 PPM_50 = 0x05, 3675 PPM_30 = 0x06, 3676 PPM_20 = 0x07, 3677} 3678 3679packet LeConnectionComplete : LeMetaEvent (subevent_code = CONNECTION_COMPLETE) { 3680 status : ErrorCode, 3681 connection_handle : 12, 3682 _reserved_ : 4, 3683 role : Role, 3684 peer_address_type : AddressType, 3685 peer_address : Address, 3686 conn_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms) 3687 conn_latency : 16, // Number of connection events 3688 supervision_timeout : 16, // 0x000A to 0x0C80 (100ms to 32s) 3689 master_clock_accuracy : MasterClockAccuracy, 3690} 3691 3692struct LeAdvertisingReport { 3693 event_type : AdvertisingEventType, 3694 address_type : AddressType, 3695 address : Address, 3696 _size_(advertising_data) : 8, 3697 advertising_data : GapData[], 3698 rssi : 8, 3699} 3700 3701packet LeAdvertisingReport : LeMetaEvent (subevent_code = ADVERTISING_REPORT) { 3702 _count_(advertising_reports) : 8, 3703 advertising_reports : LeAdvertisingReport[], 3704} 3705 3706packet LeConnectionUpdateComplete : LeMetaEvent (subevent_code = CONNECTION_UPDATE_COMPLETE) { 3707 status : ErrorCode, 3708 connection_handle : 12, 3709 _reserved_ : 4, 3710 conn_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms) 3711 conn_latency : 16, // Number of connection events 3712 supervision_timeout : 16, // 0x000A to 0x0C80 (100ms to 32s) 3713} 3714 3715packet LeReadRemoteFeaturesComplete : LeMetaEvent (subevent_code = READ_REMOTE_FEATURES_COMPLETE) { 3716 status : ErrorCode, 3717 connection_handle : 12, 3718 _reserved_ : 4, 3719 le_features : 64, 3720} 3721 3722packet LeLongTermKeyRequest : LeMetaEvent (subevent_code = LONG_TERM_KEY_REQUEST) { 3723 status : ErrorCode, 3724 connection_handle : 12, 3725 _reserved_ : 4, 3726 random_number : 64, 3727 encrypted_diversifier : 16, 3728} 3729 3730packet LeRemoteConnectionParameterRequest : LeMetaEvent (subevent_code = REMOTE_CONNECTION_PARAMETER_REQUEST) { 3731 connection_handle : 12, 3732 _reserved_ : 4, 3733 interval_min : 16, // 0x006 - 0x0C80 (7.5ms - 4s) 3734 interval_max : 16, // 0x006 - 0x0C80 (7.5ms - 4s) 3735 latency : 16, // Number of connection events (0x0000 to 0x01f3 (499) 3736 timeout : 16, // 0x000A to 0x0C80 (100ms to 32s) 3737} 3738 3739packet LeDataLengthChange : LeMetaEvent (subevent_code = DATA_LENGTH_CHANGE) { 3740 connection_handle : 12, 3741 _reserved_ : 4, 3742 max_tx_octets : 16, // 0x001B - 0x00FB 3743 max_tx_time : 16, // 0x0148 - 0x4290 3744 max_rx_octets : 16, // 0x001B - 0x00FB 3745 max_rx_time : 16, // 0x0148 - 0x4290 3746} 3747 3748packet ReadLocalP256PublicKeyComplete : LeMetaEvent (subevent_code = READ_LOCAL_P256_PUBLIC_KEY_COMPLETE) { 3749 status : ErrorCode, 3750 local_p_256_public_key : 8[64], 3751} 3752 3753packet GenerateDhKeyComplete : LeMetaEvent (subevent_code = GENERATE_DHKEY_COMPLETE) { 3754 status : ErrorCode, 3755 dh_key : 8[32], 3756} 3757 3758packet LeEnhancedConnectionComplete : LeMetaEvent (subevent_code = ENHANCED_CONNECTION_COMPLETE) { 3759 status : ErrorCode, 3760 connection_handle : 12, 3761 _reserved_ : 4, 3762 role : Role, 3763 peer_address_type : AddressType, 3764 peer_address : Address, 3765 local_resolvable_private_address : Address, 3766 peer_resolvable_private_address : Address, 3767 conn_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms) 3768 conn_latency : 16, // Number of connection events 3769 supervision_timeout : 16, // 0x000A to 0x0C80 (100ms to 32s) 3770 master_clock_accuracy : MasterClockAccuracy, 3771} 3772 3773enum DirectAdvertisingAddressType : 8 { 3774 PUBLIC_DEVICE_ADDRESS = 0x00, 3775 RANDOM_DEVICE_ADDRESS = 0x01, 3776 PUBLIC_IDENTITY_ADDRESS = 0x02, 3777 RANDOM_IDENTITY_ADDRESS = 0x03, 3778 CONTROLLER_UNABLE_TO_RESOLVE = 0xFE, 3779 NO_ADDRESS = 0xFF, 3780} 3781 3782enum DirectAdvertisingEventType : 8 { 3783 ADV_DIRECT_IND = 0x01, 3784} 3785 3786enum DirectAddressType : 8 { 3787 RANDOM_DEVICE_ADDRESS = 0x01, 3788} 3789 3790struct LeDirectedAdvertisingReport { 3791 event_type : DirectAdvertisingEventType, 3792 address_type : DirectAdvertisingAddressType, 3793 address : Address, 3794 direct_address_type : DirectAddressType, 3795 direct_address : Address, 3796 rssi : 8, 3797} 3798 3799packet LeDirectedAdvertisingReport : LeMetaEvent (subevent_code = DIRECTED_ADVERTISING_REPORT) { 3800 _count_(advertising_reports) : 8, 3801 advertising_reports : LeDirectedAdvertisingReport[], 3802} 3803 3804packet LePhyUpdateComplete : LeMetaEvent (subevent_code = PHY_UPDATE_COMPLETE) { 3805 _payload_, // placeholder (unimplemented) 3806} 3807 3808enum DataStatus : 2 { 3809 COMPLETE = 0x0, 3810 CONTINUING = 0x1, 3811 TRUNCATED = 0x2, 3812 RESERVED = 0x3, 3813} 3814 3815struct LeExtendedAdvertisingReport { 3816 connectable : 1, 3817 scannable : 1, 3818 directed : 1, 3819 scan_response : 1, 3820 data_status : DataStatus, 3821 _reserved_ : 10, 3822 address_type : DirectAdvertisingAddressType, 3823 address : Address, 3824 primary_phy : PrimaryPhyType, 3825 secondary_phy : SecondaryPhyType, 3826 advertising_sid : 4, // SID subfield in the ADI field 3827 _reserved_ : 4, 3828 tx_power : 8, 3829 rssi : 8, // -127 to +20 (0x7F means not available) 3830 periodic_advertising_interval : 16, // 0x006 to 0xFFFF (7.5 ms to 82s) 3831 direct_address_type : DirectAdvertisingAddressType, 3832 direct_address : Address, 3833 _size_(advertising_data) : 8, 3834 advertising_data : GapData[], 3835} 3836 3837packet LeExtendedAdvertisingReport : LeMetaEvent (subevent_code = EXTENDED_ADVERTISING_REPORT) { 3838 _count_(advertising_reports) : 8, 3839 advertising_reports : LeExtendedAdvertisingReport[], 3840} 3841 3842packet LePeriodicAdvertisingSyncEstablished : LeMetaEvent (subevent_code = PERIODIC_ADVERTISING_SYNC_ESTABLISHED) { 3843 _payload_, // placeholder (unimplemented) 3844} 3845 3846packet LePeriodicAdvertisingReport : LeMetaEvent (subevent_code = PERIODIC_ADVERTISING_REPORT) { 3847 _payload_, // placeholder (unimplemented) 3848} 3849 3850packet LePeriodicAdvertisingSyncLost : LeMetaEvent (subevent_code = PERIODIC_ADVERTISING_SYNC_LOST) { 3851 _payload_, // placeholder (unimplemented) 3852} 3853 3854packet LeScanTimeout : LeMetaEvent (subevent_code = SCAN_TIMEOUT) { 3855} 3856 3857packet LeAdvertisingSetTerminated : LeMetaEvent (subevent_code = ADVERTISING_SET_TERMINATED) { 3858 status : ErrorCode, 3859 advertising_handle : 8, 3860 connection_handle : 12, 3861 _reserved_ : 4, 3862 num_completed_extended_advertising_events : 8, 3863} 3864 3865packet LeScanRequestReceived : LeMetaEvent (subevent_code = SCAN_REQUEST_RECEIVED) { 3866 advertising_handle : 8, 3867 scanner_address_type : AddressType, 3868 scanner_address : Address, 3869} 3870 3871// Vendor specific events 3872 3873packet VendorSpecificEvent : EventPacket (event_code = VENDOR_SPECIFIC) { 3874 subevent_code : VseSubeventCode, 3875 _payload_, 3876} 3877 3878enum qualityReportId : 8 { 3879 MONITOR_MODE = 0x01, 3880 APPROACH_LSTO = 0x02, 3881 A2DP_AUDIO_CHOPPY = 0x03, 3882 SCO_VOICE_CHOPPY = 0x04, 3883 ROOT_INFLAMMATION = 0x05, 3884 LMP_LL_MESSAGE_TRACE = 0x11, 3885 BT_SCHEDULING_TRACE = 0x12, 3886 CONTROLLER_DBG_INFO = 0x13, 3887} 3888 3889packet BqrEvent : VendorSpecificEvent (subevent_code = BQR_EVENT) { 3890 quality_report_id : qualityReportId, 3891 _payload_, 3892} 3893 3894enum BqrPacketType : 8 { 3895 TYPE_ID = 0x01, 3896 TYPE_NULL = 0x02, 3897 TYPE_POLL = 0x03, 3898 TYPE_FHS = 0x04, 3899 TYPE_HV1 = 0x05, 3900 TYPE_HV2 = 0x06, 3901 TYPE_HV3 = 0x07, 3902 TYPE_DV = 0x08, 3903 TYPE_EV3 = 0x09, 3904 TYPE_EV4 = 0x0A, 3905 TYPE_EV5 = 0x0B, 3906 TYPE_2EV3 = 0x0C, 3907 TYPE_2EV5 = 0x0D, 3908 TYPE_3EV3 = 0x0E, 3909 TYPE_3EV5 = 0x0F, 3910 TYPE_DM1 = 0x10, 3911 TYPE_DH1 = 0x11, 3912 TYPE_DM3 = 0x12, 3913 TYPE_DH3 = 0x13, 3914 TYPE_DM5 = 0x14, 3915 TYPE_DH5 = 0x15, 3916 TYPE_AUX1 = 0x16, 3917 TYPE_2DH1 = 0x17, 3918 TYPE_2DH3 = 0x18, 3919 TYPE_2DH5 = 0x19, 3920 TYPE_3DH1 = 0x1A, 3921 TYPE_3DH3 = 0x1B, 3922 TYPE_3DH5 = 0x1C, 3923} 3924 3925packet BqrLinkQualityEvent : BqrEvent { 3926 packet_type : BqrPacketType, 3927 connection_handle : 12, 3928 _reserved_ : 4, 3929 connection_role : Role, 3930 tx_power_level : 8, 3931 rssi : 8, 3932 snr : 8, 3933 unused_afh_channel_count : 8, 3934 afh_select_unideal_channel_count : 8, 3935 lsto : 16, 3936 connection_piconet_clock : 32, 3937 retransmission_count : 32, 3938 no_rx_count : 32, 3939 nak_count : 32, 3940 last_tx_ack_timestamp : 32, 3941 flow_off_count : 32, 3942 last_flow_on_timestamp : 32, 3943 buffer_overflow_bytes : 32, 3944 buffer_underflow_bytes : 32, 3945 _payload_, 3946} 3947 3948packet BqrMonitorModeEvent : BqrLinkQualityEvent (quality_report_id = MONITOR_MODE) { 3949 _payload_, // vendor specific parameter 3950} 3951 3952packet BqrApproachLstoEvent : BqrLinkQualityEvent (quality_report_id = APPROACH_LSTO) { 3953 _payload_, // vendor specific parameter 3954} 3955 3956packet BqrA2dpAudioChoppyEvent : BqrLinkQualityEvent (quality_report_id = A2DP_AUDIO_CHOPPY) { 3957 _payload_, // vendor specific parameter 3958} 3959 3960packet BqrScoVoiceChoppyEvent : BqrLinkQualityEvent (quality_report_id = SCO_VOICE_CHOPPY) { 3961 _payload_, // vendor specific parameter 3962} 3963 3964packet BqrRootInflammationEvent : BqrEvent (quality_report_id = ROOT_INFLAMMATION) { 3965 error_code : 8, 3966 vendor_specific_error_code : 8, 3967 _payload_, // vendor specific parameter 3968} 3969 3970packet BqrLogDumpEvent : BqrEvent { 3971 connection_handle : 12, 3972 _reserved_ : 4, 3973 _payload_, 3974} 3975 3976packet BqrLmpLlMessageTraceEvent : BqrLogDumpEvent (quality_report_id = LMP_LL_MESSAGE_TRACE) { 3977 _payload_, // vendor specific parameter 3978} 3979 3980packet BqrBtSchedulingTraceEvent : BqrLogDumpEvent (quality_report_id = BT_SCHEDULING_TRACE) { 3981 _payload_, // vendor specific parameter 3982} 3983 3984packet BqrControllerDbgInfoEvent : BqrLogDumpEvent (quality_report_id = CONTROLLER_DBG_INFO) { 3985 _payload_, // vendor specific parameter 3986} 3987