1 Bluetooth Management API 2 ************************* 3 4 Copyright (C) 2008-2009 Marcel Holtmann <marcel (a] holtmann.org> 5 6 7 Packet Structures 8 ================= 9 10 Commands: 11 12 0 4 8 12 16 22 24 28 31 35 39 43 47 13 +-------------------+-------------------+-------------------+ 14 | Command Code | Controller Index | Parameter Length | 15 +-------------------+-------------------+-------------------+ 16 | | 17 18 Events: 19 20 0 4 8 12 16 22 24 28 31 35 39 43 47 21 +-------------------+-------------------+-------------------+ 22 | Event Code | Controller Index | Parameter Length | 23 +-------------------+-------------------+-------------------+ 24 | | 25 26 Controller Index can have a special value <non-controller> to indicate that 27 command or event is not related to any controller. Possible values: 28 29 <controller id> 0x0000 to 0xFFFE 30 <non-controller> 0xFFFF 31 32 33 Read Management Version Information Command 34 =========================================== 35 36 Command Code: 0x0001 37 Controller Index: <non-controller> 38 Command Parameters: 39 Return Parameters: Version (1 Octets) 40 Revision (2 Octets) 41 42 43 Read Management Supported Features Command 44 ========================================== 45 46 Command Code: 0x0002 47 Controller Index: <non-controller> 48 Command Parameters: 49 Return Parameters: Features (8 Octets) 50 51 Feature Bit 0: Controller Support 52 Feature Bit 1: Tracing Support 53 54 55 Read Controller Index List Command 56 ================================== 57 58 Command Code: 0x0003 59 Controller Index: <non-controller> 60 Command Parameters: 61 Return Paramters: Num_Controllers (2 Octets) 62 Controller_Index[i] (2 Octets) 63 64 65 Read Controller Information Command 66 =================================== 67 68 Command Code: 0x0004 69 Controller Index: <controller id> 70 Command Parameters: 71 Return Parameters: Controller_Type (1 Octet) 72 Powered (1 octet) 73 Connectable (1 octet) 74 Discoverable (1 octet) 75 Pairable (1 octed) 76 Security_Mode (1 octed) 77 BD_ADDR (6 Octets) 78 Device_Class (3 octets) 79 Supported_Features (8 Octets) 80 Manufacturer (2 Octets) 81 HCI_Version (1 Octet) 82 HCI_Revision (2 Octets) 83 Name (249 Octets) 84 85 Controller_Type:0x00 Reserved 86 0x01 Bluetooth (BR/EDR) 87 0x02 802.11 (AMP) 88 89 90 Set Powered Command 91 =================== 92 93 Command Code: 0x0005 94 Controller Index: <controller id> 95 Command Parameters: Powered (1 Octet) 96 Return Paramters: Powered (1 Octet) 97 98 99 Set Discoverable Command 100 ======================== 101 102 Command Code: 0x0006 103 Controller Index: <controller id> 104 Command Parameters: Discoverable (1 Octet) 105 Return Paramters: Discoverable (1 Octet) 106 107 108 Set Connectable Command 109 ======================= 110 111 Command Code: 0x0007 112 Controller Index: <controller id> 113 Command Parameters: Connectable (1 Octet) 114 Return Paramters: Connectable (1 Octet) 115 116 117 Set Pairable Command 118 ==================== 119 120 Command Code: 0x0008 121 Controller Index: <controller id> 122 Command Parameters: Pairable (1 Octet) 123 Return Paramters: Pairable (1 Octet) 124 125 Add UUID Command 126 ================ 127 128 Command Code: 0x0009 129 Controller Index: <controller id> 130 Command Parameters: UUID (16 Octets) 131 SVC_Hint (1 octet) 132 Return Paramters: 133 134 135 Remove UUID Command 136 =================== 137 138 Command Code: 0x000A 139 Controller Index: <controller id> 140 Command Parameters: UUID (16 Octets) 141 Return Paramters: 142 143 144 Set Device Class 145 ================ 146 147 Command Code: 0x000B 148 Controller Index: <controller id> 149 Command Parameters: Major_Class (1 octet) 150 Minor_Class (1 octed) 151 Return Paramters: 152 153 154 Set Service Cache Command 155 ========================= 156 157 Command Code: 0x000C 158 Controller Index: <controller id> 159 Command Parameters: Enable (1 octet) 160 Return Paramters: 161 162 163 Load Keys Command 164 ================= 165 166 Command Code: 0x000D 167 Controller Index: <controller id> 168 Command Parameters: Debug_Keys (1 Octet) 169 Key_Count (2 Octets) 170 Key1 { 171 Address (6 Octets) 172 Type (1 Octet) 173 Value (16 Octets) 174 PIN_Length (1 Octet) 175 } 176 Key2 { } 177 ... 178 Return Paramters: 179 180 181 Remove Key Command 182 ================== 183 184 Command Code: 0x000E 185 Controller Index: <controller id> 186 Command Parameters: Address (6 Octets) 187 Disconnect (1 Octet) 188 Return Paramters: 189 190 191 Disconnect Command 192 ================== 193 194 Command Code: 0x000F 195 Controller Index: <controller id> 196 Command Parameters: Address (6 Octets) 197 Return Paramters: Address (6 Octets) 198 199 Get Connections Command 200 ======================= 201 202 Command Code: 0x0010 203 Controller Index: <controller id> 204 Command Parameters: 205 Return Paramters: Connection_Count (2 Octets) 206 Address1 (6 Octets) 207 Address2 (6 Octets) 208 ... 209 210 PIN Code Reply Command 211 ======================= 212 213 Command Code: 0x0011 214 Controller Index: <controller id> 215 Command Parameters: 216 Return Paramters: Address (6 Octets) 217 PIN_Length (1 Octet) 218 PIN_Code (16 Octets) 219 220 221 PIN Code Negative Reply Command 222 =============================== 223 224 Command Code: 0x0012 225 Controller Index: <controller id> 226 Command Parameters: 227 Return Paramters: Address (6 Octets) 228 229 230 Set IO Capability Command 231 ========================= 232 233 Command Code: 0x0013 234 Controller Index: <controller id> 235 Command Parameters: IO_Capability (1 Octet) 236 Return Paramters: 237 238 239 Pair Device Command 240 =================== 241 242 Command Code: 0x0014 243 Controller Index: <controller id> 244 Command Parameters: Address (6 Octets) 245 IO_Capability (1 Octet) 246 Return Paramters: Address (6 Octets) 247 Status (1 Octet) 248 249 250 User Confirmation Reply Command 251 =============================== 252 253 Command Code: 0x0015 254 Controller Index: <controller id> 255 Command Parameters: Address (6 Octets) 256 Return Paramters: Address (6 Octets) 257 Status (1 Octet) 258 259 260 User Confirmation Negative Reply Command 261 ======================================== 262 263 Command Code: 0x0016 264 Controller Index: <controller id> 265 Command Parameters: Address (6 Octets) 266 Return Paramters: Address (6 Octets) 267 Status (1 Octet) 268 269 Set Local Name Command 270 ====================== 271 272 Command Code: 0x0017 273 Controller Index: <controller id> 274 Command Parameters: Name (249 Octets) 275 Return Paramters: Name (249 Octets) 276 277 Read Local Out Of Band Data Command 278 ======================================== 279 280 Command Code: 0x0018 281 Controller Index: <controller id> 282 Command Parameters: 283 Return Paramters: Hash (16 Octets) 284 Randomizer (16 Octets) 285 286 287 Add Remote Out Of Band Data Command 288 ======================================== 289 290 Command Code: 0x0019 291 Controller Index: <controller id> 292 Command Parameters: Address (6 Octets) 293 Hash (16 Octets) 294 Randomizer (16 Octets) 295 Return Paramters: 296 297 298 Remove Remote Out Of Band Data Command 299 ======================================== 300 301 Command Code: 0x001A 302 Controller Index: <controller id> 303 Command Parameters: Address (6 Octets) 304 Return Paramters: 305 306 Start Discovery Command 307 ======================= 308 309 Command Code: 0x0001B 310 Controller Index: <controller id> 311 Command Parameters: 312 Return Parameters: 313 314 Stop Discovery Command 315 ====================== 316 317 Command Code: 0x0001C 318 Controller Index: <controller id> 319 Command Parameters: 320 Return Parameters: 321 322 Read Tracing Buffer Size Command 323 ================================ 324 325 Command Code: <not yet assigned> 326 Controller Index: <non-controller> 327 Command Parameters: 328 Return Parameters: Status (1 Octet) 329 Buffer_Size (2 Octets) 330 331 Buffer Size in Kilobytes 332 333 334 Write Tracing Buffer Size Command 335 ================================= 336 337 Command Code: <not yet assigned> 338 Controller Index: <non-controller> 339 Command Parameters: Buffer_Size (2 Octets) 340 Return Parameters: Status (1 Octet) 341 342 Buffer Size in Kilobytes 343 344 345 Read Controller Tracing Filter Command 346 ======================================= 347 348 Command Code: <not yet assigned> 349 Controller Index: <controller id> 350 Command Parameters: 351 Return Parameters: Status (1 Octet) 352 Tracing_Enable (1 Octect) 353 Num_Filters (2 Octect) 354 Protocol_UUID[i] (16 Octets) 355 Protocol_Identifier[i] (16 Octets) 356 357 Tracing_Enable: 0x00 Tracing disabled 358 0x01 Command and Event tracing 359 0x02 Command, Event and ACL tracing 360 0x03 Command, Event, ACL and SCO tracing 361 362 363 Write Controller Tracing Filter Command 364 ======================================= 365 366 Command Code: <not yet assigned> 367 Controller Index: <controller id> 368 Command Parameters: Tracing_Enable (1 Octect) 369 Num_Filters (2 Octect) 370 Protocol_UUID[i] (16 Octets) 371 Protocol_Identifier[i] (16 Octets) 372 Return Paramters: Status (1 Octet) 373 374 375 Command Complete Event 376 ====================== 377 378 Event Code 0x0001 379 Controller Index: <controller id> or <non-controller> 380 Event Parameters Command_Opcode (2 Octets) 381 Return_Parameters 382 383 384 Command Status Event 385 ==================== 386 387 Event Code 0x0002 388 Controller Index: <controller id> or <non-controller> 389 Event Parameters Status (1 Octet) 390 Command_Opcode (2 Octets) 391 392 393 Controller Error Event 394 ====================== 395 396 Event Code 0x0003 397 Controller Index: <controller id> 398 Event Parameters Error_Code (1 Octet) 399 400 401 Index Added Event 402 ================= 403 404 Event Code 0x0004 405 Controller Index: <controller id> 406 Event Parameters 407 408 409 Index Removed Event 410 =================== 411 412 Event Code 0x0005 413 Controller Index: <controller id> 414 Event Parameters 415 416 Controller Powered Event 417 ======================== 418 419 Event Code 0x0006 420 Controller Index: <controller id> 421 Event Parameters Powered (1 Octet) 422 423 Controller Discoverable Event 424 ============================= 425 426 Event Code 0x0007 427 Controller Index: <controller id> 428 Event Parameters Discoverable (1 Octet) 429 430 Controller Connectable Event 431 ============================ 432 433 Event Code 0x0008 434 Controller Index: <controller id> 435 Event Parameters Connectable (1 Octet) 436 437 Controller Pairable Event 438 ========================= 439 440 Event Code 0x0009 441 Controller Index: <controller id> 442 Event Parameters Pairable (1 Octet) 443 444 New Key Event 445 ============= 446 447 Event Code 0x000A 448 Controller Index: <controller id> 449 Event Parameters Key { 450 Address (6 Octets) 451 Type (1 Octet) 452 Value (16 Octets) 453 PIN_Length (1 Octet) 454 } 455 Old_Key_Type (1 Octet) 456 457 Device Connected Event 458 ====================== 459 460 Event Code 0x000B 461 Controller Index: <controller id> 462 Event Parameters Address (6 Octets) 463 464 Device Disconnected Event 465 ========================= 466 467 Event Code 0x000C 468 Controller Index: <controller id> 469 Event Parameters Address (6 Octets) 470 471 Connect Failed Event 472 ==================== 473 474 Event Code 0x000D 475 Controller Index: <controller id> 476 Event Parameters Address (6 Octets) 477 Status (1 Octet) 478 479 PIN Code Request Event 480 ====================== 481 482 Event Code 0x000E 483 Controller Index: <controller id> 484 Event Parameters Address (6 Octets) 485 Secure (1 Octet) 486 487 Secure: 0x01 secure PIN code required 488 0x00 secure PIN code not required 489 490 User Confirmation Request Event 491 =============================== 492 493 Event Code 0x000F 494 Controller Index: <controller id> 495 Event Parameters Address (6 Octets) 496 Value (4 Octets) 497 498 499 Authentication Failed Event 500 =========================== 501 502 Event Code 0x0010 503 Controller Index: <controller id> 504 Event Parameters Address (6 Octets) 505 Status (1 Octet) 506 507 Local Name Changed Event 508 ======================== 509 510 Event Code 0x0011 511 Controller Index <controller id> 512 Event Parameters Name (249 Octets) 513 514 Device Found Event 515 ================== 516 517 Event Code 0x0012 518 Controller Index <controller id> 519 Event Parameters Address (6 Octets) 520 Class_Of_Device (3 Octets) 521 RSSI (1 Octet) 522 EIR_Data (240 Octets) 523 524 Remote Name Event 525 ================= 526 527 Event Code 0x0013 528 Controller Index <controller id> 529 Event Parameters Address (6 Octets) 530 Name (249 Octets) 531 532 533 Discovering Event 534 ================= 535 536 Event Code 0x00014 537 Controller Index <controller id> 538 Event Parameters Discovering (1 Octet) 539