xref: /haiku/src/kits/bluetooth/CommandManager.cpp (revision ddac407426cd3b3d0b4589d7a161b300b3539a2a)
132c01b55SOliver Ruiz Dorantes /*
232c01b55SOliver Ruiz Dorantes  * Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
36e82afccSOliver Ruiz Dorantes  * Copyright 2008 Mika Lindqvist
432c01b55SOliver Ruiz Dorantes  * All rights reserved. Distributed under the terms of the MIT License.
532c01b55SOliver Ruiz Dorantes  */
632c01b55SOliver Ruiz Dorantes 
732c01b55SOliver Ruiz Dorantes #include "CommandManager.h"
832c01b55SOliver Ruiz Dorantes 
932c01b55SOliver Ruiz Dorantes inline void* buildCommand(uint8 ogf, uint8 ocf, void** param, size_t psize, size_t* outsize)
1032c01b55SOliver Ruiz Dorantes {
1132c01b55SOliver Ruiz Dorantes 	struct hci_command_header* header;
1232c01b55SOliver Ruiz Dorantes 
1332c01b55SOliver Ruiz Dorantes #ifdef BT_IOCTLS_PASS_SIZE
1432c01b55SOliver Ruiz Dorantes     header = (struct hci_command_header*) malloc(psize + sizeof(struct hci_command_header));
1532c01b55SOliver Ruiz Dorantes 	*outsize = psize + sizeof(struct hci_command_header);
1632c01b55SOliver Ruiz Dorantes #else
1732c01b55SOliver Ruiz Dorantes 	size_t* size = (size_t*)malloc(psize + sizeof(struct hci_command_header) + sizeof(size_t));
1832c01b55SOliver Ruiz Dorantes 	*outsize = psize + sizeof(struct hci_command_header) + sizeof(size_t);
1932c01b55SOliver Ruiz Dorantes 
2032c01b55SOliver Ruiz Dorantes     *size = psize + sizeof(struct hci_command_header);
2132c01b55SOliver Ruiz Dorantes     header = (struct hci_command_header*) (((uint8*)size)+4);
2232c01b55SOliver Ruiz Dorantes #endif
2332c01b55SOliver Ruiz Dorantes 
2432c01b55SOliver Ruiz Dorantes 
2532c01b55SOliver Ruiz Dorantes     if (header != NULL) {
2632c01b55SOliver Ruiz Dorantes 
2732c01b55SOliver Ruiz Dorantes         header->opcode = B_HOST_TO_LENDIAN_INT16(PACK_OPCODE(ogf, ocf));
2832c01b55SOliver Ruiz Dorantes         header->clen = psize;
2932c01b55SOliver Ruiz Dorantes 
3032c01b55SOliver Ruiz Dorantes         if (param != NULL && psize != 0) {
3132c01b55SOliver Ruiz Dorantes             *param = ((uint8*)header) + sizeof(struct hci_command_header);
3232c01b55SOliver Ruiz Dorantes         }
3332c01b55SOliver Ruiz Dorantes     }
3432c01b55SOliver Ruiz Dorantes #ifdef BT_IOCTLS_PASS_SIZE
3532c01b55SOliver Ruiz Dorantes     return header;
3632c01b55SOliver Ruiz Dorantes #else
3732c01b55SOliver Ruiz Dorantes     return (void*)size;
3832c01b55SOliver Ruiz Dorantes #endif
3932c01b55SOliver Ruiz Dorantes }
4032c01b55SOliver Ruiz Dorantes 
4132c01b55SOliver Ruiz Dorantes 
4232c01b55SOliver Ruiz Dorantes #if 0
4332c01b55SOliver Ruiz Dorantes #pragma mark - CONTROL BASEBAND -
4432c01b55SOliver Ruiz Dorantes #endif
4532c01b55SOliver Ruiz Dorantes 
4632c01b55SOliver Ruiz Dorantes 
4732c01b55SOliver Ruiz Dorantes void* buildReset(size_t* outsize)
4832c01b55SOliver Ruiz Dorantes {
4932c01b55SOliver Ruiz Dorantes     return buildCommand(OGF_CONTROL_BASEBAND, OCF_RESET, NULL, 0, outsize);
5032c01b55SOliver Ruiz Dorantes }
5132c01b55SOliver Ruiz Dorantes 
5232c01b55SOliver Ruiz Dorantes 
5332c01b55SOliver Ruiz Dorantes void* buildReadLocalName(size_t* outsize)
5432c01b55SOliver Ruiz Dorantes {
5532c01b55SOliver Ruiz Dorantes     return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME, NULL, 0, outsize);
5632c01b55SOliver Ruiz Dorantes }
5732c01b55SOliver Ruiz Dorantes 
5832c01b55SOliver Ruiz Dorantes 
59a2f8edf7SOliver Ruiz Dorantes void* buildReadClassOfDevice(size_t* outsize)
60a2f8edf7SOliver Ruiz Dorantes {
61a2f8edf7SOliver Ruiz Dorantes     return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_CLASS_OF_DEV, NULL, 0, outsize);
62a2f8edf7SOliver Ruiz Dorantes }
63a2f8edf7SOliver Ruiz Dorantes 
64a2f8edf7SOliver Ruiz Dorantes 
65631aa548SOliver Ruiz Dorantes void* buildWriteScan(uint8 scanmode, size_t* outsize)
66631aa548SOliver Ruiz Dorantes {
67631aa548SOliver Ruiz Dorantes     struct hci_write_scan_enable* param;
68631aa548SOliver Ruiz Dorantes 	void* command = buildCommand(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE, (void**) &param, sizeof(struct hci_write_scan_enable), outsize);
69631aa548SOliver Ruiz Dorantes 
70631aa548SOliver Ruiz Dorantes 
71631aa548SOliver Ruiz Dorantes     if (command != NULL) {
72631aa548SOliver Ruiz Dorantes         param->scan = scanmode;
73631aa548SOliver Ruiz Dorantes     }
74631aa548SOliver Ruiz Dorantes 
75631aa548SOliver Ruiz Dorantes     return command;
76631aa548SOliver Ruiz Dorantes 
77631aa548SOliver Ruiz Dorantes }
78631aa548SOliver Ruiz Dorantes 
79631aa548SOliver Ruiz Dorantes 
80631aa548SOliver Ruiz Dorantes void* buildAuthEnable(uint8 auth, size_t* outsize)
81631aa548SOliver Ruiz Dorantes {
82631aa548SOliver Ruiz Dorantes     struct hci_write_authentication_enable* param;
83631aa548SOliver Ruiz Dorantes 	void* command = buildCommand(OGF_CONTROL_BASEBAND, OCF_WRITE_AUTH_ENABLE, (void**) &param, sizeof(struct hci_write_authentication_enable), outsize);
84631aa548SOliver Ruiz Dorantes 
85631aa548SOliver Ruiz Dorantes 
86631aa548SOliver Ruiz Dorantes     if (command != NULL) {
87631aa548SOliver Ruiz Dorantes         param->authentication = auth;
88631aa548SOliver Ruiz Dorantes     }
89631aa548SOliver Ruiz Dorantes 
90631aa548SOliver Ruiz Dorantes     return command;
91631aa548SOliver Ruiz Dorantes 
92631aa548SOliver Ruiz Dorantes }
93631aa548SOliver Ruiz Dorantes 
94631aa548SOliver Ruiz Dorantes 
9532c01b55SOliver Ruiz Dorantes #if 0
9632c01b55SOliver Ruiz Dorantes #pragma mark - LINK CONTROL -
9732c01b55SOliver Ruiz Dorantes #endif
9832c01b55SOliver Ruiz Dorantes 
997434b760SOliver Ruiz Dorantes 
100631aa548SOliver Ruiz Dorantes void* buildCreateConnection(bdaddr_t bdaddr)
101631aa548SOliver Ruiz Dorantes {
102631aa548SOliver Ruiz Dorantes 	/*
103631aa548SOliver Ruiz Dorantes 	cm4.size = sizeof(struct hci_command_header)+sizeof(struct hci_cp_create_conn);
104631aa548SOliver Ruiz Dorantes 	cm4.header.opcode = B_HOST_TO_LENDIAN_INT16(hci_opcode_pack(OGF_LINK_CONTROL, OCF_CREATE_CONN));
105631aa548SOliver Ruiz Dorantes 	cm4.body.bdaddr.b[0] = 0x92;
106631aa548SOliver Ruiz Dorantes 	cm4.body.bdaddr.b[1] = 0xd3;
107631aa548SOliver Ruiz Dorantes 	cm4.body.bdaddr.b[2] = 0xaf;
108631aa548SOliver Ruiz Dorantes 	cm4.body.bdaddr.b[3] = 0xd9;
109631aa548SOliver Ruiz Dorantes 	cm4.body.bdaddr.b[4] = 0x0a;
110631aa548SOliver Ruiz Dorantes 	cm4.body.bdaddr.b[5] = 0x00;
111631aa548SOliver Ruiz Dorantes 	cm4.body.pkt_type = 0xFFFF;
112631aa548SOliver Ruiz Dorantes 	cm4.body.pscan_rep_mode = 1;
113631aa548SOliver Ruiz Dorantes 	cm4.body.pscan_mode = 0;
114631aa548SOliver Ruiz Dorantes 	cm4.body.clock_offset = 0xc7;
115631aa548SOliver Ruiz Dorantes 	cm4.body.role_switch = 1;
116631aa548SOliver Ruiz Dorantes 	cm4.header.clen = 13;
117631aa548SOliver Ruiz Dorantes 	ioctl(fd1, ISSUE_BT_COMMAND, &cm4, sizeof(cm4));
118631aa548SOliver Ruiz Dorantes 	*/
119631aa548SOliver Ruiz Dorantes 
120631aa548SOliver Ruiz Dorantes 	return NULL;
121631aa548SOliver Ruiz Dorantes }
122631aa548SOliver Ruiz Dorantes 
12332c01b55SOliver Ruiz Dorantes 
12432c01b55SOliver Ruiz Dorantes void* buildRemoteNameRequest(bdaddr_t bdaddr,uint8 pscan_rep_mode, uint16 clock_offset, size_t* outsize)
12532c01b55SOliver Ruiz Dorantes {
12632c01b55SOliver Ruiz Dorantes 
12732c01b55SOliver Ruiz Dorantes     struct hci_remote_name_request* param;
12832c01b55SOliver Ruiz Dorantes     void* command = buildCommand(OGF_LINK_CONTROL, OCF_REMOTE_NAME_REQUEST, (void**) &param, sizeof(struct hci_remote_name_request), outsize);
12932c01b55SOliver Ruiz Dorantes 
13032c01b55SOliver Ruiz Dorantes     if (command != NULL) {
13132c01b55SOliver Ruiz Dorantes         param->bdaddr = bdaddr;
13232c01b55SOliver Ruiz Dorantes         param->pscan_rep_mode = pscan_rep_mode;
13332c01b55SOliver Ruiz Dorantes         param->clock_offset = clock_offset;
13432c01b55SOliver Ruiz Dorantes     }
13532c01b55SOliver Ruiz Dorantes 
13632c01b55SOliver Ruiz Dorantes     return command;
13732c01b55SOliver Ruiz Dorantes }
13832c01b55SOliver Ruiz Dorantes 
13932c01b55SOliver Ruiz Dorantes 
14032c01b55SOliver Ruiz Dorantes void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize)
14132c01b55SOliver Ruiz Dorantes {
14232c01b55SOliver Ruiz Dorantes 
14332c01b55SOliver Ruiz Dorantes     struct hci_cp_inquiry* param;
14432c01b55SOliver Ruiz Dorantes     void* command = buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY, (void**) &param, sizeof(struct hci_cp_inquiry), outsize);
14532c01b55SOliver Ruiz Dorantes 
14632c01b55SOliver Ruiz Dorantes     if (command != NULL) {
14732c01b55SOliver Ruiz Dorantes 
14832c01b55SOliver Ruiz Dorantes 		param->lap[2] = (lap >> 16) & 0xFF;
14932c01b55SOliver Ruiz Dorantes 		param->lap[1] = (lap >>  8) & 0xFF;
15032c01b55SOliver Ruiz Dorantes     	param->lap[0] = (lap >>  0) & 0xFF;
15132c01b55SOliver Ruiz Dorantes     	param->length = length;
15232c01b55SOliver Ruiz Dorantes     	param->num_rsp = num_rsp;
153350458a6SOliver Ruiz Dorantes     }
154350458a6SOliver Ruiz Dorantes 
155350458a6SOliver Ruiz Dorantes     return command;
156350458a6SOliver Ruiz Dorantes }
157350458a6SOliver Ruiz Dorantes 
1587434b760SOliver Ruiz Dorantes 
159350458a6SOliver Ruiz Dorantes void* buildInquiryCancel(size_t* outsize)
160350458a6SOliver Ruiz Dorantes {
161350458a6SOliver Ruiz Dorantes 
162350458a6SOliver Ruiz Dorantes     return buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL, NULL, 0, outsize);
163350458a6SOliver Ruiz Dorantes 
164350458a6SOliver Ruiz Dorantes }
165350458a6SOliver Ruiz Dorantes 
166350458a6SOliver Ruiz Dorantes 
167350458a6SOliver Ruiz Dorantes void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize)
168350458a6SOliver Ruiz Dorantes {
169350458a6SOliver Ruiz Dorantes 
170350458a6SOliver Ruiz Dorantes     struct hci_cp_pin_code_reply* param;
171350458a6SOliver Ruiz Dorantes 
172350458a6SOliver Ruiz Dorantes     if (length > HCI_PIN_SIZE)  // PinCode cannot be longer than 16
173350458a6SOliver Ruiz Dorantes 	return NULL;
174350458a6SOliver Ruiz Dorantes 
175350458a6SOliver Ruiz Dorantes     void* command = buildCommand(OGF_LINK_CONTROL, OCF_PIN_CODE_REPLY, (void**) &param, sizeof(struct hci_cp_pin_code_reply), outsize);
176350458a6SOliver Ruiz Dorantes 
177350458a6SOliver Ruiz Dorantes     if (command != NULL) {
178350458a6SOliver Ruiz Dorantes 
179350458a6SOliver Ruiz Dorantes 	param->bdaddr = bdaddr;
180350458a6SOliver Ruiz Dorantes 	param->pin_len = length;
181350458a6SOliver Ruiz Dorantes     	memcpy(&param->pin_code, pincode, length);
182350458a6SOliver Ruiz Dorantes 
183350458a6SOliver Ruiz Dorantes     }
184350458a6SOliver Ruiz Dorantes 
185350458a6SOliver Ruiz Dorantes     return command;
186350458a6SOliver Ruiz Dorantes }
187350458a6SOliver Ruiz Dorantes 
188350458a6SOliver Ruiz Dorantes 
1890df89492SOliver Ruiz Dorantes void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize)
190350458a6SOliver Ruiz Dorantes {
191350458a6SOliver Ruiz Dorantes 
192350458a6SOliver Ruiz Dorantes     struct hci_cp_pin_code_neg_reply* param;
193350458a6SOliver Ruiz Dorantes 
194350458a6SOliver Ruiz Dorantes     void* command = buildCommand(OGF_LINK_CONTROL, OCF_PIN_CODE_NEG_REPLY,
195350458a6SOliver Ruiz Dorantes                                  (void**) &param, sizeof(struct hci_cp_pin_code_neg_reply), outsize);
196350458a6SOliver Ruiz Dorantes 
197350458a6SOliver Ruiz Dorantes     if (command != NULL) {
198350458a6SOliver Ruiz Dorantes 
199350458a6SOliver Ruiz Dorantes 		param->bdaddr = bdaddr;
200350458a6SOliver Ruiz Dorantes 
20132c01b55SOliver Ruiz Dorantes     }
20232c01b55SOliver Ruiz Dorantes 
20332c01b55SOliver Ruiz Dorantes     return command;
20432c01b55SOliver Ruiz Dorantes }
20532c01b55SOliver Ruiz Dorantes 
20632c01b55SOliver Ruiz Dorantes 
2077434b760SOliver Ruiz Dorantes void* buildAcceptConnectionRequest(bdaddr_t bdaddr, uint8 role, size_t* outsize)
2087434b760SOliver Ruiz Dorantes {
2097434b760SOliver Ruiz Dorantes 	struct hci_cp_accept_conn_req* param;
2107434b760SOliver Ruiz Dorantes 
2117434b760SOliver Ruiz Dorantes 	void* command = buildCommand(OGF_LINK_CONTROL, OCF_ACCEPT_CONN_REQ,
2127434b760SOliver Ruiz Dorantes 					(void**) &param, sizeof(struct hci_cp_accept_conn_req), outsize);
2137434b760SOliver Ruiz Dorantes 
2147434b760SOliver Ruiz Dorantes 	if (command != NULL) {
2157434b760SOliver Ruiz Dorantes 		param->bdaddr = bdaddr;
2167434b760SOliver Ruiz Dorantes 		param->role = role;
2177434b760SOliver Ruiz Dorantes 	}
2187434b760SOliver Ruiz Dorantes 
2197434b760SOliver Ruiz Dorantes 	return command;
2207434b760SOliver Ruiz Dorantes }
2217434b760SOliver Ruiz Dorantes 
2227434b760SOliver Ruiz Dorantes 
2237434b760SOliver Ruiz Dorantes void* buildRejectConnectionRequest(bdaddr_t bdaddr, size_t* outsize)
2247434b760SOliver Ruiz Dorantes {
2257434b760SOliver Ruiz Dorantes 	struct hci_cp_reject_conn_req* param;
2267434b760SOliver Ruiz Dorantes 
2277434b760SOliver Ruiz Dorantes 	void *command = buildCommand(OGF_LINK_CONTROL, OCF_REJECT_CONN_REQ,
2287434b760SOliver Ruiz Dorantes 					(void**) &param, sizeof(struct hci_cp_reject_conn_req), outsize);
2297434b760SOliver Ruiz Dorantes 
2307434b760SOliver Ruiz Dorantes 	if (command != NULL) {
2317434b760SOliver Ruiz Dorantes 		param->bdaddr = bdaddr;
2327434b760SOliver Ruiz Dorantes 	}
2337434b760SOliver Ruiz Dorantes 
2347434b760SOliver Ruiz Dorantes 	return command;
2357434b760SOliver Ruiz Dorantes }
2367434b760SOliver Ruiz Dorantes 
2377434b760SOliver Ruiz Dorantes 
23832c01b55SOliver Ruiz Dorantes #if 0
23932c01b55SOliver Ruiz Dorantes #pragma mark - INFORMATIONAL_PARAM -
24032c01b55SOliver Ruiz Dorantes #endif
24132c01b55SOliver Ruiz Dorantes 
242b44ee583SOliver Ruiz Dorantes void* buildReadLocalVersionInformation(size_t* outsize)
243b44ee583SOliver Ruiz Dorantes {
244b44ee583SOliver Ruiz Dorantes     return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_LOCAL_VERSION, NULL, 0, outsize);
245b44ee583SOliver Ruiz Dorantes }
246b44ee583SOliver Ruiz Dorantes 
24732c01b55SOliver Ruiz Dorantes 
24832c01b55SOliver Ruiz Dorantes void* buildReadBufferSize(size_t* outsize)
24932c01b55SOliver Ruiz Dorantes {
25032c01b55SOliver Ruiz Dorantes     return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE, NULL, 0, outsize);
25132c01b55SOliver Ruiz Dorantes }
25232c01b55SOliver Ruiz Dorantes 
25332c01b55SOliver Ruiz Dorantes 
25432c01b55SOliver Ruiz Dorantes void* buildReadBdAddr(size_t* outsize)
25532c01b55SOliver Ruiz Dorantes {
25632c01b55SOliver Ruiz Dorantes 	return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR, NULL, 0, outsize);
25732c01b55SOliver Ruiz Dorantes }
258631aa548SOliver Ruiz Dorantes 
259631aa548SOliver Ruiz Dorantes 
260a7c3c465SOliver Ruiz Dorantes const char* bluetoothManufacturers[] = {
261a7c3c465SOliver Ruiz Dorantes 	"Ericsson Technology Licensing",
262a7c3c465SOliver Ruiz Dorantes 	"Nokia Mobile Phones",
263a7c3c465SOliver Ruiz Dorantes 	"Intel Corp.",
264a7c3c465SOliver Ruiz Dorantes 	"IBM Corp.",
265a7c3c465SOliver Ruiz Dorantes 	"Toshiba Corp.",
266a7c3c465SOliver Ruiz Dorantes 	"3Com",
267a7c3c465SOliver Ruiz Dorantes 	"Microsoft",
268a7c3c465SOliver Ruiz Dorantes 	"Lucent",
269a7c3c465SOliver Ruiz Dorantes 	"Motorola",
270a7c3c465SOliver Ruiz Dorantes 	"Infineon Technologies AG",
271a7c3c465SOliver Ruiz Dorantes 	"Cambridge Silicon Radio",
272a7c3c465SOliver Ruiz Dorantes 	"Silicon Wave",
273a7c3c465SOliver Ruiz Dorantes 	"Digianswer A/S",
274a7c3c465SOliver Ruiz Dorantes 	"Texas Instruments Inc.",
275a7c3c465SOliver Ruiz Dorantes 	"Parthus Technologies Inc.",
276a7c3c465SOliver Ruiz Dorantes 	"Broadcom Corporation",
277a7c3c465SOliver Ruiz Dorantes 	"Mitel Semiconductor",
278a7c3c465SOliver Ruiz Dorantes 	"Widcomm, Inc.",
279a7c3c465SOliver Ruiz Dorantes 	"Zeevo, Inc.",
280a7c3c465SOliver Ruiz Dorantes 	"Atmel Corporation",
281a7c3c465SOliver Ruiz Dorantes 	"Mitsubishi Electric Corporation",
282a7c3c465SOliver Ruiz Dorantes 	"RTX Telecom A/S",
283a7c3c465SOliver Ruiz Dorantes 	"KC Technology Inc.",
284a7c3c465SOliver Ruiz Dorantes 	"Newlogic",
285a7c3c465SOliver Ruiz Dorantes 	"Transilica, Inc.",
286a7c3c465SOliver Ruiz Dorantes 	"Rohde & Schwartz GmbH & Co. KG",
287a7c3c465SOliver Ruiz Dorantes 	"TTPCom Limited",
288a7c3c465SOliver Ruiz Dorantes 	"Signia Technologies, Inc.",
289a7c3c465SOliver Ruiz Dorantes 	"Conexant Systems Inc.",
290a7c3c465SOliver Ruiz Dorantes 	"Qualcomm",
291a7c3c465SOliver Ruiz Dorantes 	"Inventel",
292a7c3c465SOliver Ruiz Dorantes 	"AVM Berlin",
293a7c3c465SOliver Ruiz Dorantes 	"BandSpeed, Inc.",
294a7c3c465SOliver Ruiz Dorantes 	"Mansella Ltd",
295a7c3c465SOliver Ruiz Dorantes 	"NEC Corporation",
296a7c3c465SOliver Ruiz Dorantes 	"WavePlus Technology Co., Ltd.",
297a7c3c465SOliver Ruiz Dorantes 	"Alcatel",
298a7c3c465SOliver Ruiz Dorantes 	"Philips Semiconductors",
299a7c3c465SOliver Ruiz Dorantes 	"C Technologies",
300a7c3c465SOliver Ruiz Dorantes 	"Open Interface",
301a7c3c465SOliver Ruiz Dorantes 	"R F Micro Devices",
302a7c3c465SOliver Ruiz Dorantes 	"Hitachi Ltd",
303a7c3c465SOliver Ruiz Dorantes 	"Symbol Technologies, Inc.",
304a7c3c465SOliver Ruiz Dorantes 	"Tenovis",
305a7c3c465SOliver Ruiz Dorantes 	"Macronix International Co. Ltd.",
306a7c3c465SOliver Ruiz Dorantes 	"GCT Semiconductor",
307a7c3c465SOliver Ruiz Dorantes 	"Norwood Systems",
308a7c3c465SOliver Ruiz Dorantes 	"MewTel Technology Inc.",
309a7c3c465SOliver Ruiz Dorantes 	"ST Microelectronics",
310a7c3c465SOliver Ruiz Dorantes 	"Synopsys",
311a7c3c465SOliver Ruiz Dorantes 	"Red-M (Communications) Ltd",
312a7c3c465SOliver Ruiz Dorantes 	"Commil Ltd",
313a7c3c465SOliver Ruiz Dorantes 	"Computer Access Technology Corporation (CATC)",
314b3064a44SOliver Ruiz Dorantes 	"Eclipse (HQ España) S.L.",
315a7c3c465SOliver Ruiz Dorantes 	"Renesas Technology Corp.",
316a7c3c465SOliver Ruiz Dorantes 	"Mobilian Corporation",
317a7c3c465SOliver Ruiz Dorantes 	"Terax",
3183c2f52adSOliver Ruiz Dorantes 	"Integrated System Solution Corp.",
319a7c3c465SOliver Ruiz Dorantes 	"Matsushita Electric Industrial Co., Ltd.",
320a7c3c465SOliver Ruiz Dorantes 	"Gennum Corporation",
321a7c3c465SOliver Ruiz Dorantes 	"Research In Motion",
322a7c3c465SOliver Ruiz Dorantes 	"IPextreme, Inc.",
323a7c3c465SOliver Ruiz Dorantes 	"Systems and Chips, Inc",
324a7c3c465SOliver Ruiz Dorantes 	"Bluetooth SIG, Inc",
325a7c3c465SOliver Ruiz Dorantes 	"Seiko Epson Corporation",
326a7c3c465SOliver Ruiz Dorantes 	"Integrated Silicon Solution Taiwain, Inc.",
327a7c3c465SOliver Ruiz Dorantes 	"CONWISE Technology Corporation Ltd",
328b3064a44SOliver Ruiz Dorantes 	"PARROT SA",
329a7c3c465SOliver Ruiz Dorantes 	"Socket Communications",
330a7c3c465SOliver Ruiz Dorantes 	"Atheros Communications, Inc.",
331a7c3c465SOliver Ruiz Dorantes 	"MediaTek, Inc.",
332a7c3c465SOliver Ruiz Dorantes 	"Bluegiga",	/* (tentative) */
333a7c3c465SOliver Ruiz Dorantes 	"Marvell Technology Group Ltd.",
334a7c3c465SOliver Ruiz Dorantes 	"3DSP Corporation",
335a7c3c465SOliver Ruiz Dorantes 	"Accel Semiconductor Ltd.",
336a7c3c465SOliver Ruiz Dorantes 	"Continental Automotive Systems",
337a7c3c465SOliver Ruiz Dorantes 	"Apple, Inc.",
338a7c3c465SOliver Ruiz Dorantes 	"Staccato Communications, Inc."
339a7c3c465SOliver Ruiz Dorantes };
340631aa548SOliver Ruiz Dorantes 
341631aa548SOliver Ruiz Dorantes 
342a7c3c465SOliver Ruiz Dorantes const char* linkControlCommands[] = {
343a7c3c465SOliver Ruiz Dorantes 	"Inquiry",
344a7c3c465SOliver Ruiz Dorantes 	"Inquiry Cancel",
345a7c3c465SOliver Ruiz Dorantes 	"Periodic Inquiry Mode",
346a7c3c465SOliver Ruiz Dorantes 	"Exit Periodic Inquiry Mode",
347a7c3c465SOliver Ruiz Dorantes 	"Create Connection",
348a7c3c465SOliver Ruiz Dorantes 	"Disconnect",
349a7c3c465SOliver Ruiz Dorantes 	"Add SCO Connection", // not on 2.1
350a7c3c465SOliver Ruiz Dorantes 	"Cancel Create Connection",
351a7c3c465SOliver Ruiz Dorantes 	"Accept Connection Request",
352a7c3c465SOliver Ruiz Dorantes 	"Reject Connection Request",
353a7c3c465SOliver Ruiz Dorantes 	"Link Key Request Reply",
354a7c3c465SOliver Ruiz Dorantes 	"Link Key Request Negative Reply",
355a7c3c465SOliver Ruiz Dorantes 	"PIN Code Request Reply",
356a7c3c465SOliver Ruiz Dorantes 	"PIN Code Request Negative Reply",
357a7c3c465SOliver Ruiz Dorantes 	"Change Connection Packet Type",
358b3064a44SOliver Ruiz Dorantes 	"Reserved", // not on 2.1",
359a7c3c465SOliver Ruiz Dorantes 	"Authentication Requested",
360b3064a44SOliver Ruiz Dorantes 	"Reserved", // not on 2.1",
361a7c3c465SOliver Ruiz Dorantes 	"Set Connection Encryption",
362b3064a44SOliver Ruiz Dorantes 	"Reserved", // not on 2.1",
363a7c3c465SOliver Ruiz Dorantes 	"Change Connection Link Key",
364b3064a44SOliver Ruiz Dorantes 	"Reserved", // not on 2.1",
365a7c3c465SOliver Ruiz Dorantes 	"Master Link Key",
366b3064a44SOliver Ruiz Dorantes 	"Reserved", // not on 2.1",
367a7c3c465SOliver Ruiz Dorantes 	"Remote Name Request",
368a7c3c465SOliver Ruiz Dorantes 	"Cancel Remote Name Request",
369a7c3c465SOliver Ruiz Dorantes 	"Read Remote Supported Features",
370a7c3c465SOliver Ruiz Dorantes 	"Read Remote Extended Features",
371a7c3c465SOliver Ruiz Dorantes 	"Read Remote Version Information",
372b3064a44SOliver Ruiz Dorantes 	"Reserved", // not on 2.1",
373a7c3c465SOliver Ruiz Dorantes 	"Read Clock Offset",
374a7c3c465SOliver Ruiz Dorantes 	"Read LMP Handle",
375a7c3c465SOliver Ruiz Dorantes 	"Reserved",
376a7c3c465SOliver Ruiz Dorantes 	"Reserved",
377a7c3c465SOliver Ruiz Dorantes 	"Reserved",
378a7c3c465SOliver Ruiz Dorantes 	"Reserved",
379a7c3c465SOliver Ruiz Dorantes 	"Reserved",
380a7c3c465SOliver Ruiz Dorantes 	"Reserved",
381a7c3c465SOliver Ruiz Dorantes 	"Reserved",
382a7c3c465SOliver Ruiz Dorantes 	"Setup Synchronous Connection",
383a7c3c465SOliver Ruiz Dorantes 	"Accept Synchronous Connection",
384a7c3c465SOliver Ruiz Dorantes 	"Reject Synchronous Connection",
385a7c3c465SOliver Ruiz Dorantes 	"IO Capability Request Reply",
386a7c3c465SOliver Ruiz Dorantes 	"User Confirmation Request Reply",
387a7c3c465SOliver Ruiz Dorantes 	"User Confirmation Request Negative Reply",
388a7c3c465SOliver Ruiz Dorantes 	"User Passkey Request Reply",
389a7c3c465SOliver Ruiz Dorantes 	"User Passkey Request Negative Reply",
390a7c3c465SOliver Ruiz Dorantes 	"Remote OOB Data Request Reply",
391a7c3c465SOliver Ruiz Dorantes 	"Reserved",
392a7c3c465SOliver Ruiz Dorantes 	"Reserved",
393a7c3c465SOliver Ruiz Dorantes 	"Remote OOB Data Request Negative Reply",
394a7c3c465SOliver Ruiz Dorantes 	"IO Capabilities Response Negative Reply"
395a7c3c465SOliver Ruiz Dorantes };
396a7c3c465SOliver Ruiz Dorantes 
397a7c3c465SOliver Ruiz Dorantes 
398a7c3c465SOliver Ruiz Dorantes const char* linkPolicyCommands[] = {
399a7c3c465SOliver Ruiz Dorantes 	"Hold Mode",
400a7c3c465SOliver Ruiz Dorantes 	"Reserved",
401a7c3c465SOliver Ruiz Dorantes 	"Sniff Mode",
402a7c3c465SOliver Ruiz Dorantes 	"Exit Sniff Mode",
403a7c3c465SOliver Ruiz Dorantes 	"Park State",
404a7c3c465SOliver Ruiz Dorantes 	"Exit Park State",
405a7c3c465SOliver Ruiz Dorantes 	"QoS Setup",
406a7c3c465SOliver Ruiz Dorantes 	"Reserved",
407a7c3c465SOliver Ruiz Dorantes 	"Role Discovery",
408a7c3c465SOliver Ruiz Dorantes 	"Reserved",
409a7c3c465SOliver Ruiz Dorantes 	"Switch Role",
410a7c3c465SOliver Ruiz Dorantes 	"Read Link Policy Settings",
411a7c3c465SOliver Ruiz Dorantes 	"Write Link Policy Settings",
412a7c3c465SOliver Ruiz Dorantes 	"Read Default Link Policy Settings",
413a7c3c465SOliver Ruiz Dorantes 	"Write Default Link Policy Settings",
414a7c3c465SOliver Ruiz Dorantes 	"Flow Specification",
415a7c3c465SOliver Ruiz Dorantes 	"Sniff Subrating"
416a7c3c465SOliver Ruiz Dorantes };
417a7c3c465SOliver Ruiz Dorantes 
418a7c3c465SOliver Ruiz Dorantes 
419a7c3c465SOliver Ruiz Dorantes const char* controllerBasebandCommands[] = {
420a7c3c465SOliver Ruiz Dorantes 	"Set Event Mask",
421a7c3c465SOliver Ruiz Dorantes 	"Reserved",
422a7c3c465SOliver Ruiz Dorantes 	"Reset",
423a7c3c465SOliver Ruiz Dorantes 	"Reserved",
424a7c3c465SOliver Ruiz Dorantes 	"Set Event Filter",
425a7c3c465SOliver Ruiz Dorantes 	"Reserved",
426a7c3c465SOliver Ruiz Dorantes 	"Reserved",
427a7c3c465SOliver Ruiz Dorantes 	"Flush",
428a7c3c465SOliver Ruiz Dorantes 	"Read PIN Type",
429a7c3c465SOliver Ruiz Dorantes 	"Write PIN Type",
430a7c3c465SOliver Ruiz Dorantes 	"Create New Unit Key",
431a7c3c465SOliver Ruiz Dorantes 	"Reserved",
432a7c3c465SOliver Ruiz Dorantes 	"Read Stored Link Key",
433a7c3c465SOliver Ruiz Dorantes 	"Reserved",
434a7c3c465SOliver Ruiz Dorantes 	"Reserved",
435a7c3c465SOliver Ruiz Dorantes 	"Reserved",
436a7c3c465SOliver Ruiz Dorantes 	"Write Stored Link Key",
437a7c3c465SOliver Ruiz Dorantes 	"Delete Stored Link Key",
438a7c3c465SOliver Ruiz Dorantes 	"Write Local Name",
439a7c3c465SOliver Ruiz Dorantes 	"Read Local Name",
440a7c3c465SOliver Ruiz Dorantes 	"Read Connection Accept Timeout",
441a7c3c465SOliver Ruiz Dorantes 	"Write Connection Accept Timeout",
442a7c3c465SOliver Ruiz Dorantes 	"Read Page Timeout",
443a7c3c465SOliver Ruiz Dorantes 	"Write Page Timeout",
444a7c3c465SOliver Ruiz Dorantes 	"Read Scan Enable",
445a7c3c465SOliver Ruiz Dorantes 	"Write Scan Enable",
446a7c3c465SOliver Ruiz Dorantes 	"Read Page Scan Activity",
447a7c3c465SOliver Ruiz Dorantes 	"Write Page Scan Activity",
448a7c3c465SOliver Ruiz Dorantes 	"Read Inquiry Scan Activity",
449a7c3c465SOliver Ruiz Dorantes 	"Write Inquiry Scan Activity",
450a7c3c465SOliver Ruiz Dorantes 	"Read Authentication Enable",
451a7c3c465SOliver Ruiz Dorantes 	"Write Authentication Enable",
452a7c3c465SOliver Ruiz Dorantes 	"Read Encryption Mode", // not 2.1
453a7c3c465SOliver Ruiz Dorantes 	"Write Encryption Mode",// not 2.1
454a7c3c465SOliver Ruiz Dorantes 	"Read Class Of Device",
455a7c3c465SOliver Ruiz Dorantes 	"Write Class Of Device",
456a7c3c465SOliver Ruiz Dorantes 	"Read Voice Setting",
457a7c3c465SOliver Ruiz Dorantes 	"Write Voice Setting",
458a7c3c465SOliver Ruiz Dorantes 	"Read Automatic Flush Timeout",
459a7c3c465SOliver Ruiz Dorantes 	"Write Automatic Flush Timeout",
460a7c3c465SOliver Ruiz Dorantes 	"Read Num Broadcast Retransmissions",
461a7c3c465SOliver Ruiz Dorantes 	"Write Num Broadcast Retransmissions",
462a7c3c465SOliver Ruiz Dorantes 	"Read Hold Mode Activity",
463a7c3c465SOliver Ruiz Dorantes 	"Write Hold Mode Activity",
464a7c3c465SOliver Ruiz Dorantes 	"Read Transmit Power Level",
465a7c3c465SOliver Ruiz Dorantes 	"Read Synchronous Flow Control Enable",
466a7c3c465SOliver Ruiz Dorantes 	"Write Synchronous Flow Control Enable",
467a7c3c465SOliver Ruiz Dorantes 	"Reserved",
468a7c3c465SOliver Ruiz Dorantes 	"Set Host Controller To Host Flow Control",
469a7c3c465SOliver Ruiz Dorantes 	"Reserved",
470a7c3c465SOliver Ruiz Dorantes 	"Host Buffer Size",
471a7c3c465SOliver Ruiz Dorantes 	"Reserved",
472a7c3c465SOliver Ruiz Dorantes 	"Host Number Of Completed Packets",
473a7c3c465SOliver Ruiz Dorantes 	"Read Link Supervision Timeout",
474a7c3c465SOliver Ruiz Dorantes 	"Write Link Supervision Timeout",
475a7c3c465SOliver Ruiz Dorantes 	"Read Number of Supported IAC",
476a7c3c465SOliver Ruiz Dorantes 	"Read Current IAC LAP",
477a7c3c465SOliver Ruiz Dorantes 	"Write Current IAC LAP",
478a7c3c465SOliver Ruiz Dorantes 	"Read Page Scan Period Mode", // not 2.1
479a7c3c465SOliver Ruiz Dorantes 	"Write Page Scan Period Mode", // not 2.1
480a7c3c465SOliver Ruiz Dorantes 	"Read Page Scan Mode",		// not 2.1
481a7c3c465SOliver Ruiz Dorantes 	"Write Page Scan Mode",		// not 2.1
482a7c3c465SOliver Ruiz Dorantes 	"Set AFH Channel Classification",
483a7c3c465SOliver Ruiz Dorantes 	"Reserved",
484a7c3c465SOliver Ruiz Dorantes 	"Reserved",
485a7c3c465SOliver Ruiz Dorantes 	"Read Inquiry Scan Type",
486a7c3c465SOliver Ruiz Dorantes 	"Write Inquiry Scan Type",
487a7c3c465SOliver Ruiz Dorantes 	"Read Inquiry Mode",
488a7c3c465SOliver Ruiz Dorantes 	"Write Inquiry Mode",
489a7c3c465SOliver Ruiz Dorantes 	"Read Page Scan Type",
490a7c3c465SOliver Ruiz Dorantes 	"Write Page Scan Type",
491a7c3c465SOliver Ruiz Dorantes 	"Read AFH Channel Assessment Mode",
492a7c3c465SOliver Ruiz Dorantes 	"Write AFH Channel Assessment Mode",
493a7c3c465SOliver Ruiz Dorantes 	"Reserved",
494a7c3c465SOliver Ruiz Dorantes 	"Reserved",
495a7c3c465SOliver Ruiz Dorantes 	"Reserved",
496a7c3c465SOliver Ruiz Dorantes 	"Reserved",
497a7c3c465SOliver Ruiz Dorantes 	"Reserved",
498a7c3c465SOliver Ruiz Dorantes 	"Reserved",
499a7c3c465SOliver Ruiz Dorantes 	"Reserved",
500a7c3c465SOliver Ruiz Dorantes 	"Read Extended Inquiry Response",
501a7c3c465SOliver Ruiz Dorantes 	"Write Extended Inquiry Response",
502a7c3c465SOliver Ruiz Dorantes 	"Refresh Encryption Key",
503a7c3c465SOliver Ruiz Dorantes 	"Reserved",
504a7c3c465SOliver Ruiz Dorantes 	"Read Simple Pairing Mode",
505a7c3c465SOliver Ruiz Dorantes 	"Write Simple Pairing Mode",
506a7c3c465SOliver Ruiz Dorantes 	"Read Local OOB Data",
507a7c3c465SOliver Ruiz Dorantes 	"Read Inquiry Transmit Power Level",
508a7c3c465SOliver Ruiz Dorantes 	"Write Inquiry Transmit Power Level",
509a7c3c465SOliver Ruiz Dorantes 	"Read Default Erroneous Data Reporting",
510a7c3c465SOliver Ruiz Dorantes 	"Write Default Erroneous Data Reporting",
511a7c3c465SOliver Ruiz Dorantes 	"Reserved",
512a7c3c465SOliver Ruiz Dorantes 	"Reserved",
513a7c3c465SOliver Ruiz Dorantes 	"Reserved",
514a7c3c465SOliver Ruiz Dorantes 	"Enhanced Flush",
515a7c3c465SOliver Ruiz Dorantes 	"Send Keypress Notification"
516a7c3c465SOliver Ruiz Dorantes };
517a7c3c465SOliver Ruiz Dorantes 
518a7c3c465SOliver Ruiz Dorantes 
519a7c3c465SOliver Ruiz Dorantes const char* informationalParametersCommands[] = {
520a7c3c465SOliver Ruiz Dorantes 	"Read Local Version Information",
521a7c3c465SOliver Ruiz Dorantes 	"Read Local Supported Commands",
522a7c3c465SOliver Ruiz Dorantes 	"Read Local Supported Features",
523a7c3c465SOliver Ruiz Dorantes 	"Read Local Extended Features",
524a7c3c465SOliver Ruiz Dorantes 	"Read Buffer Size",
525a7c3c465SOliver Ruiz Dorantes 	"Reserved",
526a7c3c465SOliver Ruiz Dorantes 	"Read Country Code", // not 2.1
527a7c3c465SOliver Ruiz Dorantes 	"Reserved",
528a7c3c465SOliver Ruiz Dorantes 	"Read BD ADDR"
529a7c3c465SOliver Ruiz Dorantes };
530a7c3c465SOliver Ruiz Dorantes 
531a7c3c465SOliver Ruiz Dorantes 
532a7c3c465SOliver Ruiz Dorantes const char* statusParametersCommands[] = {
533a7c3c465SOliver Ruiz Dorantes 	"Read Failed Contact Counter",
534a7c3c465SOliver Ruiz Dorantes 	"Reset Failed Contact Counter",
535a7c3c465SOliver Ruiz Dorantes 	"Read Link Quality",
536a7c3c465SOliver Ruiz Dorantes 	"Reserved",
537a7c3c465SOliver Ruiz Dorantes 	"Read RSSI",
538a7c3c465SOliver Ruiz Dorantes 	"Read AFH Channel Map",
539a7c3c465SOliver Ruiz Dorantes 	"Read Clock",
540a7c3c465SOliver Ruiz Dorantes };
541a7c3c465SOliver Ruiz Dorantes 
542a7c3c465SOliver Ruiz Dorantes 
543a7c3c465SOliver Ruiz Dorantes const char* testingCommands[] = {
544a7c3c465SOliver Ruiz Dorantes 	"Read Loopback Mode",
545a7c3c465SOliver Ruiz Dorantes 	"Write Loopback Mode",
546a7c3c465SOliver Ruiz Dorantes 	"Enable Device Under Test Mode",
547a7c3c465SOliver Ruiz Dorantes 	"Write Simple Pairing Debug Mode",
548a7c3c465SOliver Ruiz Dorantes };
549a7c3c465SOliver Ruiz Dorantes 
550a7c3c465SOliver Ruiz Dorantes 
551d081e691SOliver Ruiz Dorantes const char* bluetoothEvents[] = {
552d081e691SOliver Ruiz Dorantes 	"Inquiry Complete",
553d081e691SOliver Ruiz Dorantes 	"Inquiry Result",
554d081e691SOliver Ruiz Dorantes 	"Conn Complete",
555d081e691SOliver Ruiz Dorantes 	"Conn Request",
556d081e691SOliver Ruiz Dorantes 	"Disconnection Complete",
557d081e691SOliver Ruiz Dorantes 	"Auth Complete",
558d081e691SOliver Ruiz Dorantes 	"Remote Name Request Complete",
559d081e691SOliver Ruiz Dorantes 	"Encrypt Change",
560d081e691SOliver Ruiz Dorantes 	"Change Conn Link Key Complete",
561d081e691SOliver Ruiz Dorantes 	"Master Link Key Compl",
562d081e691SOliver Ruiz Dorantes 	"Rmt Features",
563d081e691SOliver Ruiz Dorantes 	"Rmt Version",
564d081e691SOliver Ruiz Dorantes 	"Qos Setup Complete",
565d081e691SOliver Ruiz Dorantes 	"Command Complete",
566d081e691SOliver Ruiz Dorantes 	"Command Status",
567d081e691SOliver Ruiz Dorantes 	"Hardware Error",
568d081e691SOliver Ruiz Dorantes 	"Flush Occur",
569d081e691SOliver Ruiz Dorantes 	"Role Change",
570d081e691SOliver Ruiz Dorantes 	"Num Comp Pkts",
571d081e691SOliver Ruiz Dorantes 	"Mode Change",
572d081e691SOliver Ruiz Dorantes 	"Return Link Keys",
573d081e691SOliver Ruiz Dorantes 	"Pin Code Req",
574d081e691SOliver Ruiz Dorantes 	"Link Key Req",
575d081e691SOliver Ruiz Dorantes 	"Link Key Notify",
576d081e691SOliver Ruiz Dorantes 	"Loopback Command",
577d081e691SOliver Ruiz Dorantes 	"Data Buffer Overflow",
578d081e691SOliver Ruiz Dorantes 	"Max Slot Change",
579d081e691SOliver Ruiz Dorantes 	"Read Clock Offset Compl",
580d081e691SOliver Ruiz Dorantes 	"Con Pkt Type Changed",
581d081e691SOliver Ruiz Dorantes 	"Qos Violation",
582d081e691SOliver Ruiz Dorantes 	"Reserved",
583d081e691SOliver Ruiz Dorantes 	"Page Scan Rep Mode Change",
584d081e691SOliver Ruiz Dorantes 	"Flow Specification",
585d081e691SOliver Ruiz Dorantes 	"Inquiry Result With Rssi",
586d081e691SOliver Ruiz Dorantes 	"Remote Extended Features",
587d081e691SOliver Ruiz Dorantes 	"Reserved",
588d081e691SOliver Ruiz Dorantes 	"Reserved",
589d081e691SOliver Ruiz Dorantes 	"Reserved",
590d081e691SOliver Ruiz Dorantes 	"Reserved",
591d081e691SOliver Ruiz Dorantes 	"Reserved",
592d081e691SOliver Ruiz Dorantes 	"Reserved",
593d081e691SOliver Ruiz Dorantes 	"Reserved",
594d081e691SOliver Ruiz Dorantes 	"Reserved",
595d081e691SOliver Ruiz Dorantes 	"Synchronous Connection Completed",
596d081e691SOliver Ruiz Dorantes 	"Synchronous Connection Changed",
597d081e691SOliver Ruiz Dorantes 	"Reserved",
598d081e691SOliver Ruiz Dorantes 	"Extended Inquiry Result",
599*ddac4074SOliver Ruiz Dorantes 	"Encryption Key Refresh Complete",
600d081e691SOliver Ruiz Dorantes 	"Io Capability Request",
601d081e691SOliver Ruiz Dorantes 	"Io Capability Response",
602d081e691SOliver Ruiz Dorantes 	"User Confirmation Request",
603d081e691SOliver Ruiz Dorantes 	"User Passkey Request",
604d081e691SOliver Ruiz Dorantes 	"Oob Data Request",
605d081e691SOliver Ruiz Dorantes 	"Simple Pairing Complete",
606d081e691SOliver Ruiz Dorantes 	"Reserved",
607d081e691SOliver Ruiz Dorantes 	"Link Supervision Timeout Changed",
608d081e691SOliver Ruiz Dorantes 	"Enhanced Flush Complete",
609d081e691SOliver Ruiz Dorantes 	"Reserved",
610d081e691SOliver Ruiz Dorantes 	"Reserved",
611d081e691SOliver Ruiz Dorantes 	"Keypress Notification",
612d081e691SOliver Ruiz Dorantes 	"Remote Host Supported Features Notification"
613d081e691SOliver Ruiz Dorantes };
614d081e691SOliver Ruiz Dorantes 
615d081e691SOliver Ruiz Dorantes 
616880e5727SOliver Ruiz Dorantes const char* bluetoothErrors[] = {
617880e5727SOliver Ruiz Dorantes 	"No Error",
618880e5727SOliver Ruiz Dorantes 	"Unknown Command",
619880e5727SOliver Ruiz Dorantes 	"No Connection",
620880e5727SOliver Ruiz Dorantes 	"Hardware Failure",
621880e5727SOliver Ruiz Dorantes 	"Page Timeout",
622880e5727SOliver Ruiz Dorantes 	"Authentication Failure",
623880e5727SOliver Ruiz Dorantes 	"Pin Or Key Missing",
624880e5727SOliver Ruiz Dorantes 	"Memory Full",
625880e5727SOliver Ruiz Dorantes 	"Connection Timeout",
626880e5727SOliver Ruiz Dorantes 	"Max Number Of Connections",
627880e5727SOliver Ruiz Dorantes 	"Max Number Of Sco Connections",
628880e5727SOliver Ruiz Dorantes 	"Acl Connection Exists",
629880e5727SOliver Ruiz Dorantes 	"Command Disallowed",
630880e5727SOliver Ruiz Dorantes 	"Rejected Limited Resources",
631880e5727SOliver Ruiz Dorantes 	"Rejected Security",
632880e5727SOliver Ruiz Dorantes 	"Rejected Personal",
633880e5727SOliver Ruiz Dorantes 	"Host Timeout",
634880e5727SOliver Ruiz Dorantes 	"Unsupported Feature",
635880e5727SOliver Ruiz Dorantes 	"Invalid Parameters",
636880e5727SOliver Ruiz Dorantes 	"Remote User Ended Connection",
637880e5727SOliver Ruiz Dorantes 	"Remote Low Resources",
638880e5727SOliver Ruiz Dorantes 	"Remote Power Off",
639880e5727SOliver Ruiz Dorantes 	"Connection Terminated",
640880e5727SOliver Ruiz Dorantes 	"Repeated Attempts",
641880e5727SOliver Ruiz Dorantes 	"Pairing Not Allowed",
642880e5727SOliver Ruiz Dorantes 	"Unknown Lmp Pdu",
643880e5727SOliver Ruiz Dorantes 	"Unsupported Remote Feature",
644880e5727SOliver Ruiz Dorantes 	"Sco Offset Rejected",
645880e5727SOliver Ruiz Dorantes 	"Sco Interval Rejected",
646880e5727SOliver Ruiz Dorantes 	"Air Mode Rejected",
647880e5727SOliver Ruiz Dorantes 	"Invalid Lmp Parameters",
648880e5727SOliver Ruiz Dorantes 	"Unspecified Error",
649880e5727SOliver Ruiz Dorantes 	"Unsupported Lmp Parameter Value",
650880e5727SOliver Ruiz Dorantes 	"Role Change Not Allowed",
651880e5727SOliver Ruiz Dorantes 	"Lmp Response Timeout",
652880e5727SOliver Ruiz Dorantes 	"Lmp Error Transaction Collision",
653880e5727SOliver Ruiz Dorantes 	"Lmp Pdu Not Allowed",
654880e5727SOliver Ruiz Dorantes 	"Encryption Mode Not Accepted",
655880e5727SOliver Ruiz Dorantes 	"Unit Link Key Used",
656880e5727SOliver Ruiz Dorantes 	"Qos Not Supported",
657880e5727SOliver Ruiz Dorantes 	"Instant Passed",
658880e5727SOliver Ruiz Dorantes 	"Pairing With Unit Key Not Supported",
659880e5727SOliver Ruiz Dorantes 	"Different Transaction Collision",
660880e5727SOliver Ruiz Dorantes 	"Qos Unacceptable Parameter",
661880e5727SOliver Ruiz Dorantes 	"Qos Rejected",
662880e5727SOliver Ruiz Dorantes 	"Classification Not Supported",
663880e5727SOliver Ruiz Dorantes 	"Insufficient Security",
664880e5727SOliver Ruiz Dorantes 	"Parameter Out Of Range",
665880e5727SOliver Ruiz Dorantes 	"Reserved",
666880e5727SOliver Ruiz Dorantes 	"Role Switch Pending",
667880e5727SOliver Ruiz Dorantes 	"Reserved",
668880e5727SOliver Ruiz Dorantes 	"Slot Violation",
669880e5727SOliver Ruiz Dorantes 	"Role Switch Failed",
670880e5727SOliver Ruiz Dorantes 	"Extended Inquiry Response Too Large",
671880e5727SOliver Ruiz Dorantes 	"Simple Pairing Not Supported By Host",
672880e5727SOliver Ruiz Dorantes 	"Host Busy Pairing"
673880e5727SOliver Ruiz Dorantes };
674880e5727SOliver Ruiz Dorantes 
675880e5727SOliver Ruiz Dorantes 
6768dc33083SOliver Ruiz Dorantes const char* hciVersion[] = { "1.0B" , "1.1 " , "1.2 " , "2.0 " , "2.1 "};
6778dc33083SOliver Ruiz Dorantes const char* lmpVersion[] = { "1.0 " , "1.1 " , "1.2 " , "2.0 " , "2.1 "};
678bd88ac97SOliver Ruiz Dorantes 
679bd88ac97SOliver Ruiz Dorantes 
680bd88ac97SOliver Ruiz Dorantes const char*
681*ddac4074SOliver Ruiz Dorantes BluetoothHciVersion(uint16 ver)
682bd88ac97SOliver Ruiz Dorantes {
683bd88ac97SOliver Ruiz Dorantes 	return hciVersion[ver];
684bd88ac97SOliver Ruiz Dorantes }
685bd88ac97SOliver Ruiz Dorantes 
686bd88ac97SOliver Ruiz Dorantes 
687bd88ac97SOliver Ruiz Dorantes const char*
688*ddac4074SOliver Ruiz Dorantes BluetoothLmpVersion(uint16 ver)
689bd88ac97SOliver Ruiz Dorantes {
690bd88ac97SOliver Ruiz Dorantes 	return lmpVersion[ver];
691bd88ac97SOliver Ruiz Dorantes }
692bd88ac97SOliver Ruiz Dorantes 
693bd88ac97SOliver Ruiz Dorantes 
694a7c3c465SOliver Ruiz Dorantes const char*
695*ddac4074SOliver Ruiz Dorantes BluetoothCommandOpcode(uint16 opcode)
696a7c3c465SOliver Ruiz Dorantes {
69732261764SOliver Ruiz Dorantes 
698*ddac4074SOliver Ruiz Dorantes 	// NOTE: BT implementations beyond 2.1
699a7c3c465SOliver Ruiz Dorantes 	// could specify new commands with OCF numbers
700a7c3c465SOliver Ruiz Dorantes 	// beyond the boundaries of the arrays and crash.
701a7c3c465SOliver Ruiz Dorantes 	// But only our stack could issue them so its under
702a7c3c465SOliver Ruiz Dorantes 	// our control.
703*ddac4074SOliver Ruiz Dorantes 	switch (GET_OPCODE_OGF(opcode)) {
704a7c3c465SOliver Ruiz Dorantes 		case OGF_LINK_CONTROL:
705*ddac4074SOliver Ruiz Dorantes 			return linkControlCommands[GET_OPCODE_OCF(opcode)-1];
706a7c3c465SOliver Ruiz Dorantes 			break;
707a7c3c465SOliver Ruiz Dorantes 
708a7c3c465SOliver Ruiz Dorantes 		case OGF_LINK_POLICY:
709*ddac4074SOliver Ruiz Dorantes 			return linkPolicyCommands[GET_OPCODE_OCF(opcode)-1];
710a7c3c465SOliver Ruiz Dorantes 			break;
711a7c3c465SOliver Ruiz Dorantes 
712a7c3c465SOliver Ruiz Dorantes 		case OGF_CONTROL_BASEBAND:
713*ddac4074SOliver Ruiz Dorantes 			return controllerBasebandCommands[GET_OPCODE_OCF(opcode)-1];
714a7c3c465SOliver Ruiz Dorantes 			break;
715a7c3c465SOliver Ruiz Dorantes 
716a7c3c465SOliver Ruiz Dorantes 		case OGF_INFORMATIONAL_PARAM:
717*ddac4074SOliver Ruiz Dorantes 			return informationalParametersCommands[GET_OPCODE_OCF(opcode)-1];
718a7c3c465SOliver Ruiz Dorantes 			break;
719a7c3c465SOliver Ruiz Dorantes 
720a7c3c465SOliver Ruiz Dorantes 		case OGF_STATUS_PARAM:
721*ddac4074SOliver Ruiz Dorantes 			return statusParametersCommands[GET_OPCODE_OCF(opcode)-1];
722a7c3c465SOliver Ruiz Dorantes 			break;
723a7c3c465SOliver Ruiz Dorantes 
724a7c3c465SOliver Ruiz Dorantes 		case OGF_TESTING_CMD:
725*ddac4074SOliver Ruiz Dorantes 			return testingCommands[GET_OPCODE_OCF(opcode)-1];
726a7c3c465SOliver Ruiz Dorantes 			break;
7270b5931e0SOliver Ruiz Dorantes 		case OGF_VENDOR_CMD:
7280b5931e0SOliver Ruiz Dorantes 			return "Vendor specific command";
7290b5931e0SOliver Ruiz Dorantes 			break;
730a7c3c465SOliver Ruiz Dorantes 		default:
731a7c3c465SOliver Ruiz Dorantes 			return "Unknown command";
732a7c3c465SOliver Ruiz Dorantes 			break;
733a7c3c465SOliver Ruiz Dorantes 	}
734a7c3c465SOliver Ruiz Dorantes 
735a7c3c465SOliver Ruiz Dorantes }
736a7c3c465SOliver Ruiz Dorantes 
737a7c3c465SOliver Ruiz Dorantes 
738a7c3c465SOliver Ruiz Dorantes const char*
739*ddac4074SOliver Ruiz Dorantes BluetoothEvent(uint8 event) {
740*ddac4074SOliver Ruiz Dorantes 
741d081e691SOliver Ruiz Dorantes 	if (event < sizeof(bluetoothEvents) / sizeof(const char*)) {
742d081e691SOliver Ruiz Dorantes 		return bluetoothEvents[event-1];
743d081e691SOliver Ruiz Dorantes 	} else {
744d081e691SOliver Ruiz Dorantes 		return "Event out of Range!";
745d081e691SOliver Ruiz Dorantes 	}
746d081e691SOliver Ruiz Dorantes }
747d081e691SOliver Ruiz Dorantes 
748d081e691SOliver Ruiz Dorantes 
749d081e691SOliver Ruiz Dorantes const char*
750*ddac4074SOliver Ruiz Dorantes BluetoothManufacturer(uint16 manufacturer) {
751*ddac4074SOliver Ruiz Dorantes 
752a7c3c465SOliver Ruiz Dorantes 	if (manufacturer < sizeof(bluetoothManufacturers) / sizeof(const char*)) {
753a7c3c465SOliver Ruiz Dorantes 		return bluetoothManufacturers[manufacturer];
754a7c3c465SOliver Ruiz Dorantes 	} else if (manufacturer == 0xFFFF) {
755a7c3c465SOliver Ruiz Dorantes 		return "internal use";
756a7c3c465SOliver Ruiz Dorantes 	} else {
757a7c3c465SOliver Ruiz Dorantes 		return "not assigned";
758a7c3c465SOliver Ruiz Dorantes 	}
759a7c3c465SOliver Ruiz Dorantes }
760880e5727SOliver Ruiz Dorantes 
761880e5727SOliver Ruiz Dorantes 
762880e5727SOliver Ruiz Dorantes const char*
763*ddac4074SOliver Ruiz Dorantes BluetoothError(uint8 error) {
764*ddac4074SOliver Ruiz Dorantes 
765880e5727SOliver Ruiz Dorantes 	if (error < sizeof(bluetoothErrors) / sizeof(const char*)) {
766880e5727SOliver Ruiz Dorantes 		return bluetoothErrors[error];
767880e5727SOliver Ruiz Dorantes 	} else {
768880e5727SOliver Ruiz Dorantes 		return "not specified";
769880e5727SOliver Ruiz Dorantes     }
770880e5727SOliver Ruiz Dorantes }
771880e5727SOliver Ruiz Dorantes 
772