1 /** @file
2  *  @brief Bluetooth UUID handling
3  */
4 
5 /*
6  * Copyright (c) 2015-2016 Intel Corporation
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_UUID_H_
11 #define ZEPHYR_INCLUDE_BLUETOOTH_UUID_H_
12 
13 /**
14  * @brief UUIDs
15  * @defgroup bt_uuid UUIDs
16  * @ingroup bluetooth
17  * @{
18  */
19 
20 #include <misc/util.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /** @brief Bluetooth UUID types */
27 enum {
28 	BT_UUID_TYPE_16,
29 	BT_UUID_TYPE_32,
30 	BT_UUID_TYPE_128,
31 };
32 
33 /** @brief This is a 'tentative' type and should be used as a pointer only */
34 struct bt_uuid {
35 	u8_t type;
36 };
37 
38 struct bt_uuid_16 {
39 	struct bt_uuid uuid;
40 	u16_t val;
41 };
42 
43 struct bt_uuid_32 {
44 	struct bt_uuid uuid;
45 	bt_u32_t val;
46 };
47 
48 struct bt_uuid_128 {
49 	struct bt_uuid uuid;
50 	u8_t val[16];
51 };
52 
53 #define BT_UUID_INIT_16(value)		\
54 {					\
55 	.uuid = { BT_UUID_TYPE_16 },	\
56 	.val = (value),			\
57 }
58 
59 #define BT_UUID_INIT_32(value)		\
60 {					\
61 	.uuid = { BT_UUID_TYPE_32 },	\
62 	.val = (value),			\
63 }
64 
65 #define BT_UUID_INIT_128(value...)	\
66 {					\
67 	.uuid = { BT_UUID_TYPE_128 },	\
68 	.val = { value },		\
69 }
70 
71 #define BT_UUID_DECLARE_16(value) \
72 	((struct bt_uuid *) ((struct bt_uuid_16[]) {BT_UUID_INIT_16(value)}))
73 #define BT_UUID_DECLARE_32(value) \
74 	((struct bt_uuid *) ((struct bt_uuid_32[]) {BT_UUID_INIT_32(value)}))
75 #define BT_UUID_DECLARE_128(value...) \
76 	((struct bt_uuid *) ((struct bt_uuid_128[]) {BT_UUID_INIT_128(value)}))
77 
78 #define BT_UUID_16(__u) CONTAINER_OF(__u, struct bt_uuid_16, uuid)
79 #define BT_UUID_32(__u) CONTAINER_OF(__u, struct bt_uuid_32, uuid)
80 #define BT_UUID_128(__u) CONTAINER_OF(__u, struct bt_uuid_128, uuid)
81 
82 /**
83  * @brief Encode 128 bit UUID into an array values
84  *
85  * Helper macro to initialize a 128-bit UUID value from the UUID format.
86  * Can be combined with BT_UUID_DECLARE_128 to declare a 128-bit UUID from
87  * the readable form of UUIDs.
88  *
89  * Example for how to declare the UUID `6E400001-B5A3-F393-E0A9-E50E24DCCA9E`
90  *
91  * @code
92  * BT_UUID_DECLARE_128(
93  *       BT_UUID_128_ENCODE(0x6E400001, 0xB5A3, 0xF393, 0xE0A9, 0xE50E24DCCA9E))
94  * @endcode
95  *
96  * Just replace the hyphen by the comma and add `0x` prefixes.
97  *
98  * @param w32 First part of the UUID (32 bits)
99  * @param w1  Second part of the UUID (16 bits)
100  * @param w2  Third part of the UUID (16 bits)
101  * @param w3  Fourth part of the UUID (16 bits)
102  * @param w48 Fifth part of the UUID (48 bits)
103  *
104  * @return The comma separated values for UUID 128 initializer that
105  *         may be used directly as an argument for
106  *         @ref BT_UUID_INIT_128 or @ref BT_UUID_DECLARE_128
107  */
108 #define BT_UUID_128_ENCODE(w32, w1, w2, w3, w48) \
109 	(((w48) >>  0) & 0xFF), \
110 	(((w48) >>  8) & 0xFF), \
111 	(((w48) >> 16) & 0xFF), \
112 	(((w48) >> 24) & 0xFF), \
113 	(((w48) >> 32) & 0xFF), \
114 	(((w48) >> 40) & 0xFF), \
115 	(((w3)  >>  0) & 0xFF), \
116 	(((w3)  >>  8) & 0xFF), \
117 	(((w2)  >>  0) & 0xFF), \
118 	(((w2)  >>  8) & 0xFF), \
119 	(((w1)  >>  0) & 0xFF), \
120 	(((w1)  >>  8) & 0xFF), \
121 	(((w32) >>  0) & 0xFF), \
122 	(((w32) >>  8) & 0xFF), \
123 	(((w32) >> 16) & 0xFF), \
124 	(((w32) >> 24) & 0xFF)
125 
126 /** @def BT_UUID_STR_LEN
127  *
128  *  @brief Recommended length of user string buffer for Bluetooth UUID.
129  *
130  *  @details The recommended length guarantee the output of UUID
131  *  conversion will not lose valuable information about the UUID being
132  *  processed. If the length of the UUID is known the string can be shorter.
133  */
134 #define BT_UUID_STR_LEN 37
135 
136 /** @def BT_UUID_GAP
137  *  @brief Generic Access
138  */
139 #define BT_UUID_GAP                       BT_UUID_DECLARE_16(0x1800)
140 /** @def BT_UUID_GATT
141  *  @brief Generic Attribute
142  */
143 #define BT_UUID_GATT                      BT_UUID_DECLARE_16(0x1801)
144 /** @def BT_UUID_CTS
145  *  @brief Current Time Service
146  */
147 #define BT_UUID_CTS                       BT_UUID_DECLARE_16(0x1805)
148 /** @def BT_UUID_HTS
149  *  @brief Health Thermometer Service
150  */
151 #define BT_UUID_HTS                       BT_UUID_DECLARE_16(0x1809)
152 /** @def BT_UUID_DIS
153  *  @brief Device Information Service
154  */
155 #define BT_UUID_DIS                       BT_UUID_DECLARE_16(0x180a)
156 /** @def BT_UUID_HRS
157  *  @brief Heart Rate Service
158  */
159 #define BT_UUID_HRS                       BT_UUID_DECLARE_16(0x180d)
160 /** @def BT_UUID_BAS
161  *  @brief Battery Service
162  */
163 #define BT_UUID_BAS                       BT_UUID_DECLARE_16(0x180f)
164 /** @def BT_UUID_HIDS
165  *  @brief HID Service
166  */
167 #define BT_UUID_HIDS                      BT_UUID_DECLARE_16(0x1812)
168 /** @def BT_UUID_CSC
169  *  @brief Cycling Speed and Cadence Service
170  */
171 #define BT_UUID_CSC                       BT_UUID_DECLARE_16(0x1816)
172 /** @def BT_UUID_ESS
173  *  @brief Environmental Sensing Service
174  */
175 #define BT_UUID_ESS                       BT_UUID_DECLARE_16(0x181a)
176 /** @def BT_UUID_IPSS
177  *  @brief IP Support Service
178  */
179 #define BT_UUID_IPSS                      BT_UUID_DECLARE_16(0x1820)
180 /** @def BT_UUID_OTS
181  *  @brief Object Transfer Service
182  */
183 #define BT_UUID_OTS                       BT_UUID_DECLARE_16(0x1825)
184 /** @def BT_UUID_MESH_PROV
185  *  @brief Mesh Provisioning Service
186  */
187 #define BT_UUID_MESH_PROV                 BT_UUID_DECLARE_16(0x1827)
188 /** @def BT_UUID_MESH_PROXY
189  *  @brief Mesh Proxy Service
190  */
191 #define BT_UUID_MESH_PROXY                BT_UUID_DECLARE_16(0x1828)
192 /** @def BT_UUID_GATT_PRIMARY
193  *  @brief GATT Primary Service
194  */
195 #define BT_UUID_GATT_PRIMARY              BT_UUID_DECLARE_16(0x2800)
196 /** @def BT_UUID_GATT_SECONDARY
197  *  @brief GATT Secondary Service
198  */
199 #define BT_UUID_GATT_SECONDARY            BT_UUID_DECLARE_16(0x2801)
200 /** @def BT_UUID_GATT_INCLUDE
201  *  @brief GATT Include Service
202  */
203 #define BT_UUID_GATT_INCLUDE              BT_UUID_DECLARE_16(0x2802)
204 /** @def BT_UUID_GATT_CHRC
205  *  @brief GATT Characteristic
206  */
207 #define BT_UUID_GATT_CHRC                 BT_UUID_DECLARE_16(0x2803)
208 /** @def BT_UUID_GATT_CEP
209  *  @brief GATT Characteristic Extended Properties
210  */
211 #define BT_UUID_GATT_CEP                  BT_UUID_DECLARE_16(0x2900)
212 /** @def BT_UUID_GATT_CUD
213  *  @brief GATT Characteristic User Description
214  */
215 #define BT_UUID_GATT_CUD                  BT_UUID_DECLARE_16(0x2901)
216 /** @def BT_UUID_GATT_CCC
217  *  @brief GATT Client Characteristic Configuration
218  */
219 #define BT_UUID_GATT_CCC                  BT_UUID_DECLARE_16(0x2902)
220 /** @def BT_UUID_GATT_SCC
221  *  @brief GATT Server Characteristic Configuration
222  */
223 #define BT_UUID_GATT_SCC                  BT_UUID_DECLARE_16(0x2903)
224 /** @def BT_UUID_GATT_CPF
225  *  @brief GATT Characteristic Presentation Format
226  */
227 #define BT_UUID_GATT_CPF                  BT_UUID_DECLARE_16(0x2904)
228 /** @def BT_UUID_VALID_RANGE
229  *  @brief Valid Range Descriptor
230  */
231 #define BT_UUID_VALID_RANGE               BT_UUID_DECLARE_16(0x2906)
232 /** @def BT_UUID_HIDS_EXT_REPORT
233  *  @brief HID External Report Descriptor
234  */
235 #define BT_UUID_HIDS_EXT_REPORT           BT_UUID_DECLARE_16(0x2907)
236 /** @def BT_UUID_HIDS_REPORT_REF
237  *  @brief HID Report Reference Descriptor
238  */
239 #define BT_UUID_HIDS_REPORT_REF           BT_UUID_DECLARE_16(0x2908)
240 /** @def BT_UUID_ES_CONFIGURATION
241  *  @brief Environmental Sensing Configuration Descriptor
242  */
243 #define BT_UUID_ES_CONFIGURATION          BT_UUID_DECLARE_16(0x290b)
244 /** @def BT_UUID_ES_MEASUREMENT
245  *  @brief Environmental Sensing Measurement Descriptor
246  */
247 #define BT_UUID_ES_MEASUREMENT            BT_UUID_DECLARE_16(0x290c)
248 /** @def BT_UUID_ES_TRIGGER_SETTING
249  *  @brief Environmental Sensing Trigger Setting Descriptor
250  */
251 #define BT_UUID_ES_TRIGGER_SETTING        BT_UUID_DECLARE_16(0x290d)
252 /** @def BT_UUID_GAP_DEVICE_NAME
253  *  @brief GAP Characteristic Device Name
254  */
255 #define BT_UUID_GAP_DEVICE_NAME           BT_UUID_DECLARE_16(0x2a00)
256 /** @def BT_UUID_GAP_APPEARANCE
257  *  @brief GAP Characteristic Appearance
258  */
259 #define BT_UUID_GAP_APPEARANCE            BT_UUID_DECLARE_16(0x2a01)
260 /** @def BT_UUID_GAP_PPCP
261  *  @brief GAP Characteristic Peripheral Preferred Connection Parameters
262  */
263 #define BT_UUID_GAP_PPCP                  BT_UUID_DECLARE_16(0x2a04)
264 /** @def BT_UUID_GATT_SC
265  *  @brief GATT Characteristic Service Changed
266  */
267 #define BT_UUID_GATT_SC                   BT_UUID_DECLARE_16(0x2a05)
268 /** @def BT_UUID_BAS_BATTERY_LEVEL
269  *  @brief BAS Characteristic Battery Level
270  */
271 #define BT_UUID_BAS_BATTERY_LEVEL         BT_UUID_DECLARE_16(0x2a19)
272 /** @def BT_UUID_HTS_MEASUREMENT
273  *  @brief HTS Characteristic Measurement Value
274  */
275 #define BT_UUID_HTS_MEASUREMENT           BT_UUID_DECLARE_16(0x2a1c)
276 /** @def BT_UUID_HIDS_BOOT_KB_IN_REPORT
277  *  @brief HID Characteristic Boot Keyboard Input Report
278  */
279 #define BT_UUID_HIDS_BOOT_KB_IN_REPORT    BT_UUID_DECLARE_16(0x2a22)
280 /** @def BT_UUID_DIS_SYSTEM_ID
281  *  @brief DIS Characteristic System ID
282  */
283 #define BT_UUID_DIS_SYSTEM_ID             BT_UUID_DECLARE_16(0x2a23)
284 /** @def BT_UUID_DIS_MODEL_NUMBER
285  *  @brief DIS Characteristic Model Number String
286  */
287 #define BT_UUID_DIS_MODEL_NUMBER          BT_UUID_DECLARE_16(0x2a24)
288 /** @def BT_UUID_DIS_SERIAL_NUMBER
289  *  @brief DIS Characteristic Serial Number String
290  */
291 #define BT_UUID_DIS_SERIAL_NUMBER         BT_UUID_DECLARE_16(0x2a25)
292 /** @def BT_UUID_DIS_FIRMWARE_REVISION
293  *  @brief DIS Characteristic Firmware Revision String
294  */
295 #define BT_UUID_DIS_FIRMWARE_REVISION     BT_UUID_DECLARE_16(0x2a26)
296 /** @def BT_UUID_DIS_HARDWARE_REVISION
297  *  @brief DIS Characteristic Hardware Revision String
298  */
299 #define BT_UUID_DIS_HARDWARE_REVISION     BT_UUID_DECLARE_16(0x2a27)
300 /** @def BT_UUID_DIS_SOFTWARE_REVISION
301  *  @brief DIS Characteristic Software Revision String
302  */
303 #define BT_UUID_DIS_SOFTWARE_REVISION     BT_UUID_DECLARE_16(0x2a28)
304 /** @def BT_UUID_DIS_MANUFACTURER_NAME
305  *  @brief DIS Characteristic Manufacturer Name String
306  */
307 #define BT_UUID_DIS_MANUFACTURER_NAME     BT_UUID_DECLARE_16(0x2a29)
308 /** @def BT_UUID_DIS_PNP_ID
309  *  @brief DIS Characteristic PnP ID
310  */
311 #define BT_UUID_DIS_PNP_ID                BT_UUID_DECLARE_16(0x2a50)
312 /** @def BT_UUID_CTS_CURRENT_TIME
313  *  @brief CTS Characteristic Current Time
314  */
315 #define BT_UUID_CTS_CURRENT_TIME          BT_UUID_DECLARE_16(0x2a2b)
316 /** @def BT_UUID_MAGN_DECLINATION
317  *  @brief Magnetic Declination Characteristic
318  */
319 #define BT_UUID_MAGN_DECLINATION          BT_UUID_DECLARE_16(0x2a2c)
320 /** @def BT_UUID_HIDS_BOOT_KB_OUT_REPORT
321  *  @brief HID Boot Keyboard Output Report Characteristic
322  */
323 #define BT_UUID_HIDS_BOOT_KB_OUT_REPORT   BT_UUID_DECLARE_16(0x2a32)
324 /** @def BT_UUID_HIDS_BOOT_MOUSE_IN_REPORT
325  *  @brief HID Boot Mouse Input Report Characteristic
326  */
327 #define BT_UUID_HIDS_BOOT_MOUSE_IN_REPORT BT_UUID_DECLARE_16(0x2a33)
328 /** @def BT_UUID_HRS_MEASUREMENT
329  *  @brief HRS Characteristic Measurement Interval
330  */
331 #define BT_UUID_HRS_MEASUREMENT           BT_UUID_DECLARE_16(0x2a37)
332 /** @def BT_UUID_HRS_BODY_SENSOR
333  *  @brief HRS Characteristic Body Sensor Location
334  */
335 #define BT_UUID_HRS_BODY_SENSOR           BT_UUID_DECLARE_16(0x2a38)
336 /** @def BT_UUID_HRS_CONTROL_POINT
337  *  @brief HRS Characteristic Control Point
338  */
339 #define BT_UUID_HRS_CONTROL_POINT         BT_UUID_DECLARE_16(0x2a39)
340 /** @def BT_UUID_HIDS_INFO
341  *  @brief HID Information Characteristic
342  */
343 #define BT_UUID_HIDS_INFO                 BT_UUID_DECLARE_16(0x2a4a)
344 /** @def BT_UUID_HIDS_REPORT_MAP
345  *  @brief HID Report Map Characteristic
346  */
347 #define BT_UUID_HIDS_REPORT_MAP           BT_UUID_DECLARE_16(0x2a4b)
348 /** @def BT_UUID_HIDS_CTRL_POINT
349  *  @brief HID Control Point Characteristic
350  */
351 #define BT_UUID_HIDS_CTRL_POINT           BT_UUID_DECLARE_16(0x2a4c)
352 /** @def BT_UUID_HIDS_REPORT
353  *  @brief HID Report Characteristic
354  */
355 #define BT_UUID_HIDS_REPORT               BT_UUID_DECLARE_16(0x2a4d)
356 /** @def BT_UUID_HIDS_PROTOCOL_MODE
357  *  @brief HID Protocol Mode Characteristic
358  */
359 #define BT_UUID_HIDS_PROTOCOL_MODE        BT_UUID_DECLARE_16(0x2a4e)
360 /** @def BT_UUID_CSC_MEASUREMENT
361  *  @brief CSC Measurement Characteristic
362  */
363 #define BT_UUID_CSC_MEASUREMENT           BT_UUID_DECLARE_16(0x2a5b)
364 /** @def BT_UUID_CSC_FEATURE
365  *  @brief CSC Feature Characteristic
366  */
367 #define BT_UUID_CSC_FEATURE               BT_UUID_DECLARE_16(0x2a5c)
368 /** @def BT_UUID_SENSOR_LOCATION
369  *  @brief Sensor Location Characteristic
370  */
371 #define BT_UUID_SENSOR_LOCATION           BT_UUID_DECLARE_16(0x2a5d)
372 /** @def BT_UUID_SC_CONTROL_POINT
373  *  @brief SC Control Point Characteristic
374  */
375 #define BT_UUID_SC_CONTROL_POINT          BT_UUID_DECLARE_16(0x2a55)
376 /** @def BT_UUID_ELEVATION
377  *  @brief Elevation Characteristic
378  */
379 #define BT_UUID_ELEVATION                 BT_UUID_DECLARE_16(0x2a6c)
380 /** @def BT_UUID_PRESSURE
381  *  @brief Pressure Characteristic
382  */
383 #define BT_UUID_PRESSURE                  BT_UUID_DECLARE_16(0x2a6d)
384 /** @def BT_UUID_TEMPERATURE
385  *  @brief Temperature Characteristic
386  */
387 #define BT_UUID_TEMPERATURE               BT_UUID_DECLARE_16(0x2a6e)
388 /** @def BT_UUID_HUMIDITY
389  *  @brief Humidity Characteristic
390  */
391 #define BT_UUID_HUMIDITY                  BT_UUID_DECLARE_16(0x2a6f)
392 /** @def BT_UUID_TRUE_WIND_SPEED
393  *  @brief True Wind Speed Characteristic
394  */
395 #define BT_UUID_TRUE_WIND_SPEED           BT_UUID_DECLARE_16(0x2a70)
396 /** @def BT_UUID_TRUE_WIND_DIR
397  *  @brief True Wind Direction Characteristic
398  */
399 #define BT_UUID_TRUE_WIND_DIR             BT_UUID_DECLARE_16(0x2a71)
400 /** @def BT_UUID_APPARENT_WIND_SPEED
401  *  @brief Apparent Wind Speed Characteristic
402  */
403 #define BT_UUID_APPARENT_WIND_SPEED       BT_UUID_DECLARE_16(0x2a72)
404 /** @def BT_UUID_APPARENT_WIND_DIR
405  *  @brief Apparent Wind Direction Characteristic
406  */
407 #define BT_UUID_APPARENT_WIND_DIR         BT_UUID_DECLARE_16(0x2a73)
408 /** @def BT_UUID_GUST_FACTOR
409  *  @brief Gust Factor Characteristic
410  */
411 #define BT_UUID_GUST_FACTOR               BT_UUID_DECLARE_16(0x2a74)
412 /** @def BT_UUID_POLLEN_CONCENTRATION
413  *  @brief Pollen Concentration Characteristic
414  */
415 #define BT_UUID_POLLEN_CONCENTRATION      BT_UUID_DECLARE_16(0x2a75)
416 /** @def BT_UUID_UV_INDEX
417  *  @brief UV Index Characteristic
418  */
419 #define BT_UUID_UV_INDEX                  BT_UUID_DECLARE_16(0x2a76)
420 /** @def BT_UUID_IRRADIANCE
421  *  @brief Irradiance Characteristic
422  */
423 #define BT_UUID_IRRADIANCE                BT_UUID_DECLARE_16(0x2a77)
424 /** @def BT_UUID_RAINFALL
425  *  @brief Rainfall Characteristic
426  */
427 #define BT_UUID_RAINFALL                  BT_UUID_DECLARE_16(0x2a78)
428 /** @def BT_UUID_WIND_CHILL
429  *  @brief Wind Chill Characteristic
430  */
431 #define BT_UUID_WIND_CHILL                BT_UUID_DECLARE_16(0x2a79)
432 /** @def BT_UUID_HEAT_INDEX
433  *  @brief Heat Index Characteristic
434  */
435 #define BT_UUID_HEAT_INDEX                BT_UUID_DECLARE_16(0x2a7a)
436 /** @def BT_UUID_DEW_POINT
437  *  @brief Dew Point Characteristic
438  */
439 #define BT_UUID_DEW_POINT                 BT_UUID_DECLARE_16(0x2a7b)
440 /** @def BT_UUID_DESC_VALUE_CHANGED
441  *  @brief Descriptor Value Changed Characteristic
442  */
443 #define BT_UUID_DESC_VALUE_CHANGED        BT_UUID_DECLARE_16(0x2a7d)
444 /** @def BT_UUID_MAGN_FLUX_DENSITY_2D
445  *  @brief Magnetic Flux Density - 2D Characteristic
446  */
447 #define BT_UUID_MAGN_FLUX_DENSITY_2D      BT_UUID_DECLARE_16(0x2aa0)
448 /** @def BT_UUID_MAGN_FLUX_DENSITY_3D
449  *  @brief Magnetic Flux Density - 3D Characteristic
450  */
451 #define BT_UUID_MAGN_FLUX_DENSITY_3D      BT_UUID_DECLARE_16(0x2aa1)
452 /** @def BT_UUID_BAR_PRESSURE_TREND
453  *  @brief Barometric Pressure Trend Characteristic
454  */
455 #define BT_UUID_BAR_PRESSURE_TREND        BT_UUID_DECLARE_16(0x2aa3)
456 /** @def BT_UUID_CENTRAL_ADDR_RES
457  *  @brief Central Address Resolution Characteristic
458  */
459 #define BT_UUID_CENTRAL_ADDR_RES          BT_UUID_DECLARE_16(0x2aa6)
460 /** @def BT_UUID_OTS_FEATURE
461  *  @brief OTS Feature Characteristic
462  */
463 #define BT_UUID_OTS_FEATURE               BT_UUID_DECLARE_16(0x2abd)
464 /** @def BT_UUID_OTS_NAME
465  *  @brief OTS Object Name Characteristic
466  */
467 #define BT_UUID_OTS_NAME                  BT_UUID_DECLARE_16(0x2abe)
468 /** @def BT_UUID_OTS_TYPE
469  *  @brief OTS Object Type Characteristic
470  */
471 #define BT_UUID_OTS_TYPE                  BT_UUID_DECLARE_16(0x2abf)
472 /** @def BT_UUID_OTS_SIZE
473  *  @brief OTS Object Size Characteristic
474  */
475 #define BT_UUID_OTS_SIZE                  BT_UUID_DECLARE_16(0x2ac0)
476 /** @def BT_UUID_OTS_FIRST_CREATED
477  *  @brief OTS Object First-Created Characteristic
478  */
479 #define BT_UUID_OTS_FIRST_CREATED         BT_UUID_DECLARE_16(0x2ac1)
480 /** @def BT_UUID_OTS_LAST_MODIFIED
481  *  @brief OTS Object Last-Modified Characteristic
482  */
483 #define BT_UUID_OTS_LAST_MODIFIED         BT_UUID_DECLARE_16(0x2ac2)
484 /** @def BT_UUID_OTS_ID
485  *  @brief OTS Object ID Characteristic
486  */
487 #define BT_UUID_OTS_ID                    BT_UUID_DECLARE_16(0x2ac3)
488 /** @def BT_UUID_OTS_PROPERTIES
489  *  @brief OTS Object Properties Characteristic
490  */
491 #define BT_UUID_OTS_PROPERTIES            BT_UUID_DECLARE_16(0x2ac4)
492 /** @def BT_UUID_OTS_ACTION_CP
493  *  @brief OTS Object Action Control Point Characteristic
494  */
495 #define BT_UUID_OTS_ACTION_CP             BT_UUID_DECLARE_16(0x2ac5)
496 /** @def BT_UUID_OTS_LIST_CP
497  *  @brief OTS Object List Control Point Characteristic
498  */
499 #define BT_UUID_OTS_LIST_CP               BT_UUID_DECLARE_16(0x2ac6)
500 /** @def BT_UUID_OTS_LIST_FILTER
501  *  @brief OTS Object List Filter Characteristic
502  */
503 #define BT_UUID_OTS_LIST_FILTER           BT_UUID_DECLARE_16(0x2ac7)
504 /** @def BT_UUID_OTS_CHANGED
505  *  @brief OTS Object Changed Characteristic
506  */
507 #define BT_UUID_OTS_CHANGED               BT_UUID_DECLARE_16(0x2ac8)
508 /** @def BT_UUID_MESH_PROV_DATA_IN
509  *  @brief Mesh Provisioning Data In
510  */
511 #define BT_UUID_MESH_PROV_DATA_IN         BT_UUID_DECLARE_16(0x2adb)
512 /** @def BT_UUID_MESH_PROV_DATA_OUT
513  *  @brief Mesh Provisioning Data Out
514  */
515 #define BT_UUID_MESH_PROV_DATA_OUT        BT_UUID_DECLARE_16(0x2adc)
516 /** @def BT_UUID_MESH_PROXY_DATA_IN
517  *  @brief Mesh Proxy Data In
518  */
519 #define BT_UUID_MESH_PROXY_DATA_IN        BT_UUID_DECLARE_16(0x2add)
520 /** @def BT_UUID_MESH_PROXY_DATA_OUT
521  *  @brief Mesh Proxy Data Out
522  */
523 #define BT_UUID_MESH_PROXY_DATA_OUT       BT_UUID_DECLARE_16(0x2ade)
524 /** @def BT_UUID_GATT_CLIENT_FEATURES
525  *  @brief Client Supported Features
526  */
527 #define BT_UUID_GATT_CLIENT_FEATURES      BT_UUID_DECLARE_16(0x2b29)
528 /** @def BT_UUID_GATT_DB_HASH
529  *  @brief Database Hash
530  */
531 #define BT_UUID_GATT_DB_HASH              BT_UUID_DECLARE_16(0x2b2a)
532 /** @def BT_UUID_GATT_SERVER_FEATURES
533  *  @brief Server Supported Features
534  */
535 #define BT_UUID_GATT_SERVER_FEATURES      BT_UUID_DECLARE_16(0x2b3a)
536 
537 /*
538  * Protocol UUIDs
539  */
540 #define BT_UUID_SDP                       BT_UUID_DECLARE_16(0x0001)
541 #define BT_UUID_UDP                       BT_UUID_DECLARE_16(0x0002)
542 #define BT_UUID_RFCOMM                    BT_UUID_DECLARE_16(0x0003)
543 #define BT_UUID_TCP                       BT_UUID_DECLARE_16(0x0004)
544 #define BT_UUID_TCS_BIN                   BT_UUID_DECLARE_16(0x0005)
545 #define BT_UUID_TCS_AT                    BT_UUID_DECLARE_16(0x0006)
546 #define BT_UUID_ATT                       BT_UUID_DECLARE_16(0x0007)
547 #define BT_UUID_OBEX                      BT_UUID_DECLARE_16(0x0008)
548 #define BT_UUID_IP                        BT_UUID_DECLARE_16(0x0009)
549 #define BT_UUID_FTP                       BT_UUID_DECLARE_16(0x000a)
550 #define BT_UUID_HTTP                      BT_UUID_DECLARE_16(0x000c)
551 #define BT_UUID_BNEP                      BT_UUID_DECLARE_16(0x000f)
552 #define BT_UUID_UPNP                      BT_UUID_DECLARE_16(0x0010)
553 #define BT_UUID_HIDP                      BT_UUID_DECLARE_16(0x0011)
554 #define BT_UUID_HCRP_CTRL                 BT_UUID_DECLARE_16(0x0012)
555 #define BT_UUID_HCRP_DATA                 BT_UUID_DECLARE_16(0x0014)
556 #define BT_UUID_HCRP_NOTE                 BT_UUID_DECLARE_16(0x0016)
557 #define BT_UUID_AVCTP                     BT_UUID_DECLARE_16(0x0017)
558 #define BT_UUID_AVDTP                     BT_UUID_DECLARE_16(0x0019)
559 #define BT_UUID_CMTP                      BT_UUID_DECLARE_16(0x001b)
560 #define BT_UUID_UDI                       BT_UUID_DECLARE_16(0x001d)
561 #define BT_UUID_MCAP_CTRL                 BT_UUID_DECLARE_16(0x001e)
562 #define BT_UUID_MCAP_DATA                 BT_UUID_DECLARE_16(0x001f)
563 #define BT_UUID_L2CAP                     BT_UUID_DECLARE_16(0x0100)
564 
565 
566 /** @brief Compare Bluetooth UUIDs.
567  *
568  *  Compares 2 Bluetooth UUIDs, if the types are different both UUIDs are
569  *  first converted to 128 bits format before comparing.
570  *
571  *  @param u1 First Bluetooth UUID to compare
572  *  @param u2 Second Bluetooth UUID to compare
573  *
574  *  @return negative value if @a u1 < @a u2, 0 if @a u1 == @a u2, else positive
575  */
576 int bt_uuid_cmp(const struct bt_uuid *u1, const struct bt_uuid *u2);
577 
578 /** @brief Create a bt_uuid from a little-endian data buffer.
579  *
580  *  Create a bt_uuid from a little-endian data buffer. The data_len parameter
581  *  is used to determine whether the UUID is in 16, 32 or 128 bit format
582  *  (length 2, 4 or 16). Note: 32 bit format is not allowed over the air.
583  *
584  *  @param uuid Pointer to the bt_uuid variable
585  *  @param data pointer to UUID stored in little-endian data buffer
586  *  @param data_len length of the UUID in the data buffer
587  *
588  *  @return true if the data was valid and the UUID was successfully created.
589  */
590 bool bt_uuid_create(struct bt_uuid *uuid, const u8_t *data, u8_t data_len);
591 #define CONFIG_BT_DEBUG
592 
593 #if defined(CONFIG_BT_DEBUG)
594 /** @brief Convert Bluetooth UUID to string.
595  *
596  *  Converts Bluetooth UUID to string.
597  *  UUID can be in any format, 16-bit, 32-bit or 128-bit.
598  *
599  *  @param uuid Bluetooth UUID
600  *  @param str pointer where to put converted string
601  *  @param len length of str
602  *
603  *  @return N/A
604  */
605 void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len);
606 
607 /** @brief Convert Bluetooth UUID to string in place.
608  *
609  *  Converts Bluetooth UUID to string in place. UUID has to be in 16 bits or
610  *  128 bits format.
611  *
612  *  @param uuid Bluetooth UUID
613  *
614  *  @return String representation of the UUID given
615  */
616 const char *bt_uuid_str(const struct bt_uuid *uuid);
617 #else
bt_uuid_to_str(const struct bt_uuid * uuid,char * str,size_t len)618 static inline void bt_uuid_to_str(const struct bt_uuid *uuid, char *str,
619 				  size_t len)
620 {
621 	if (len > 0) {
622 		str[0] = '\0';
623 	}
624 }
625 
bt_uuid_str(const struct bt_uuid * uuid)626 static inline const char *bt_uuid_str(const struct bt_uuid *uuid)
627 {
628 	return "";
629 }
630 #endif /* CONFIG_BT_DEBUG */
631 
632 #ifdef __cplusplus
633 }
634 #endif
635 
636 /**
637  * @}
638  */
639 
640 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_UUID_H_ */
641