1Bluetooth Management API 2************************* 3 4Copyright (C) 2008-2009 Marcel Holtmann <marcel@holtmann.org> 5 6 7Packet 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 26Controller Index can have a special value <non-controller> to indicate that 27command or event is not related to any controller. Possible values: 28 29 <controller id> 0x0000 to 0xFFFE 30 <non-controller> 0xFFFF 31 32 33Read 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 43Read 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 55Read 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 65Read 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 90Set 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 99Set 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 108Set 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 117Set 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 125Add 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 135Remove UUID Command 136=================== 137 138 Command Code: 0x000A 139 Controller Index: <controller id> 140 Command Parameters: UUID (16 Octets) 141 Return Paramters: 142 143 144Set 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 154Set 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 163Load 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 181Remove 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 191Disconnect 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 199Get 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 210PIN 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 221PIN 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 230Set 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 239Pair 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 250User 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 260User 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 269Set 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 277Read 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 287Add 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 298Remove 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 306Start Discovery Command 307======================= 308 309 Command Code: 0x0001B 310 Controller Index: <controller id> 311 Command Parameters: 312 Return Parameters: 313 314Stop Discovery Command 315====================== 316 317 Command Code: 0x0001C 318 Controller Index: <controller id> 319 Command Parameters: 320 Return Parameters: 321 322Read 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 334Write 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 345Read 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 363Write 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 375Command Complete Event 376====================== 377 378Event Code 0x0001 379Controller Index: <controller id> or <non-controller> 380Event Parameters Command_Opcode (2 Octets) 381 Return_Parameters 382 383 384Command Status Event 385==================== 386 387Event Code 0x0002 388Controller Index: <controller id> or <non-controller> 389Event Parameters Status (1 Octet) 390 Command_Opcode (2 Octets) 391 392 393Controller Error Event 394====================== 395 396Event Code 0x0003 397Controller Index: <controller id> 398Event Parameters Error_Code (1 Octet) 399 400 401Index Added Event 402================= 403 404Event Code 0x0004 405Controller Index: <controller id> 406Event Parameters 407 408 409Index Removed Event 410=================== 411 412Event Code 0x0005 413Controller Index: <controller id> 414Event Parameters 415 416Controller Powered Event 417======================== 418 419Event Code 0x0006 420Controller Index: <controller id> 421Event Parameters Powered (1 Octet) 422 423Controller Discoverable Event 424============================= 425 426Event Code 0x0007 427Controller Index: <controller id> 428Event Parameters Discoverable (1 Octet) 429 430Controller Connectable Event 431============================ 432 433Event Code 0x0008 434Controller Index: <controller id> 435Event Parameters Connectable (1 Octet) 436 437Controller Pairable Event 438========================= 439 440Event Code 0x0009 441Controller Index: <controller id> 442Event Parameters Pairable (1 Octet) 443 444New Key Event 445============= 446 447Event Code 0x000A 448Controller Index: <controller id> 449Event 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 457Device Connected Event 458====================== 459 460Event Code 0x000B 461Controller Index: <controller id> 462Event Parameters Address (6 Octets) 463 464Device Disconnected Event 465========================= 466 467Event Code 0x000C 468Controller Index: <controller id> 469Event Parameters Address (6 Octets) 470 471Connect Failed Event 472==================== 473 474Event Code 0x000D 475Controller Index: <controller id> 476Event Parameters Address (6 Octets) 477 Status (1 Octet) 478 479PIN Code Request Event 480====================== 481 482Event Code 0x000E 483Controller Index: <controller id> 484Event Parameters Address (6 Octets) 485 Secure (1 Octet) 486 487 Secure: 0x01 secure PIN code required 488 0x00 secure PIN code not required 489 490User Confirmation Request Event 491=============================== 492 493Event Code 0x000F 494Controller Index: <controller id> 495Event Parameters Address (6 Octets) 496 Value (4 Octets) 497 498 499Authentication Failed Event 500=========================== 501 502Event Code 0x0010 503Controller Index: <controller id> 504Event Parameters Address (6 Octets) 505 Status (1 Octet) 506 507Local Name Changed Event 508======================== 509 510Event Code 0x0011 511Controller Index <controller id> 512Event Parameters Name (249 Octets) 513 514Device Found Event 515================== 516 517Event Code 0x0012 518Controller Index <controller id> 519Event Parameters Address (6 Octets) 520 Class_Of_Device (3 Octets) 521 RSSI (1 Octet) 522 EIR_Data (240 Octets) 523 524Remote Name Event 525================= 526 527Event Code 0x0013 528Controller Index <controller id> 529Event Parameters Address (6 Octets) 530 Name (249 Octets) 531 532 533Discovering Event 534================= 535 536Event Code 0x00014 537Controller Index <controller id> 538Event Parameters Discovering (1 Octet) 539