ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
bluetooth.c
Go to the documentation of this file.
1 
10 /*
11  *
12  * BlueZ - Bluetooth protocol stack for Linux
13  *
14  * Copyright (C) 2000-2001 Qualcomm Incorporated
15  * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
16  * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
17  *
18  *
19  * This program is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 2 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32  *
33  */
34 
35 #ifdef HAVE_CONFIG_H
36 #include "config.h"
37 #endif
38 
39 #include <stdio.h>
40 #include <errno.h>
41 #include <ctype.h>
42 #include <stdarg.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <sys/socket.h>
46 
47 #include "bluetooth.h"
48 #include "hci.h"
49 
50 void baswap(bdaddr_t *dst, const bdaddr_t *src)
51 {
52  register unsigned char *d = (unsigned char *) dst;
53  register const unsigned char *s = (const unsigned char *) src;
54  register int i;
55 
56  for (i = 0; i < 6; i++)
57  d[i] = s[5-i];
58 }
59 
60 char *batostr(const bdaddr_t *ba)
61 {
62  char *str = bt_malloc(18);
63  if (!str)
64  return NULL;
65 
66  sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
67  ba->b[0], ba->b[1], ba->b[2],
68  ba->b[3], ba->b[4], ba->b[5]);
69 
70  return str;
71 }
72 
73 bdaddr_t *strtoba(const char *str)
74 {
75  bdaddr_t b;
76  bdaddr_t *ba = bt_malloc(sizeof(*ba));
77 
78  if (ba) {
79  str2ba(str, &b);
80  baswap(ba, &b);
81  }
82 
83  return ba;
84 }
85 
86 int ba2str(const bdaddr_t *ba, char *str)
87 {
88  return sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
89  ba->b[5], ba->b[4], ba->b[3], ba->b[2], ba->b[1], ba->b[0]);
90 }
91 
92 int str2ba(const char *str, bdaddr_t *ba)
93 {
94  int i;
95 
96  if (bachk(str) < 0) {
97  memset(ba, 0, sizeof(*ba));
98  return -1;
99  }
100 
101  for (i = 5; i >= 0; i--, str += 3)
102  ba->b[i] = strtol(str, NULL, 16);
103 
104  return 0;
105 }
106 
107 int ba2oui(const bdaddr_t *ba, char *str)
108 {
109  return sprintf(str, "%2.2X-%2.2X-%2.2X", ba->b[5], ba->b[4], ba->b[3]);
110 }
111 
112 int bachk(const char *str)
113 {
114  if (!str)
115  return -1;
116 
117  if (strlen(str) != 17)
118  return -1;
119 
120  while (*str) {
121  if (!isxdigit(*str++))
122  return -1;
123 
124  if (!isxdigit(*str++))
125  return -1;
126 
127  if (*str == 0)
128  break;
129 
130  if (*str++ != ':')
131  return -1;
132  }
133 
134  return 0;
135 }
136 
137 int baprintf(const char *format, ...)
138 {
139  va_list ap;
140  int len;
141 
142  va_start(ap, format);
143  len = vprintf(format, ap);
144  va_end(ap);
145 
146  return len;
147 }
148 
149 int bafprintf(FILE *stream, const char *format, ...)
150 {
151  va_list ap;
152  int len;
153 
154  va_start(ap, format);
155  len = vfprintf(stream, format, ap);
156  va_end(ap);
157 
158  return len;
159 }
160 
161 int basprintf(char *str, const char *format, ...)
162 {
163  va_list ap;
164  int len;
165 
166  va_start(ap, format);
167  len = vsnprintf(str, (~0U) >> 1, format, ap);
168  va_end(ap);
169 
170  return len;
171 }
172 
173 int basnprintf(char *str, size_t size, const char *format, ...)
174 {
175  va_list ap;
176  int len;
177 
178  va_start(ap, format);
179  len = vsnprintf(str, size, format, ap);
180  va_end(ap);
181 
182  return len;
183 }
184 
185 void *bt_malloc(size_t size)
186 {
187  return malloc(size);
188 }
189 
190 void bt_free(void *ptr)
191 {
192  free(ptr);
193 }
194 
195 /* Bluetooth error codes to Unix errno mapping */
196 int bt_error(uint16_t code)
197 {
198  switch (code) {
199  case 0:
200  return 0;
201  case HCI_UNKNOWN_COMMAND:
202  return EBADRQC;
203  case HCI_NO_CONNECTION:
204  return ENOTCONN;
206  return EIO;
207  case HCI_PAGE_TIMEOUT:
208  return EHOSTDOWN;
210  return EACCES;
212  return EINVAL;
213  case HCI_MEMORY_FULL:
214  return ENOMEM;
216  return ETIMEDOUT;
219  return EMLINK;
221  return EALREADY;
225  return EBUSY;
228  case HCI_QOS_REJECTED:
229  return ECONNREFUSED;
230  case HCI_HOST_TIMEOUT:
231  return ETIMEDOUT;
239  return EOPNOTSUPP;
241  case HCI_SLOT_VIOLATION:
242  return EINVAL;
245  case HCI_OE_POWER_OFF:
246  return ECONNRESET;
248  return ECONNABORTED;
250  return ELOOP;
254  return EACCES;
256  return EPROTONOSUPPORT;
258  return ECONNREFUSED;
259  case HCI_UNKNOWN_LMP_PDU:
264  return EPROTO;
265  default:
266  return ENOSYS;
267  }
268 }
269 
270 const char *bt_compidtostr(int compid)
271 {
272  switch (compid) {
273  case 0:
274  return "Ericsson Technology Licensing";
275  case 1:
276  return "Nokia Mobile Phones";
277  case 2:
278  return "Intel Corp.";
279  case 3:
280  return "IBM Corp.";
281  case 4:
282  return "Toshiba Corp.";
283  case 5:
284  return "3Com";
285  case 6:
286  return "Microsoft";
287  case 7:
288  return "Lucent";
289  case 8:
290  return "Motorola";
291  case 9:
292  return "Infineon Technologies AG";
293  case 10:
294  return "Cambridge Silicon Radio";
295  case 11:
296  return "Silicon Wave";
297  case 12:
298  return "Digianswer A/S";
299  case 13:
300  return "Texas Instruments Inc.";
301  case 14:
302  return "Ceva, Inc. (formerly Parthus Technologies, Inc.)";
303  case 15:
304  return "Broadcom Corporation";
305  case 16:
306  return "Mitel Semiconductor";
307  case 17:
308  return "Widcomm, Inc";
309  case 18:
310  return "Zeevo, Inc.";
311  case 19:
312  return "Atmel Corporation";
313  case 20:
314  return "Mitsubishi Electric Corporation";
315  case 21:
316  return "RTX Telecom A/S";
317  case 22:
318  return "KC Technology Inc.";
319  case 23:
320  return "NewLogic";
321  case 24:
322  return "Transilica, Inc.";
323  case 25:
324  return "Rohde & Schwarz GmbH & Co. KG";
325  case 26:
326  return "TTPCom Limited";
327  case 27:
328  return "Signia Technologies, Inc.";
329  case 28:
330  return "Conexant Systems Inc.";
331  case 29:
332  return "Qualcomm";
333  case 30:
334  return "Inventel";
335  case 31:
336  return "AVM Berlin";
337  case 32:
338  return "BandSpeed, Inc.";
339  case 33:
340  return "Mansella Ltd";
341  case 34:
342  return "NEC Corporation";
343  case 35:
344  return "WavePlus Technology Co., Ltd.";
345  case 36:
346  return "Alcatel";
347  case 37:
348  return "NXP Semiconductors (formerly Philips Semiconductors)";
349  case 38:
350  return "C Technologies";
351  case 39:
352  return "Open Interface";
353  case 40:
354  return "R F Micro Devices";
355  case 41:
356  return "Hitachi Ltd";
357  case 42:
358  return "Symbol Technologies, Inc.";
359  case 43:
360  return "Tenovis";
361  case 44:
362  return "Macronix International Co. Ltd.";
363  case 45:
364  return "GCT Semiconductor";
365  case 46:
366  return "Norwood Systems";
367  case 47:
368  return "MewTel Technology Inc.";
369  case 48:
370  return "ST Microelectronics";
371  case 49:
372  return "Synopsis";
373  case 50:
374  return "Red-M (Communications) Ltd";
375  case 51:
376  return "Commil Ltd";
377  case 52:
378  return "Computer Access Technology Corporation (CATC)";
379  case 53:
380  return "Eclipse (HQ Espana) S.L.";
381  case 54:
382  return "Renesas Electronics Corporation";
383  case 55:
384  return "Mobilian Corporation";
385  case 56:
386  return "Terax";
387  case 57:
388  return "Integrated System Solution Corp.";
389  case 58:
390  return "Matsushita Electric Industrial Co., Ltd.";
391  case 59:
392  return "Gennum Corporation";
393  case 60:
394  return "BlackBerry Limited (formerly Research In Motion)";
395  case 61:
396  return "IPextreme, Inc.";
397  case 62:
398  return "Systems and Chips, Inc.";
399  case 63:
400  return "Bluetooth SIG, Inc.";
401  case 64:
402  return "Seiko Epson Corporation";
403  case 65:
404  return "Integrated Silicon Solution Taiwan, Inc.";
405  case 66:
406  return "CONWISE Technology Corporation Ltd";
407  case 67:
408  return "PARROT SA";
409  case 68:
410  return "Socket Mobile";
411  case 69:
412  return "Atheros Communications, Inc.";
413  case 70:
414  return "MediaTek, Inc.";
415  case 71:
416  return "Bluegiga";
417  case 72:
418  return "Marvell Technology Group Ltd.";
419  case 73:
420  return "3DSP Corporation";
421  case 74:
422  return "Accel Semiconductor Ltd.";
423  case 75:
424  return "Continental Automotive Systems";
425  case 76:
426  return "Apple, Inc.";
427  case 77:
428  return "Staccato Communications, Inc.";
429  case 78:
430  return "Avago Technologies";
431  case 79:
432  return "APT Licensing Ltd.";
433  case 80:
434  return "SiRF Technology";
435  case 81:
436  return "Tzero Technologies, Inc.";
437  case 82:
438  return "J&M Corporation";
439  case 83:
440  return "Free2move AB";
441  case 84:
442  return "3DiJoy Corporation";
443  case 85:
444  return "Plantronics, Inc.";
445  case 86:
446  return "Sony Ericsson Mobile Communications";
447  case 87:
448  return "Harman International Industries, Inc.";
449  case 88:
450  return "Vizio, Inc.";
451  case 89:
452  return "Nordic Semiconductor ASA";
453  case 90:
454  return "EM Microelectronic-Marin SA";
455  case 91:
456  return "Ralink Technology Corporation";
457  case 92:
458  return "Belkin International, Inc.";
459  case 93:
460  return "Realtek Semiconductor Corporation";
461  case 94:
462  return "Stonestreet One, LLC";
463  case 95:
464  return "Wicentric, Inc.";
465  case 96:
466  return "RivieraWaves S.A.S";
467  case 97:
468  return "RDA Microelectronics";
469  case 98:
470  return "Gibson Guitars";
471  case 99:
472  return "MiCommand Inc.";
473  case 100:
474  return "Band XI International, LLC";
475  case 101:
476  return "Hewlett-Packard Company";
477  case 102:
478  return "9Solutions Oy";
479  case 103:
480  return "GN Netcom A/S";
481  case 104:
482  return "General Motors";
483  case 105:
484  return "A&D Engineering, Inc.";
485  case 106:
486  return "MindTree Ltd.";
487  case 107:
488  return "Polar Electro OY";
489  case 108:
490  return "Beautiful Enterprise Co., Ltd.";
491  case 109:
492  return "BriarTek, Inc.";
493  case 110:
494  return "Summit Data Communications, Inc.";
495  case 111:
496  return "Sound ID";
497  case 112:
498  return "Monster, LLC";
499  case 113:
500  return "connectBlue AB";
501  case 114:
502  return "ShangHai Super Smart Electronics Co. Ltd.";
503  case 115:
504  return "Group Sense Ltd.";
505  case 116:
506  return "Zomm, LLC";
507  case 117:
508  return "Samsung Electronics Co. Ltd.";
509  case 118:
510  return "Creative Technology Ltd.";
511  case 119:
512  return "Laird Technologies";
513  case 120:
514  return "Nike, Inc.";
515  case 121:
516  return "lesswire AG";
517  case 122:
518  return "MStar Semiconductor, Inc.";
519  case 123:
520  return "Hanlynn Technologies";
521  case 124:
522  return "A & R Cambridge";
523  case 125:
524  return "Seers Technology Co. Ltd";
525  case 126:
526  return "Sports Tracking Technologies Ltd.";
527  case 127:
528  return "Autonet Mobile";
529  case 128:
530  return "DeLorme Publishing Company, Inc.";
531  case 129:
532  return "WuXi Vimicro";
533  case 130:
534  return "Sennheiser Communications A/S";
535  case 131:
536  return "TimeKeeping Systems, Inc.";
537  case 132:
538  return "Ludus Helsinki Ltd.";
539  case 133:
540  return "BlueRadios, Inc.";
541  case 134:
542  return "equinox AG";
543  case 135:
544  return "Garmin International, Inc.";
545  case 136:
546  return "Ecotest";
547  case 137:
548  return "GN ReSound A/S";
549  case 138:
550  return "Jawbone";
551  case 139:
552  return "Topcorn Positioning Systems, LLC";
553  case 140:
554  return "Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.)";
555  case 141:
556  return "Zscan Software";
557  case 142:
558  return "Quintic Corp.";
559  case 143:
560  return "Stollman E+V GmbH";
561  case 144:
562  return "Funai Electric Co., Ltd.";
563  case 145:
564  return "Advanced PANMOBIL Systems GmbH & Co. KG";
565  case 146:
566  return "ThinkOptics, Inc.";
567  case 147:
568  return "Universal Electronics, Inc.";
569  case 148:
570  return "Airoha Technology Corp.";
571  case 149:
572  return "NEC Lighting, Ltd.";
573  case 150:
574  return "ODM Technology, Inc.";
575  case 151:
576  return "ConnecteDevice Ltd.";
577  case 152:
578  return "zer01.tv GmbH";
579  case 153:
580  return "i.Tech Dynamic Global Distribution Ltd.";
581  case 154:
582  return "Alpwise";
583  case 155:
584  return "Jiangsu Toppower Automotive Electronics Co., Ltd.";
585  case 156:
586  return "Colorfy, Inc.";
587  case 157:
588  return "Geoforce Inc.";
589  case 158:
590  return "Bose Corporation";
591  case 159:
592  return "Suunto Oy";
593  case 160:
594  return "Kensington Computer Products Group";
595  case 161:
596  return "SR-Medizinelektronik";
597  case 162:
598  return "Vertu Corporation Limited";
599  case 163:
600  return "Meta Watch Ltd.";
601  case 164:
602  return "LINAK A/S";
603  case 165:
604  return "OTL Dynamics LLC";
605  case 166:
606  return "Panda Ocean Inc.";
607  case 167:
608  return "Visteon Corporation";
609  case 168:
610  return "ARP Devices Limited";
611  case 169:
612  return "Magneti Marelli S.p.A";
613  case 170:
614  return "CAEN RFID srl";
615  case 171:
616  return "Ingenieur-Systemgruppe Zahn GmbH";
617  case 172:
618  return "Green Throttle Games";
619  case 173:
620  return "Peter Systemtechnik GmbH";
621  case 174:
622  return "Omegawave Oy";
623  case 175:
624  return "Cinetix";
625  case 176:
626  return "Passif Semiconductor Corp";
627  case 177:
628  return "Saris Cycling Group, Inc";
629  case 178:
630  return "Bekey A/S";
631  case 179:
632  return "Clarinox Technologies Pty. Ltd.";
633  case 180:
634  return "BDE Technology Co., Ltd.";
635  case 181:
636  return "Swirl Networks";
637  case 182:
638  return "Meso international";
639  case 183:
640  return "TreLab Ltd";
641  case 184:
642  return "Qualcomm Innovation Center, Inc. (QuIC)";
643  case 185:
644  return "Johnson Controls, Inc.";
645  case 186:
646  return "Starkey Laboratories Inc.";
647  case 187:
648  return "S-Power Electronics Limited";
649  case 188:
650  return "Ace Sensor Inc";
651  case 189:
652  return "Aplix Corporation";
653  case 190:
654  return "AAMP of America";
655  case 191:
656  return "Stalmart Technology Limited";
657  case 192:
658  return "AMICCOM Electronics Corporation";
659  case 193:
660  return "Shenzhen Excelsecu Data Technology Co.,Ltd";
661  case 194:
662  return "Geneq Inc.";
663  case 195:
664  return "adidas AG";
665  case 196:
666  return "LG Electronics";
667  case 197:
668  return "Onset Computer Corporation";
669  case 198:
670  return "Selfly BV";
671  case 199:
672  return "Quuppa Oy.";
673  case 200:
674  return "GeLo Inc";
675  case 201:
676  return "Evluma";
677  case 202:
678  return "MC10";
679  case 203:
680  return "Binauric SE";
681  case 204:
682  return "Beats Electronics";
683  case 205:
684  return "Microchip Technology Inc.";
685  case 206:
686  return "Elgato Systems GmbH";
687  case 207:
688  return "ARCHOS SA";
689  case 208:
690  return "Dexcom, Inc.";
691  case 209:
692  return "Polar Electro Europe B.V.";
693  case 210:
694  return "Dialog Semiconductor B.V.";
695  case 211:
696  return "Taixingbang Technology (HK) Co,. LTD.";
697  case 212:
698  return "Kawantech";
699  case 213:
700  return "Austco Communication Systems";
701  case 214:
702  return "Timex Group USA, Inc.";
703  case 215:
704  return "Qualcomm Technologies, Inc.";
705  case 216:
706  return "Qualcomm Connected Experiences, Inc.";
707  case 217:
708  return "Voyetra Turtle Beach";
709  case 218:
710  return "txtr GmbH";
711  case 219:
712  return "Biosentronics";
713  case 220:
714  return "Procter & Gamble";
715  case 221:
716  return "Hosiden Corporation";
717  case 222:
718  return "Muzik LLC";
719  case 223:
720  return "Misfit Wearables Corp";
721  case 224:
722  return "Google";
723  case 225:
724  return "Danlers Ltd";
725  case 226:
726  return "Semilink Inc";
727  case 227:
728  return "inMusic Brands, Inc";
729  case 228:
730  return "L.S. Research Inc.";
731  case 229:
732  return "Eden Software Consultants Ltd.";
733  case 230:
734  return "Freshtemp";
735  case 231:
736  return "KS Technologies";
737  case 232:
738  return "ACTS Technologies";
739  case 233:
740  return "Vtrack Systems";
741  case 234:
742  return "Nielsen-Kellerman Company";
743  case 235:
744  return "Server Technology, Inc.";
745  case 236:
746  return "BioResearch Associates";
747  case 237:
748  return "Jolly Logic, LLC";
749  case 238:
750  return "Above Average Outcomes, Inc.";
751  case 239:
752  return "Bitsplitters GmbH";
753  case 240:
754  return "PayPal, Inc.";
755  case 241:
756  return "Witron Technology Limited";
757  case 242:
758  return "Aether Things Inc. (formerly Morse Project Inc.)";
759  case 243:
760  return "Kent Displays Inc.";
761  case 244:
762  return "Nautilus Inc.";
763  case 245:
764  return "Smartifier Oy";
765  case 246:
766  return "Elcometer Limited";
767  case 247:
768  return "VSN Technologies Inc.";
769  case 248:
770  return "AceUni Corp., Ltd.";
771  case 249:
772  return "StickNFind";
773  case 250:
774  return "Crystal Code AB";
775  case 251:
776  return "KOUKAAM a.s.";
777  case 252:
778  return "Delphi Corporation";
779  case 253:
780  return "ValenceTech Limited";
781  case 254:
782  return "Reserved";
783  case 255:
784  return "Typo Products, LLC";
785  case 256:
786  return "TomTom International BV";
787  case 257:
788  return "Fugoo, Inc";
789  case 258:
790  return "Keiser Corporation";
791  case 259:
792  return "Bang & Olufsen A/S";
793  case 260:
794  return "PLUS Locations Systems Pty Ltd";
795  case 261:
796  return "Ubiquitous Computing Technology Corporation";
797  case 262:
798  return "Innovative Yachtter Solutions";
799  case 263:
800  return "William Demant Holding A/S";
801  case 264:
802  return "Chicony Electronics Co., Ltd.";
803  case 265:
804  return "Atus BV";
805  case 266:
806  return "Codegate Ltd.";
807  case 267:
808  return "ERi, Inc.";
809  case 268:
810  return "Transducers Direct, LLC";
811  case 269:
812  return "Fujitsu Ten Limited";
813  case 270:
814  return "Audi AG";
815  case 271:
816  return "HiSilicon Technologies Co., Ltd.";
817  case 272:
818  return "Nippon Seiki Co., Ltd.";
819  case 273:
820  return "Steelseries ApS";
821  case 274:
822  return "vyzybl Inc.";
823  case 275:
824  return "Openbrain Technologies, Co., Ltd.";
825  case 276:
826  return "Xensr";
827  case 277:
828  return "e.solutions";
829  case 278:
830  return "1OAK Technologies";
831  case 279:
832  return "Wimoto Technologies Inc";
833  case 280:
834  return "Radius Networks, Inc.";
835  case 281:
836  return "Wize Technology Co., Ltd.";
837  case 282:
838  return "Qualcomm Labs, Inc.";
839  case 283:
840  return "Aruba Networks";
841  case 284:
842  return "Baidu";
843  case 285:
844  return "Arendi AG";
845  case 286:
846  return "Skoda Auto a.s.";
847  case 287:
848  return "Volkswagon AG";
849  case 288:
850  return "Porsche AG";
851  case 289:
852  return "Sino Wealth Electronic Ltd.";
853  case 290:
854  return "AirTurn, Inc.";
855  case 291:
856  return "Kinsa, Inc.";
857  case 292:
858  return "HID Global";
859  case 293:
860  return "SEAT es";
861  case 294:
862  return "Promethean Ltd.";
863  case 295:
864  return "Salutica Allied Solutions";
865  case 296:
866  return "GPSI Group Pty Ltd";
867  case 297:
868  return "Nimble Devices Oy";
869  case 298:
870  return "Changzhou Yongse Infotech Co., Ltd";
871  case 299:
872  return "SportIQ";
873  case 300:
874  return "TEMEC Instruments B.V.";
875  case 301:
876  return "Sony Corporation";
877  case 302:
878  return "ASSA ABLOY";
879  case 303:
880  return "Clarion Co., Ltd.";
881  case 304:
882  return "Warehouse Innovations";
883  case 305:
884  return "Cypress Semiconductor Corporation";
885  case 306:
886  return "MADS Inc";
887  case 307:
888  return "Blue Maestro Limited";
889  case 308:
890  return "Resolution Products, Inc.";
891  case 309:
892  return "Airewear LLC";
893  case 310:
894  return "Seed Labs, Inc. (formerly ETC sp. z.o.o.)";
895  case 311:
896  return "Prestigio Plaza Ltd.";
897  case 312:
898  return "NTEO Inc.";
899  case 313:
900  return "Focus Systems Corporation";
901  case 314:
902  return "Tencent Holdings Limited";
903  case 315:
904  return "Allegion";
905  case 316:
906  return "Murata Manufacuring Co., Ltd.";
907  case 317:
908  return "WirelessWERX";
909  case 318:
910  return "Nod, Inc.";
911  case 319:
912  return "B&B Manufacturing Company";
913  case 320:
914  return "Alpine Electronics (China) Co., Ltd";
915  case 321:
916  return "FedEx Services";
917  case 322:
918  return "Grape Systems Inc.";
919  case 323:
920  return "Bkon Connect";
921  case 324:
922  return "Lintech GmbH";
923  case 325:
924  return "Novatel Wireless";
925  case 326:
926  return "Ciright";
927  case 327:
928  return "Mighty Cast, Inc.";
929  case 328:
930  return "Ambimat Electronics";
931  case 329:
932  return "Perytons Ltd.";
933  case 330:
934  return "Tivoli Audio, LLC";
935  case 331:
936  return "Master Lock";
937  case 332:
938  return "Mesh-Net Ltd";
939  case 333:
940  return "Huizhou Desay SV Automotive CO., LTD.";
941  case 334:
942  return "Tangerine, Inc.";
943  case 335:
944  return "B&W Group Ltd.";
945  case 336:
946  return "Pioneer Corporation";
947  case 337:
948  return "OnBeep";
949  case 338:
950  return "Vernier Software & Technology";
951  case 339:
952  return "ROL Ergo";
953  case 340:
954  return "Pebble Technology";
955  case 341:
956  return "NETATMO";
957  case 342:
958  return "Accumulate AB";
959  case 343:
960  return "Anhui Huami Information Technology Co., Ltd.";
961  case 344:
962  return "Inmite s.r.o.";
963  case 345:
964  return "ChefSteps, Inc.";
965  case 346:
966  return "micas AG";
967  case 347:
968  return "Biomedical Research Ltd.";
969  case 348:
970  return "Pitius Tec S.L.";
971  case 349:
972  return "Estimote, Inc.";
973  case 350:
974  return "Unikey Technologies, Inc.";
975  case 351:
976  return "Timer Cap Co.";
977  case 352:
978  return "AwoX";
979  case 353:
980  return "yikes";
981  case 354:
982  return "MADSGlobal NZ Ltd.";
983  case 355:
984  return "PCH International";
985  case 356:
986  return "Qingdao Yeelink Information Technology Co., Ltd.";
987  case 357:
988  return "Milwaukee Tool (formerly Milwaukee Electric Tools)";
989  case 358:
990  return "MISHIK Pte Ltd";
991  case 359:
992  return "Bayer HealthCare";
993  case 360:
994  return "Spicebox LLC";
995  case 361:
996  return "emberlight";
997  case 362:
998  return "Cooper-Atkins Corporation";
999  case 363:
1000  return "Qblinks";
1001  case 364:
1002  return "MYSPHERA";
1003  case 365:
1004  return "LifeScan Inc";
1005  case 366:
1006  return "Volantic AB";
1007  case 367:
1008  return "Podo Labs, Inc";
1009  case 368:
1010  return "Roche Diabetes Care AG";
1011  case 369:
1012  return "Amazon Fulfillment Service";
1013  case 370:
1014  return "Connovate Technology Private Limited";
1015  case 371:
1016  return "Kocomojo, LLC";
1017  case 372:
1018  return "Everykey LLC";
1019  case 373:
1020  return "Dynamic Controls";
1021  case 374:
1022  return "SentriLock";
1023  case 375:
1024  return "I-SYST inc.";
1025  case 376:
1026  return "CASIO COMPUTER CO., LTD.";
1027  case 377:
1028  return "LAPIS Semiconductor Co., Ltd.";
1029  case 378:
1030  return "Telemonitor, Inc.";
1031  case 379:
1032  return "taskit GmbH";
1033  case 380:
1034  return "Daimler AG";
1035  case 381:
1036  return "BatAndCat";
1037  case 382:
1038  return "BluDotz Ltd";
1039  case 383:
1040  return "XTel ApS";
1041  case 384:
1042  return "Gigaset Communications GmbH";
1043  case 385:
1044  return "Gecko Health Innovations, Inc.";
1045  case 386:
1046  return "HOP Ubiquitous";
1047  case 387:
1048  return "To Be Assigned";
1049  case 388:
1050  return "Nectar";
1051  case 389:
1052  return "bel'apps LLC";
1053  case 390:
1054  return "CORE Lighting Ltd";
1055  case 391:
1056  return "Seraphim Sense Ltd";
1057  case 392:
1058  return "Unico RBC";
1059  case 393:
1060  return "Physical Enterprises Inc.";
1061  case 394:
1062  return "Able Trend Technology Limited";
1063  case 395:
1064  return "Konica Minolta, Inc.";
1065  case 396:
1066  return "Wilo SE";
1067  case 397:
1068  return "Extron Design Services";
1069  case 398:
1070  return "Fitbit, Inc.";
1071  case 399:
1072  return "Fireflies Systems";
1073  case 400:
1074  return "Intelletto Technologies Inc.";
1075  case 401:
1076  return "FDK CORPORATION";
1077  case 402:
1078  return "Cloudleaf, Inc";
1079  case 403:
1080  return "Maveric Automation LLC";
1081  case 404:
1082  return "Acoustic Stream Corporation";
1083  case 405:
1084  return "Zuli";
1085  case 406:
1086  return "Paxton Access Ltd";
1087  case 407:
1088  return "WiSilica Inc";
1089  case 408:
1090  return "Vengit Limited";
1091  case 409:
1092  return "SALTO SYSTEMS S.L.";
1093  case 410:
1094  return "TRON Forum (formerly T-Engine Forum)";
1095  case 411:
1096  return "CUBETECH s.r.o.";
1097  case 412:
1098  return "Cokiya Incorporated";
1099  case 413:
1100  return "CVS Health";
1101  case 414:
1102  return "Ceruus";
1103  case 415:
1104  return "Strainstall Ltd";
1105  case 416:
1106  return "Channel Enterprises (HK) Ltd.";
1107  case 417:
1108  return "FIAMM";
1109  case 418:
1110  return "GIGALANE.CO.,LTD";
1111  case 419:
1112  return "EROAD";
1113  case 420:
1114  return "Mine Safety Appliances";
1115  case 421:
1116  return "Icon Health and Fitness";
1117  case 422:
1118  return "Asandoo GmbH";
1119  case 423:
1120  return "ENERGOUS CORPORATION";
1121  case 424:
1122  return "Taobao";
1123  case 425:
1124  return "Canon Inc.";
1125  case 426:
1126  return "Geophysical Technology Inc.";
1127  case 427:
1128  return "Facebook, Inc.";
1129  case 428:
1130  return "Nipro Diagnostics, Inc.";
1131  case 429:
1132  return "FlightSafety International";
1133  case 430:
1134  return "Earlens Corporation";
1135  case 431:
1136  return "Sunrise Micro Devices, Inc.";
1137  case 432:
1138  return "Star Micronics Co., Ltd.";
1139  case 433:
1140  return "Netizens Sp. z o.o.";
1141  case 434:
1142  return "Nymi Inc.";
1143  case 435:
1144  return "Nytec, Inc.";
1145  case 436:
1146  return "Trineo Sp. z o.o.";
1147  case 437:
1148  return "Nest Labs Inc.";
1149  case 438:
1150  return "LM Technologies Ltd";
1151  case 439:
1152  return "General Electric Company";
1153  case 440:
1154  return "i+D3 S.L.";
1155  case 441:
1156  return "HANA Micron";
1157  case 442:
1158  return "Stages Cycling LLC";
1159  case 443:
1160  return "Cochlear Bone Anchored Solutions AB";
1161  case 444:
1162  return "SenionLab AB";
1163  case 445:
1164  return "Syszone Co., Ltd";
1165  case 446:
1166  return "Pulsate Mobile Ltd.";
1167  case 447:
1168  return "Hong Kong HunterSun Electronic Limited";
1169  case 448:
1170  return "pironex GmbH";
1171  case 449:
1172  return "BRADATECH Corp.";
1173  case 450:
1174  return "Transenergooil AG";
1175  case 451:
1176  return "Bunch";
1177  case 452:
1178  return "DME Microelectronics";
1179  case 453:
1180  return "Bitcraze AB";
1181  case 454:
1182  return "HASWARE Inc.";
1183  case 455:
1184  return "Abiogenix Inc.";
1185  case 456:
1186  return "Poly-Control ApS";
1187  case 457:
1188  return "Avi-on";
1189  case 458:
1190  return "Laerdal Medical AS";
1191  case 459:
1192  return "Fetch My Pet";
1193  case 460:
1194  return "Sam Labs Ltd.";
1195  case 461:
1196  return "Chengdu Synwing Technology Ltd";
1197  case 462:
1198  return "HOUWA SYSTEM DESIGN, k.k.";
1199  case 463:
1200  return "BSH";
1201  case 464:
1202  return "Primus Inter Pares Ltd";
1203  case 465:
1204  return "August";
1205  case 466:
1206  return "Gill Electronics";
1207  case 467:
1208  return "Sky Wave Design";
1209  case 468:
1210  return "Newlab S.r.l.";
1211  case 469:
1212  return "ELAD srl";
1213  case 470:
1214  return "G-wearables inc.";
1215  case 471:
1216  return "Squadrone Systems Inc.";
1217  case 472:
1218  return "Code Corporation";
1219  case 473:
1220  return "Savant Systems LLC";
1221  case 474:
1222  return "Logitech International SA";
1223  case 475:
1224  return "Innblue Consulting";
1225  case 476:
1226  return "iParking Ltd.";
1227  case 477:
1228  return "Koninklijke Philips Electronics N.V.";
1229  case 478:
1230  return "Minelab Electronics Pty Limited";
1231  case 479:
1232  return "Bison Group Ltd.";
1233  case 480:
1234  return "Widex A/S";
1235  case 481:
1236  return "Jolla Ltd";
1237  case 482:
1238  return "Lectronix, Inc.";
1239  case 483:
1240  return "Caterpillar Inc";
1241  case 484:
1242  return "Freedom Innovations";
1243  case 485:
1244  return "Dynamic Devices Ltd";
1245  case 486:
1246  return "Technology Solutions (UK) Ltd";
1247  case 487:
1248  return "IPS Group Inc.";
1249  case 488:
1250  return "STIR";
1251  case 489:
1252  return "Sano, Inc";
1253  case 490:
1254  return "Advanced Application Design, Inc.";
1255  case 491:
1256  return "AutoMap LLC";
1257  case 492:
1258  return "Spreadtrum Communications Shanghai Ltd";
1259  case 493:
1260  return "CuteCircuit LTD";
1261  case 494:
1262  return "Valeo Service";
1263  case 495:
1264  return "Fullpower Technologies, Inc.";
1265  case 496:
1266  return "KloudNation";
1267  case 497:
1268  return "Zebra Technologies Corporation";
1269  case 498:
1270  return "Itron, Inc.";
1271  case 499:
1272  return "The University of Tokyo";
1273  case 500:
1274  return "UTC Fire and Security";
1275  case 501:
1276  return "Cool Webthings Limited";
1277  case 502:
1278  return "DJO Global";
1279  case 503:
1280  return "Gelliner Limited";
1281  case 504:
1282  return "Anyka (Guangzhou) Microelectronics Technology Co, LTD";
1283  case 505:
1284  return "Medtronic, Inc.";
1285  case 506:
1286  return "Gozio, Inc.";
1287  case 507:
1288  return "Form Lifting, LLC";
1289  case 508:
1290  return "Wahoo Fitness, LLC";
1291  case 509:
1292  return "Kontakt Micro-Location Sp. z o.o.";
1293  case 510:
1294  return "Radio System Corporation";
1295  case 511:
1296  return "Freescale Semiconductor, Inc.";
1297  case 512:
1298  return "Verifone Systems PTe Ltd. Taiwan Branch";
1299  case 513:
1300  return "AR Timing";
1301  case 514:
1302  return "Rigado LLC";
1303  case 515:
1304  return "Kemppi Oy";
1305  case 516:
1306  return "Tapcentive Inc.";
1307  case 517:
1308  return "Smartbotics Inc.";
1309  case 518:
1310  return "Otter Products, LLC";
1311  case 519:
1312  return "STEMP Inc.";
1313  case 520:
1314  return "LumiGeek LLC";
1315  case 521:
1316  return "InvisionHeart Inc.";
1317  case 522:
1318  return "Macnica Inc.";
1319  case 523:
1320  return "Jaguar Land Rover Limited";
1321  case 524:
1322  return "CoroWare Technologies, Inc";
1323  case 525:
1324  return "Simplo Technology Co., LTD";
1325  case 526:
1326  return "Omron Healthcare Co., LTD";
1327  case 527:
1328  return "Comodule GMBH";
1329  case 528:
1330  return "ikeGPS";
1331  case 529:
1332  return "Telink Semiconductor Co. Ltd";
1333  case 530:
1334  return "Interplan Co., Ltd";
1335  case 531:
1336  return "Wyler AG";
1337  case 532:
1338  return "IK Multimedia Production srl";
1339  case 533:
1340  return "Lukoton Experience Oy";
1341  case 534:
1342  return "MTI Ltd";
1343  case 535:
1344  return "Tech4home, Lda";
1345  case 536:
1346  return "Hiotech AB";
1347  case 537:
1348  return "DOTT Limited";
1349  case 538:
1350  return "Blue Speck Labs, LLC";
1351  case 539:
1352  return "Cisco Systems Inc";
1353  case 540:
1354  return "Mobicomm Inc";
1355  case 541:
1356  return "Edamic";
1357  case 542:
1358  return "Goodnet Ltd";
1359  case 543:
1360  return "Luster Leaf Products Inc";
1361  case 544:
1362  return "Manus Machina BV";
1363  case 545:
1364  return "Mobiquity Networks Inc";
1365  case 546:
1366  return "Praxis Dynamics";
1367  case 547:
1368  return "Philip Morris Products S.A.";
1369  case 548:
1370  return "Comarch SA";
1371  case 549:
1372  return "Nestl Nespresso S.A.";
1373  case 550:
1374  return "Merlinia A/S";
1375  case 551:
1376  return "LifeBEAM Technologies";
1377  case 552:
1378  return "Twocanoes Labs, LLC";
1379  case 553:
1380  return "Muoverti Limited";
1381  case 554:
1382  return "Stamer Musikanlagen GMBH";
1383  case 555:
1384  return "Tesla Motors";
1385  case 556:
1386  return "Pharynks Corporation";
1387  case 557:
1388  return "Lupine";
1389  case 558:
1390  return "Siemens AG";
1391  case 559:
1392  return "Huami (Shanghai) Culture Communication CO., LTD";
1393  case 560:
1394  return "Foster Electric Company, Ltd";
1395  case 561:
1396  return "ETA SA";
1397  case 562:
1398  return "x-Senso Solutions Kft";
1399  case 563:
1400  return "Shenzhen SuLong Communication Ltd";
1401  case 564:
1402  return "FengFan (BeiJing) Technology Co, Ltd";
1403  case 565:
1404  return "Qrio Inc";
1405  case 566:
1406  return "Pitpatpet Ltd";
1407  case 567:
1408  return "MSHeli s.r.l.";
1409  case 568:
1410  return "Trakm8 Ltd";
1411  case 569:
1412  return "JIN CO, Ltd";
1413  case 570:
1414  return "Alatech Technology";
1415  case 571:
1416  return "Beijing CarePulse Electronic Technology Co, Ltd";
1417  case 572:
1418  return "Awarepoint";
1419  case 573:
1420  return "ViCentra B.V.";
1421  case 574:
1422  return "Raven Industries";
1423  case 575:
1424  return "WaveWare Technologies";
1425  case 576:
1426  return "Argenox Technologies";
1427  case 577:
1428  return "Bragi GmbH";
1429  case 578:
1430  return "16Lab Inc";
1431  case 579:
1432  return "Masimo Corp";
1433  case 580:
1434  return "Iotera Inc.";
1435  case 581:
1436  return "Endress+Hauser";
1437  case 582:
1438  return "ACKme Networks, Inc.";
1439  case 583:
1440  return "FiftyThree Inc.";
1441  case 584:
1442  return "Parker Hannifin Corp";
1443  case 585:
1444  return "Transcranial Ltd";
1445  case 586:
1446  return "Uwatec AG";
1447  case 587:
1448  return "Orlan LLC";
1449  case 588:
1450  return "Blue Clover Devices";
1451  case 65535:
1452  return "internal use";
1453  default:
1454  return "not assigned";
1455  }
1456 }
void * bt_malloc(size_t size)
Definition: bluetooth.c:185
#define HCI_SLOT_VIOLATION
Definition: hci.h:198
int bachk(const char *str)
Definition: bluetooth.c:112
const char * bt_compidtostr(int compid)
Definition: bluetooth.c:270
#define HCI_INVALID_PARAMETERS
Definition: hci.h:167
#define HCI_CLASSIFICATION_NOT_SUPPORTED
Definition: hci.h:194
#define HCI_PAGE_TIMEOUT
Definition: hci.h:153
#define HCI_ACL_CONNECTION_EXISTS
Definition: hci.h:160
#define HCI_QOS_NOT_SUPPORTED
Definition: hci.h:188
#define HCI_UNSUPPORTED_FEATURE
Definition: hci.h:166
int basnprintf(char *str, size_t size, const char *format,...)
Definition: bluetooth.c:173
#define HCI_CONNECTION_TIMEOUT
Definition: hci.h:157
#define HCI_INVALID_LMP_PARAMETERS
Definition: hci.h:179
int basprintf(char *str, const char *format,...)
Definition: bluetooth.c:161
#define HCI_CONNECTION_TERMINATED
Definition: hci.h:171
#define HCI_REJECTED_PERSONAL
Definition: hci.h:164
#define HCI_OE_USER_ENDED_CONNECTION
Definition: hci.h:168
int ba2oui(const bdaddr_t *ba, char *str)
Definition: bluetooth.c:107
char * batostr(const bdaddr_t *ba)
Definition: bluetooth.c:60
#define HCI_NO_CONNECTION
Definition: hci.h:151
bdaddr_t * strtoba(const char *str)
Definition: bluetooth.c:73
#define HCI_MEMORY_FULL
Definition: hci.h:156
#define HCI_MAX_NUMBER_OF_SCO_CONNECTIONS
Definition: hci.h:159
void baswap(bdaddr_t *dst, const bdaddr_t *src)
Definition: bluetooth.c:50
#define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE
Definition: hci.h:181
#define HCI_ENCRYPTION_MODE_NOT_ACCEPTED
Definition: hci.h:186
#define HCI_LMP_PDU_NOT_ALLOWED
Definition: hci.h:185
#define HCI_PAIRING_NOT_SUPPORTED
Definition: hci.h:190
#define HCI_AUTHENTICATION_FAILURE
Definition: hci.h:154
#define HCI_HOST_TIMEOUT
Definition: hci.h:165
#define HCI_UNSUPPORTED_REMOTE_FEATURE
Definition: hci.h:175
#define HCI_QOS_REJECTED
Definition: hci.h:193
#define HCI_PARAMETER_OUT_OF_RANGE
Definition: hci.h:196
int baprintf(const char *format,...)
Definition: bluetooth.c:137
void bt_free(void *ptr)
Definition: bluetooth.c:190
#define HCI_PAIRING_NOT_ALLOWED
Definition: hci.h:173
#define HCI_REJECTED_SECURITY
Definition: hci.h:163
#define HCI_UNKNOWN_LMP_PDU
Definition: hci.h:174
#define HCI_HARDWARE_FAILURE
Definition: hci.h:152
#define HCI_PIN_OR_KEY_MISSING
Definition: hci.h:155
#define HCI_INSUFFICIENT_SECURITY
Definition: hci.h:195
#define HCI_COMMAND_DISALLOWED
Definition: hci.h:161
int str2ba(const char *str, bdaddr_t *ba)
Definition: bluetooth.c:92
#define HCI_REPEATED_ATTEMPTS
Definition: hci.h:172
#define HCI_UNKNOWN_COMMAND
Definition: hci.h:150
#define HCI_SCO_OFFSET_REJECTED
Definition: hci.h:176
int ba2str(const bdaddr_t *ba, char *str)
Definition: bluetooth.c:86
#define HCI_REJECTED_LIMITED_RESOURCES
Definition: hci.h:162
#define HCI_TRANSACTION_COLLISION
Definition: hci.h:191
#define HCI_OE_LOW_RESOURCES
Definition: hci.h:169
#define HCI_LMP_ERROR_TRANSACTION_COLLISION
Definition: hci.h:184
#define HCI_ROLE_SWITCH_PENDING
Definition: hci.h:197
#define HCI_MAX_NUMBER_OF_CONNECTIONS
Definition: hci.h:158
int bt_error(uint16_t code)
Definition: bluetooth.c:196
#define HCI_OE_POWER_OFF
Definition: hci.h:170
int bafprintf(FILE *stream, const char *format,...)
Definition: bluetooth.c:149
#define HCI_QOS_UNACCEPTABLE_PARAMETER
Definition: hci.h:192