device: Set disconnect timer to zero for fast disconnection
[platform/upstream/bluez.git] / monitor / uuid.c
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2011-2014  Intel Corporation
6  *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public
11  *  License as published by the Free Software Foundation; either
12  *  version 2.1 of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28
29 #include <stdio.h>
30 #include <string.h>
31
32 #include "uuid.h"
33
34 static const struct {
35         uint16_t uuid;
36         const char *str;
37 } uuid16_table[] = {
38         { 0x0001, "SDP"                                         },
39         { 0x0003, "RFCOMM"                                      },
40         { 0x0005, "TCS-BIN"                                     },
41         { 0x0007, "ATT"                                         },
42         { 0x0008, "OBEX"                                        },
43         { 0x000f, "BNEP"                                        },
44         { 0x0010, "UPNP"                                        },
45         { 0x0011, "HIDP"                                        },
46         { 0x0012, "Hardcopy Control Channel"                    },
47         { 0x0014, "Hardcopy Data Channel"                       },
48         { 0x0016, "Hardcopy Notification"                       },
49         { 0x0017, "AVCTP"                                       },
50         { 0x0019, "AVDTP"                                       },
51         { 0x001b, "CMTP"                                        },
52         { 0x001e, "MCAP Control Channel"                        },
53         { 0x001f, "MCAP Data Channel"                           },
54         { 0x0100, "L2CAP"                                       },
55         /* 0x0101 to 0x0fff undefined */
56         { 0x1000, "Service Discovery Server Service Class"      },
57         { 0x1001, "Browse Group Descriptor Service Class"       },
58         { 0x1002, "Public Browse Root"                          },
59         /* 0x1003 to 0x1100 undefined */
60         { 0x1101, "Serial Port"                                 },
61         { 0x1102, "LAN Access Using PPP"                        },
62         { 0x1103, "Dialup Networking"                           },
63         { 0x1104, "IrMC Sync"                                   },
64         { 0x1105, "OBEX Object Push"                            },
65         { 0x1106, "OBEX File Transfer"                          },
66         { 0x1107, "IrMC Sync Command"                           },
67         { 0x1108, "Headset"                                     },
68         { 0x1109, "Cordless Telephony"                          },
69         { 0x110a, "Audio Source"                                },
70         { 0x110b, "Audio Sink"                                  },
71         { 0x110c, "A/V Remote Control Target"                   },
72         { 0x110d, "Advanced Audio Distribution"                 },
73         { 0x110e, "A/V Remote Control"                          },
74         { 0x110f, "A/V Remote Control Controller"               },
75         { 0x1110, "Intercom"                                    },
76         { 0x1111, "Fax"                                         },
77         { 0x1112, "Headset AG"                                  },
78         { 0x1113, "WAP"                                         },
79         { 0x1114, "WAP Client"                                  },
80         { 0x1115, "PANU"                                        },
81         { 0x1116, "NAP"                                         },
82         { 0x1117, "GN"                                          },
83         { 0x1118, "Direct Printing"                             },
84         { 0x1119, "Reference Printing"                          },
85         { 0x111a, "Basic Imaging Profile"                       },
86         { 0x111b, "Imaging Responder"                           },
87         { 0x111c, "Imaging Automatic Archive"                   },
88         { 0x111d, "Imaging Referenced Objects"                  },
89         { 0x111e, "Handsfree"                                   },
90         { 0x111f, "Handsfree Audio Gateway"                     },
91         { 0x1120, "Direct Printing Refrence Objects Service"    },
92         { 0x1121, "Reflected UI"                                },
93         { 0x1122, "Basic Printing"                              },
94         { 0x1123, "Printing Status"                             },
95         { 0x1124, "Human Interface Device Service"              },
96         { 0x1125, "Hardcopy Cable Replacement"                  },
97         { 0x1126, "HCR Print"                                   },
98         { 0x1127, "HCR Scan"                                    },
99         { 0x1128, "Common ISDN Access"                          },
100         /* 0x1129 and 0x112a undefined */
101         { 0x112d, "SIM Access"                                  },
102         { 0x112e, "Phonebook Access Client"                     },
103         { 0x112f, "Phonebook Access Server"                     },
104         { 0x1130, "Phonebook Access"                            },
105         { 0x1131, "Headset HS"                                  },
106         { 0x1132, "Message Access Server"                       },
107         { 0x1133, "Message Notification Server"                 },
108         { 0x1134, "Message Access Profile"                      },
109         { 0x1135, "GNSS"                                        },
110         { 0x1136, "GNSS Server"                                 },
111         { 0x1137, "3D Display"                                  },
112         { 0x1138, "3D Glasses"                                  },
113         { 0x1139, "3D Synchronization"                          },
114         { 0x113a, "MPS Profile"                                 },
115         { 0x113b, "MPS Service"                                 },
116         /* 0x113c to 0x11ff undefined */
117         { 0x1200, "PnP Information"                             },
118         { 0x1201, "Generic Networking"                          },
119         { 0x1202, "Generic File Transfer"                       },
120         { 0x1203, "Generic Audio"                               },
121         { 0x1204, "Generic Telephony"                           },
122         { 0x1205, "UPNP Service"                                },
123         { 0x1206, "UPNP IP Service"                             },
124         { 0x1300, "UPNP IP PAN"                                 },
125         { 0x1301, "UPNP IP LAP"                                 },
126         { 0x1302, "UPNP IP L2CAP"                               },
127         { 0x1303, "Video Source"                                },
128         { 0x1304, "Video Sink"                                  },
129         { 0x1305, "Video Distribution"                          },
130         /* 0x1306 to 0x13ff undefined */
131         { 0x1400, "HDP"                                         },
132         { 0x1401, "HDP Source"                                  },
133         { 0x1402, "HDP Sink"                                    },
134         /* 0x1403 to 0x17ff undefined */
135         { 0x1800, "Generic Access Profile"                      },
136         { 0x1801, "Generic Attribute Profile"                   },
137         { 0x1802, "Immediate Alert"                             },
138         { 0x1803, "Link Loss"                                   },
139         { 0x1804, "Tx Power"                                    },
140         { 0x1805, "Current Time Service"                        },
141         { 0x1806, "Reference Time Update Service"               },
142         { 0x1807, "Next DST Change Service"                     },
143         { 0x1808, "Glucose"                                     },
144         { 0x1809, "Health Thermometer"                          },
145         { 0x180a, "Device Information"                          },
146         /* 0x180b and 0x180c undefined */
147         { 0x180d, "Heart Rate"                                  },
148         { 0x180e, "Phone Alert Status Service"                  },
149         { 0x180f, "Battery Service"                             },
150         { 0x1810, "Blood Pressure"                              },
151         { 0x1811, "Alert Notification Service"                  },
152         { 0x1812, "Human Interface Device"                      },
153         { 0x1813, "Scan Parameters"                             },
154         { 0x1814, "Running Speed and Cadence"                   },
155         { 0x1815, "Automation IO"                               },
156         { 0x1816, "Cycling Speed and Cadence"                   },
157         /* 0x1817 undefined */
158         { 0x1818, "Cycling Power"                               },
159         { 0x1819, "Location and Navigation"                     },
160         { 0x181a, "Environmental Sensing"                       },
161         { 0x181b, "Body Composition"                            },
162         { 0x181c, "User Data"                                   },
163         { 0x181d, "Weight Scale"                                },
164         { 0x181e, "Bond Management"                             },
165         { 0x181f, "Continuous Glucose Monitoring"               },
166         { 0x1820, "Internet Protocol Support"                   },
167         { 0x1821, "Indoor Positioning"                          },
168         { 0x1822, "Pulse Oximeter"                              },
169         { 0x1823, "HTTP Proxy"                                  },
170         { 0x1824, "Transport Discovery"                         },
171         { 0x1825, "Object Transfer"                             },
172         /* 0x1824 to 0x27ff undefined */
173         { 0x2800, "Primary Service"                             },
174         { 0x2801, "Secondary Service"                           },
175         { 0x2802, "Include"                                     },
176         { 0x2803, "Characteristic"                              },
177         /* 0x2804 to 0x28ff undefined */
178         { 0x2900, "Characteristic Extended Properties"          },
179         { 0x2901, "Characteristic User Description"             },
180         { 0x2902, "Client Characteristic Configuration"         },
181         { 0x2903, "Server Characteristic Configuration"         },
182         { 0x2904, "Characteristic Format"                       },
183         { 0x2905, "Characteristic Aggregate Formate"            },
184         { 0x2906, "Valid Range"                                 },
185         { 0x2907, "External Report Reference"                   },
186         { 0x2908, "Report Reference"                            },
187         { 0x2909, "Number of Digitals"                          },
188         { 0x290a, "Value Trigger Setting"                       },
189         { 0x290b, "Environmental Sensing Configuration"         },
190         { 0x290c, "Environmental Sensing Measurement"           },
191         { 0x290d, "Environmental Sensing Trigger Setting"       },
192         { 0x290e, "Time Trigger Setting"                        },
193         /* 0x290f to 0x29ff undefined */
194         { 0x2a00, "Device Name"                                 },
195         { 0x2a01, "Appearance"                                  },
196         { 0x2a02, "Peripheral Privacy Flag"                     },
197         { 0x2a03, "Reconnection Address"                        },
198         { 0x2a04, "Peripheral Preferred Connection Parameters"  },
199         { 0x2a05, "Service Changed"                             },
200         { 0x2a06, "Alert Level"                                 },
201         { 0x2a07, "Tx Power Level"                              },
202         { 0x2a08, "Date Time"                                   },
203         { 0x2a09, "Day of Week"                                 },
204         { 0x2a0a, "Day Date Time"                               },
205         /* 0x2a0b undefined */
206         { 0x2a0c, "Exact Time 256"                              },
207         { 0x2a0d, "DST Offset"                                  },
208         { 0x2a0e, "Time Zone"                                   },
209         { 0x2a0f, "Local Time Information"                      },
210         /* 0x2a10 undefined */
211         { 0x2a11, "Time with DST"                               },
212         { 0x2a12, "Time Accuracy"                               },
213         { 0x2a13, "Time Source"                                 },
214         { 0x2a14, "Reference Time Information"                  },
215         /* 0x2a15 undefined */
216         { 0x2a16, "Time Update Control Point"                   },
217         { 0x2a17, "Time Update State"                           },
218         { 0x2a18, "Glucose Measurement"                         },
219         { 0x2a19, "Battery Level"                               },
220         /* 0x2a1a and 0x2a1b undefined */
221         { 0x2a1c, "Temperature Measurement"                     },
222         { 0x2a1d, "Temperature Type"                            },
223         { 0x2a1e, "Intermediate Temperature"                    },
224         /* 0x2a1f and 0x2a20 undefined */
225         { 0x2a21, "Measurement Interval"                        },
226         { 0x2a22, "Boot Keyboard Input Report"                  },
227         { 0x2a23, "System ID"                                   },
228         { 0x2a24, "Model Number String"                         },
229         { 0x2a25, "Serial Number String"                        },
230         { 0x2a26, "Firmware Revision String"                    },
231         { 0x2a27, "Hardware Revision String"                    },
232         { 0x2a28, "Software Revision String"                    },
233         { 0x2a29, "Manufacturer Name String"                    },
234         { 0x2a2a, "IEEE 11073-20601 Regulatory Cert. Data List" },
235         { 0x2a2b, "Current Time"                                },
236         { 0x2a2c, "Magnetic Declination"                        },
237         /* 0x2a2d to 0x2a30 undefined */
238         { 0x2a31, "Scan Refresh"                                },
239         { 0x2a32, "Boot Keyboard Output Report"                 },
240         { 0x2a33, "Boot Mouse Input Report"                     },
241         { 0x2a34, "Glucose Measurement Context"                 },
242         { 0x2a35, "Blood Pressure Measurement"                  },
243         { 0x2a36, "Intermediate Cuff Pressure"                  },
244         { 0x2a37, "Heart Rate Measurement"                      },
245         { 0x2a38, "Body Sensor Location"                        },
246         { 0x2a39, "Heart Rate Control Point"                    },
247         /* 0x2a3a to 0x2a3e undefined */
248         { 0x2a3f, "Alert Status"                                },
249         { 0x2a40, "Ringer Control Point"                        },
250         { 0x2a41, "Ringer Setting"                              },
251         { 0x2a42, "Alert Category ID Bit Mask"                  },
252         { 0x2a43, "Alert Category ID"                           },
253         { 0x2a44, "Alert Notification Control Point"            },
254         { 0x2a45, "Unread Alert Status"                         },
255         { 0x2a46, "New Alert"                                   },
256         { 0x2a47, "Supported New Alert Category"                },
257         { 0x2a48, "Supported Unread Alert Category"             },
258         { 0x2a49, "Blood Pressure Feature"                      },
259         { 0x2a4a, "HID Information"                             },
260         { 0x2a4b, "Report Map"                                  },
261         { 0x2a4c, "HID Control Point"                           },
262         { 0x2a4d, "Report"                                      },
263         { 0x2a4e, "Protocol Mode"                               },
264         { 0x2a4f, "Scan Interval Window"                        },
265         { 0x2a50, "PnP ID"                                      },
266         { 0x2a51, "Glucose Feature"                             },
267         { 0x2a52, "Record Access Control Point"                 },
268         { 0x2a53, "RSC Measurement"                             },
269         { 0x2a54, "RSC Feature"                                 },
270         { 0x2a55, "SC Control Point"                            },
271         { 0x2a56, "Digital"                                     },
272         /* 0x2a57 undefined */
273         { 0x2a58, "Analog"                                      },
274         /* 0x2a59 undefined */
275         { 0x2a5a, "Aggregate"                                   },
276         { 0x2a5b, "CSC Measurement"                             },
277         { 0x2a5c, "CSC Feature"                                 },
278         { 0x2a5d, "Sensor Location"                             },
279         /* 0x2a5e to 0x2a62 undefined */
280         { 0x2a63, "Cycling Power Measurement"                   },
281         { 0x2a64, "Cycling Power Vector"                        },
282         { 0x2a65, "Cycling Power Feature"                       },
283         { 0x2a66, "Cycling Power Control Point"                 },
284         { 0x2a67, "Location and Speed"                          },
285         { 0x2a68, "Navigation"                                  },
286         { 0x2a69, "Position Quality"                            },
287         { 0x2a6a, "LN Feature"                                  },
288         { 0x2a6b, "LN Control Point"                            },
289         { 0x2a6c, "Elevation"                                   },
290         { 0x2a6d, "Pressure"                                    },
291         { 0x2a6e, "Temperature"                                 },
292         { 0x2a6f, "Humidity"                                    },
293         { 0x2a70, "True Wind Speed"                             },
294         { 0x2a71, "True Wind Direction"                         },
295         { 0x2a72, "Apparent Wind Speed"                         },
296         { 0x2a73, "Apparent Wind Direction"                     },
297         { 0x2a74, "Gust Factor"                                 },
298         { 0x2a75, "Pollen Concentration"                        },
299         { 0x2a76, "UV Index"                                    },
300         { 0x2a77, "Irradiance"                                  },
301         { 0x2a78, "Rainfall"                                    },
302         { 0x2a79, "Wind Chill"                                  },
303         { 0x2a7a, "Heat Index"                                  },
304         { 0x2a7b, "Dew Point"                                   },
305         { 0x2a7c, "Trend"                                       },
306         { 0x2a7d, "Descriptor Value Changed"                    },
307         { 0x2a7e, "Aerobic Heart Rate Lower Limit"              },
308         { 0x2a7f, "Aerobic Threshold"                           },
309         { 0x2a80, "Age"                                         },
310         { 0x2a81, "Anaerobic Heart Rate Lower Limit"            },
311         { 0x2a82, "Anaerobic Heart Rate Upper Limit"            },
312         { 0x2a83, "Anaerobic Threshold"                         },
313         { 0x2a84, "Aerobic Heart Rate Upper Limit"              },
314         { 0x2a85, "Date of Birth"                               },
315         { 0x2a86, "Date of Threshold Assessment"                },
316         { 0x2a87, "Email Address"                               },
317         { 0x2a88, "Fat Burn Heart Rate Lower Limit"             },
318         { 0x2a89, "Fat Burn Heart Rate Upper Limit"             },
319         { 0x2a8a, "First Name"                                  },
320         { 0x2a8b, "Five Zone Heart Rate Limits"                 },
321         { 0x2a8c, "Gender"                                      },
322         { 0x2a8d, "Heart Rate Max"                              },
323         { 0x2a8e, "Height"                                      },
324         { 0x2a8f, "Hip Circumference"                           },
325         { 0x2a90, "Last Name"                                   },
326         { 0x2a91, "Maximum Recommended Heart Rate"              },
327         { 0x2a92, "Resting Heart Rate"                          },
328         { 0x2a93, "Sport Type for Aerobic/Anaerobic Thresholds" },
329         { 0x2a94, "Three Zone Heart Rate Limits"                },
330         { 0x2a95, "Two Zone Heart Rate Limit"                   },
331         { 0x2a96, "VO2 Max"                                     },
332         { 0x2a97, "Waist Circumference"                         },
333         { 0x2a98, "Weight"                                      },
334         { 0x2a99, "Database Change Increment"                   },
335         { 0x2a9a, "User Index"                                  },
336         { 0x2a9b, "Body Composition Feature"                    },
337         { 0x2a9c, "Body Composition Measurement"                },
338         { 0x2a9d, "Weight Measurement"                          },
339         { 0x2a9e, "Weight Scale Feature"                        },
340         { 0x2a9f, "User Control Point"                          },
341         { 0x2aa0, "Magnetic Flux Density - 2D"                  },
342         { 0x2aa1, "Magnetic Flux Density - 3D"                  },
343         { 0x2aa2, "Language"                                    },
344         { 0x2aa3, "Barometric Pressure Trend"                   },
345         { 0x2aa4, "Bond Management Control Point"               },
346         { 0x2aa5, "Bond Management Feature"                     },
347         { 0x2aa6, "Central Address Resolution"                  },
348         { 0x2aa7, "CGM Measurement"                             },
349         { 0x2aa8, "CGM Feature"                                 },
350         { 0x2aa9, "CGM Status"                                  },
351         { 0x2aaa, "CGM Session Start Time"                      },
352         { 0x2aab, "CGM Session Run Time"                        },
353         { 0x2aac, "CGM Specific Ops Control Point"              },
354         { 0x2aad, "Indoor Positioning Configuration"            },
355         { 0x2aae, "Latitude"                                    },
356         { 0x2aaf, "Longitude"                                   },
357         { 0x2ab0, "Local North Coordinate"                      },
358         { 0x2ab1, "Local East Coordinate"                       },
359         { 0x2ab2, "Floor Number"                                },
360         { 0x2ab3, "Altitude"                                    },
361         { 0x2ab4, "Uncertainty"                                 },
362         { 0x2ab5, "Location Name"                               },
363         { 0x2ab6, "URI"                                         },
364         { 0x2ab7, "HTTP Headers"                                },
365         { 0x2ab8, "HTTP Status Code"                            },
366         { 0x2ab9, "HTTP Entity Body"                            },
367         { 0x2aba, "HTTP Control Point"                          },
368         { 0x2abb, "HTTPS Security"                              },
369         { 0x2abc, "TDS Control Point"                           },
370         { 0x2abd, "OTS Feature"                                 },
371         { 0x2abe, "Object Name"                                 },
372         { 0x2abf, "Object Type"                                 },
373         { 0x2ac0, "Object Size"                                 },
374         { 0x2ac1, "Object First-Created"                        },
375         { 0x2ac2, "Object Last-Modified"                        },
376         { 0x2ac3, "Object ID"                                   },
377         { 0x2ac4, "Object Properties"                           },
378         { 0x2ac5, "Object Action Control Point"                 },
379         { 0x2ac6, "Object List Control Point"                   },
380         { 0x2ac7, "Object List Filter"                          },
381         { 0x2ac8, "Object Changed"                              },
382         /* vendor defined */
383         { 0xfeff, "GN Netcom"                                   },
384         { 0xfefe, "GN ReSound A/S"                              },
385         { 0xfefd, "Gimbal, Inc."                                },
386         { 0xfefc, "Gimbal, Inc."                                },
387         { 0xfefb, "Stollmann E+V GmbH"                          },
388         { 0xfefa, "PayPal, Inc."                                },
389         { 0xfef9, "PayPal, Inc."                                },
390         { 0xfef8, "Aplix Corporation"                           },
391         { 0xfef7, "Aplix Corporation"                           },
392         { 0xfef6, "Wicentric, Inc."                             },
393         { 0xfef5, "Dialog Semiconductor GmbH"                   },
394         { 0xfef4, "Google"                                      },
395         { 0xfef3, "Google"                                      },
396         { 0xfef2, "CSR"                                         },
397         { 0xfef1, "CSR"                                         },
398         { 0xfef0, "Intel"                                       },
399         { 0xfeef, "Polar Electro Oy"                            },
400         { 0xfeee, "Polar Electro Oy"                            },
401         { 0xfeed, "Tile, Inc."                                  },
402         { 0xfeec, "Tile, Inc."                                  },
403         { 0xfeeb, "Swirl Networks, Inc."                        },
404         { 0xfeea, "Swirl Networks, Inc."                        },
405         { 0xfee9, "Quintic Corp."                               },
406         { 0xfee8, "Quintic Corp."                               },
407         { 0xfee7, "Tencent Holdings Limited"                    },
408         { 0xfee6, "Seed Labs, Inc."                             },
409         { 0xfee5, "Nordic Semiconductor ASA"                    },
410         { 0xfee4, "Nordic Semiconductor ASA"                    },
411         { 0xfee3, "Anki, Inc."                                  },
412         { 0xfee2, "Anki, Inc."                                  },
413         { 0xfee1, "Anhui Huami Information Technology Co."      },
414         { 0xfee0, "Anhui Huami Information Technology Co."      },
415         { 0xfedf, "Design SHIFT"                                },
416         { 0xfede, "Coin, Inc."                                  },
417         { 0xfedd, "Jawbone"                                     },
418         { 0xfedc, "Jawbone"                                     },
419         { 0xfedb, "Perka, Inc."                                 },
420         { 0xfeda, "ISSC Technologies Corporation"               },
421         { 0xfed9, "Pebble Technology Corporation"               },
422         { 0xfed8, "Google"                                      },
423         { 0xfed7, "Broadcom Corporation"                        },
424         { 0xfed6, "Broadcom Corporation"                        },
425         { 0xfed5, "Plantronics Inc."                            },
426         { 0xfed4, "Apple, Inc."                                 },
427         { 0xfed3, "Apple, Inc."                                 },
428         { 0xfed2, "Apple, Inc."                                 },
429         { 0xfed1, "Apple, Inc."                                 },
430         { 0xfed0, "Apple, Inc."                                 },
431         { 0xfecf, "Apple, Inc."                                 },
432         { 0xfece, "Apple, Inc."                                 },
433         { 0xfecd, "Apple, Inc."                                 },
434         { 0xfecc, "Apple, Inc."                                 },
435         { 0xfecb, "Apple, Inc."                                 },
436         { 0xfeca, "Apple, Inc."                                 },
437         { 0xfec9, "Apple, Inc."                                 },
438         { 0xfec8, "Apple, Inc."                                 },
439         { 0xfec7, "Apple, Inc."                                 },
440         { 0xfec6, "Kocomojo, LLC"                               },
441         { 0xfec5, "Realtek Semiconductor Corp."                 },
442         { 0xfec4, "PLUS Location Systems"                       },
443         { 0xfec3, "360fly, Inc."                                },
444         { 0xfec2, "Blue Spark Technologies, Inc."               },
445         { 0xfec1, "KDDI Corporation"                            },
446         { 0xfec0, "KDDI Corporation"                            },
447         { 0xfebf, "Nod, Inc."                                   },
448         { 0xfebe, "Bose Corporation"                            },
449         { 0xfebd, "Clover Network, Inc."                        },
450         { 0xfebc, "Dexcom, Inc."                                },
451         { 0xfebb, "adafruit industries"                         },
452         { 0xfeba, "Tencent Holdings Limited"                    },
453         { 0xfeb9, "LG Electronics"                              },
454         { 0xfeb8, "Facebook, Inc."                              },
455         { 0xfeb7, "Facebook, Inc."                              },
456         { 0xfeb6, "Vencer Co, Ltd"                              },
457         { 0xfeb5, "WiSilica Inc."                               },
458         { 0xfeb4, "WiSilica Inc."                               },
459         { 0xfeb3, "Taobao"                                      },
460         { 0xfeb2, "Microsoft Corporation"                       },
461         { 0xfeb1, "Electronics Tomorrow Limited"                },
462         { 0xfeb0, "Nest Labs Inc."                              },
463         { 0xfeaf, "Nest Labs Inc."                              },
464         { 0xfeae, "Nokia Corporation"                           },
465         { 0xfead, "Nokia Corporation"                           },
466         { 0xfeac, "Nokia Corporation"                           },
467         { 0xfeab, "Nokia Corporation"                           },
468         { 0xfeaa, "Google"                                      },
469         { 0xfea9, "Savant Systems LLC"                          },
470         { 0xfea8, "Savant Systems LLC"                          },
471         { 0xfea7, "UTC Fire and Security"                       },
472         { 0xfea6, "GoPro, Inc."                                 },
473         { 0xfea5, "GoPro, Inc."                                 },
474         { 0xfea4, "Paxton Access Ltd"                           },
475         { 0xfea3, "ITT Industries"                              },
476         { 0xfea2, "Intrepid Control Systems, Inc."              },
477         { 0xfea1, "Intrepid Control Systems, Inc."              },
478         { 0xfea0, "Google"                                      },
479         { 0xfe9f, "Google"                                      },
480         { 0xfe9e, "Dialog Semiconductor B.V."                   },
481         { 0xfe9d, "Mobiquity Networks Inc"                      },
482         { 0xfe9c, "GSI Laboratories, Inc."                      },
483         { 0xfe9b, "Samsara Networks, Inc"                       },
484         { 0xfe9a, "Estimote"                                    },
485         { 0xfe99, "Currant, Inc."                               },
486         { 0xfe98, "Currant, Inc."                               },
487         { 0xfe97, "Tesla Motor Inc."                            },
488         { 0xfe96, "Tesla Motor Inc."                            },
489         { 0xfe95, "Xiaomi Inc."                                 },
490         { 0xfe94, "OttoQ Inc."                                  },
491         { 0xfe93, "OttoQ Inc."                                  },
492         { 0xfe92, "Jarden Safety & Security"                    },
493         { 0xfe91, "Shanghai Imilab Technology Co.,Ltd"          },
494         { 0xfe90, "JUMA"                                        },
495         { 0xfe8f, "CSR"                                         },
496         { 0xfe8e, "ARM Ltd"                                     },
497         { 0xfe8d, "Interaxon Inc."                              },
498         { 0xfe8c, "TRON Forum"                                  },
499         { 0xfe8b, "Apple, Inc."                                 },
500         { 0xfe8a, "Apple, Inc."                                 },
501         { 0xfe89, "B&O Play A/S"                                },
502         { 0xfe88, "SALTO SYSTEMS S.L."                          },
503         { 0xfe87, "Qingdao Yeelink Information Technology Co., Ltd. ( 青岛亿联客信息技术有限公司 )"        },
504         { 0xfe86, "HUAWEI Technologies Co., Ltd. ( 华为技术有限公司 )"                                  },
505         { 0xfe85, "RF Digital Corp"                             },
506         { 0xfe84, "RF Digital Corp"                             },
507         { 0xfe83, "Blue Bite"                                   },
508         { 0xfe82, "Medtronic Inc."                              },
509         { 0xfe81, "Medtronic Inc."                              },
510         { 0xfe80, "Doppler Lab"                                 },
511         { 0xfe7f, "Doppler Lab"                                 },
512         { 0xfe7e, "Awear Solutions Ltd"                         },
513         { 0xfe7d, "Aterica Health Inc."                         },
514         { 0xfe7c, "Stollmann E+V GmbH"                          },
515         { 0xfe7b, "Orion Labs, Inc."                            },
516         { 0xfe7a, "Bragi GmbH"                                  },
517         { 0xfe79, "Zebra Technologies"                          },
518         { 0xfe78, "Hewlett-Packard Company"                     },
519         { 0xfe77, "Hewlett-Packard Company"                     },
520         { 0xfe76, "TangoMe"                                     },
521         { 0xfe75, "TangoMe"                                     },
522         { 0xfe74, "unwire"                                      },
523         { 0xfe73, "St. Jude Medical, Inc."                      },
524         { 0xfe72, "St. Jude Medical, Inc."                      },
525         { 0xfe71, "Plume Design Inc"                            },
526         { 0xfe70, "Beijing Jingdong Century Trading Co., Ltd."  },
527         { 0xfe6f, "LINE Corporation"                            },
528         { 0xfe6e, "The University of Tokyo"                     },
529         { 0xfe6d, "The University of Tokyo"                     },
530         { 0xfe6c, "TASER International, Inc."                   },
531         { 0xfe6b, "TASER International, Inc."                   },
532         { 0xfe6a, "Kontakt Micro-Location Sp. z o.o."           },
533         { 0xfe69, "Qualcomm Life Inc"                           },
534         { 0xfe68, "Qualcomm Life Inc"                           },
535         { 0xfe67, "Lab Sensor Solutions"                        },
536         { 0xfe66, "Intel Corporation"                           },
537         /* SDO defined */
538         { 0xfffe, "Alliance for Wireless Power (A4WP)"          },
539         { 0xfffd, "Fast IDentity Online Alliance (FIDO)"        },
540         { }
541 };
542
543 static const struct {
544         const char *uuid;
545         const char *str;
546 } uuid128_table[] = {
547         { "a3c87500-8ed3-4bdf-8a39-a01bebede295",
548                 "Eddystone Configuration Service"                       },
549         { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities"        },
550         { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot"         },
551         { "a3c87503-8ed3-4bdf-8a39-a01bebede295",
552                 "Advertising Interval"                                  },
553         { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power"      },
554         { "a3c87505-8ed3-4bdf-8a39-a01bebede295",
555                 "(Advanced) Advertised Tx Power"                        },
556         { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State"          },
557         { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock"              },
558         { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key"     },
559         { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key"    },
560         { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data"       },
561         { "a3c8750b-8ed3-4bdf-8a39-a01bebede295",
562                 "(Advanced) Factory reset"                              },
563         { "a3c8750c-8ed3-4bdf-8a39-a01bebede295",
564                 "(Advanced) Remain Connectable"                         },
565         { }
566 };
567
568 const char *uuid16_to_str(uint16_t uuid)
569 {
570         int i;
571
572         for (i = 0; uuid16_table[i].str; i++) {
573                 if (uuid16_table[i].uuid == uuid)
574                         return uuid16_table[i].str;
575         }
576
577         return "Unknown";
578 }
579
580 const char *uuid32_to_str(uint32_t uuid)
581 {
582         if ((uuid & 0xffff0000) == 0x0000)
583                 return uuid16_to_str(uuid & 0x0000ffff);
584
585         return "Unknown";
586 }
587
588 const char *uuidstr_to_str(const char *uuid)
589 {
590         uint32_t val;
591         int i;
592
593         if (!uuid)
594                 return NULL;
595
596         if (strlen(uuid) != 36)
597                 return NULL;
598
599         for (i = 0; uuid128_table[i].str; i++) {
600                 if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
601                         return uuid128_table[i].str;
602         }
603
604         if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
605                 return "Vendor specific";
606
607         if (sscanf(uuid, "%08x-0000-1000-8000-00805f9b34fb", &val) != 1)
608                 return NULL;
609
610         return uuid32_to_str(val);
611 }