1 /** @file
2  *  @brief Bluetooth Generic Access Profile defines and Assigned Numbers.
3  */
4 
5 /*
6  * Copyright (c) 2019 Nordic Semiconductor ASA
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 
11 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_GAP_H_
12 #define ZEPHYR_INCLUDE_BLUETOOTH_GAP_H_
13 
14 #include <zephyr/sys/util_macro.h>
15 #include <zephyr/bluetooth/byteorder.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /**
22  * @brief Bluetooth Generic Access Profile defines and Assigned Numbers.
23  * @defgroup bt_gap_defines Defines and Assigned Numbers
24  * @ingroup bt_gap
25  * @{
26  */
27 
28 /**
29  * @name Company Identifiers (see Bluetooth Assigned Numbers)
30  * @{
31  */
32 #define BT_COMP_ID_LF           0x05f1 /**< The Linux Foundation */
33 /**
34  * @}
35  */
36 
37 /**
38  * @name EIR/AD data type definitions
39  * @{
40  */
41 #define BT_DATA_FLAGS                    0x01 /**< AD flags */
42 #define BT_DATA_UUID16_SOME              0x02 /**< 16-bit UUID, more available */
43 #define BT_DATA_UUID16_ALL               0x03 /**< 16-bit UUID, all listed */
44 #define BT_DATA_UUID32_SOME              0x04 /**< 32-bit UUID, more available */
45 #define BT_DATA_UUID32_ALL               0x05 /**< 32-bit UUID, all listed */
46 #define BT_DATA_UUID128_SOME             0x06 /**< 128-bit UUID, more available */
47 #define BT_DATA_UUID128_ALL              0x07 /**< 128-bit UUID, all listed */
48 #define BT_DATA_NAME_SHORTENED           0x08 /**< Shortened name */
49 #define BT_DATA_NAME_COMPLETE            0x09 /**< Complete name */
50 #define BT_DATA_TX_POWER                 0x0a /**< Tx Power */
51 #define BT_DATA_DEVICE_CLASS             0x0d /**< Class of Device */
52 #define BT_DATA_SIMPLE_PAIRING_HASH_C192 0x0e /**< Simple Pairing Hash C-192 */
53 #define BT_DATA_SIMPLE_PAIRING_RAND_C192 0x0f /**< Simple Pairing Randomizer R-192 */
54 #define BT_DATA_DEVICE_ID                0x10 /**< Device ID (Profile) */
55 #define BT_DATA_SM_TK_VALUE              0x10 /**< Security Manager TK Value */
56 #define BT_DATA_SM_OOB_FLAGS             0x11 /**< Security Manager OOB Flags */
57 #define BT_DATA_PERIPHERAL_INT_RANGE     0x12 /**< Peripheral Connection Interval Range */
58 #define BT_DATA_SOLICIT16                0x14 /**< Solicit UUIDs, 16-bit */
59 #define BT_DATA_SOLICIT128               0x15 /**< Solicit UUIDs, 128-bit */
60 #define BT_DATA_SVC_DATA16               0x16 /**< Service data, 16-bit UUID */
61 #define BT_DATA_PUB_TARGET_ADDR          0x17 /**< Public Target Address */
62 #define BT_DATA_RAND_TARGET_ADDR         0x18 /**< Random Target Address */
63 #define BT_DATA_GAP_APPEARANCE           0x19 /**< GAP appearance */
64 #define BT_DATA_ADV_INT                  0x1a /**< Advertising Interval */
65 #define BT_DATA_LE_BT_DEVICE_ADDRESS     0x1b /**< LE Bluetooth Device Address */
66 #define BT_DATA_LE_ROLE                  0x1c /**< LE Role */
67 #define BT_DATA_SIMPLE_PAIRING_HASH      0x1d /**< Simple Pairing Hash C256 */
68 #define BT_DATA_SIMPLE_PAIRING_RAND      0x1e /**< Simple Pairing Randomizer R256 */
69 #define BT_DATA_SOLICIT32                0x1f /**< Solicit UUIDs, 32-bit */
70 #define BT_DATA_SVC_DATA32               0x20 /**< Service data, 32-bit UUID */
71 #define BT_DATA_SVC_DATA128              0x21 /**< Service data, 128-bit UUID */
72 #define BT_DATA_LE_SC_CONFIRM_VALUE      0x22 /**< LE SC Confirmation Value */
73 #define BT_DATA_LE_SC_RANDOM_VALUE       0x23 /**< LE SC Random Value */
74 #define BT_DATA_URI                      0x24 /**< URI */
75 #define BT_DATA_INDOOR_POS               0x25 /**< Indoor Positioning */
76 #define BT_DATA_TRANS_DISCOVER_DATA      0x26 /**< Transport Discovery Data */
77 #define BT_DATA_LE_SUPPORTED_FEATURES    0x27 /**< LE Supported Features */
78 #define BT_DATA_CHANNEL_MAP_UPDATE_IND   0x28 /**< Channel Map Update Indication */
79 #define BT_DATA_MESH_PROV                0x29 /**< Mesh Provisioning PDU */
80 #define BT_DATA_MESH_MESSAGE             0x2a /**< Mesh Networking PDU */
81 #define BT_DATA_MESH_BEACON              0x2b /**< Mesh Beacon */
82 #define BT_DATA_BIG_INFO                 0x2c /**< BIGInfo */
83 #define BT_DATA_BROADCAST_CODE           0x2d /**< Broadcast Code */
84 #define BT_DATA_CSIS_RSI                 0x2e /**< CSIS Random Set ID type */
85 #define BT_DATA_ADV_INT_LONG             0x2f /**< Advertising Interval long */
86 #define BT_DATA_BROADCAST_NAME           0x30 /**< Broadcast Name */
87 #define BT_DATA_ENCRYPTED_AD_DATA        0x31 /**< Encrypted Advertising Data */
88 #define BT_DATA_PAWR_TIMING_INFO         0x32 /**< Periodic Advertising Response Timing Info */
89 #define BT_DATA_ESL                      0x34 /**< Electronic Shelf Label Profile */
90 #define BT_DATA_3D_INFO                  0x3D /**< 3D Information Data */
91 
92 #define BT_DATA_MANUFACTURER_DATA        0xff /**< Manufacturer Specific Data */
93 
94 #define BT_LE_AD_LIMITED                 0x01 /**< Limited Discoverable */
95 #define BT_LE_AD_GENERAL                 0x02 /**< General Discoverable */
96 #define BT_LE_AD_NO_BREDR                0x04 /**< BR/EDR not supported */
97 /**
98  * @}
99  */
100 
101 /**
102  * @name Appearance Values
103  *
104  * Last Modified on 2023-01-05
105  * @{
106  */
107 /** Generic Unknown */
108 #define BT_APPEARANCE_UNKNOWN                               0x0000
109 /** Generic Phone */
110 #define BT_APPEARANCE_GENERIC_PHONE                         0x0040
111 /** Generic Computer */
112 #define BT_APPEARANCE_GENERIC_COMPUTER                      0x0080
113 /** Desktop Workstation */
114 #define BT_APPEARANCE_COMPUTER_DESKTOP_WORKSTATION          0x0081
115 /** Server-class Computer */
116 #define BT_APPEARANCE_COMPUTER_SERVER_CLASS                 0x0082
117 /** Laptop */
118 #define BT_APPEARANCE_COMPUTER_LAPTOP                       0x0083
119 /** Handheld PC/PDA (clamshell) */
120 #define BT_APPEARANCE_COMPUTER_HANDHELD_PCPDA               0x0084
121 /** Palm­size PC/PDA */
122 #define BT_APPEARANCE_COMPUTER_PALMSIZE_PCPDA               0x0085
123 /** Wearable computer (watch size) */
124 #define BT_APPEARANCE_COMPUTER_WEARABLE_COMPUTER            0x0086
125 /** Tablet */
126 #define BT_APPEARANCE_COMPUTER_TABLET                       0x0087
127 /** Docking Station */
128 #define BT_APPEARANCE_COMPUTER_DOCKING_STATION              0x0088
129 /** All in One */
130 #define BT_APPEARANCE_COMPUTER_ALL_IN_ONE                   0x0089
131 /** Blade Server */
132 #define BT_APPEARANCE_COMPUTER_BLADE_SERVER                 0x008A
133 /** Convertible */
134 #define BT_APPEARANCE_COMPUTER_CONVERTIBLE                  0x008B
135 /** Detachable */
136 #define BT_APPEARANCE_COMPUTER_DETACHABLE                   0x008C
137 /** IoT Gateway */
138 #define BT_APPEARANCE_COMPUTER_IOT_GATEWAY                  0x008D
139 /** Mini PC */
140 #define BT_APPEARANCE_COMPUTER_MINI_PC                      0x008E
141 /** Stick PC */
142 #define BT_APPEARANCE_COMPUTER_STICK_PC                     0x008F
143 /** Generic Watch */
144 #define BT_APPEARANCE_GENERIC_WATCH                         0x00C0
145 /** Sports Watch */
146 #define BT_APPEARANCE_SPORTS_WATCH                          0x00C1
147 /** Smartwatch */
148 #define BT_APPEARANCE_SMARTWATCH                            0x00C2
149 /** Generic Clock */
150 #define BT_APPEARANCE_GENERIC_CLOCK                         0x0100
151 /** Generic Display */
152 #define BT_APPEARANCE_GENERIC_DISPLAY                       0x0140
153 /** Generic Remote Control */
154 #define BT_APPEARANCE_GENERIC_REMOTE                        0x0180
155 /** Generic Eye-glasses */
156 #define BT_APPEARANCE_GENERIC_EYEGLASSES                    0x01C0
157 /** Generic Tag */
158 #define BT_APPEARANCE_GENERIC_TAG                           0x0200
159 /** Generic Keyring */
160 #define BT_APPEARANCE_GENERIC_KEYRING                       0x0240
161 /** Generic Media Player */
162 #define BT_APPEARANCE_GENERIC_MEDIA_PLAYER                  0x0280
163 /** Generic Barcode Scanner */
164 #define BT_APPEARANCE_GENERIC_BARCODE_SCANNER               0x02C0
165 /** Generic Thermometer */
166 #define BT_APPEARANCE_GENERIC_THERMOMETER                   0x0300
167 /** Ear Thermometer */
168 #define BT_APPEARANCE_THERMOMETER_EAR                       0x0301
169 /** Generic Heart Rate Sensor */
170 #define BT_APPEARANCE_GENERIC_HEART_RATE                    0x0340
171 /** Heart Rate Belt */
172 #define BT_APPEARANCE_HEART_RATE_BELT                       0x0341
173 /** Generic Blood Pressure */
174 #define BT_APPEARANCE_GENERIC_BLOOD_PRESSURE                0x0380
175 /** Arm Blood Pressure */
176 #define BT_APPEARANCE_BLOOD_PRESSURE_ARM                    0x0381
177 /** Wrist Blood Pressure */
178 #define BT_APPEARANCE_BLOOD_PRESSURE_WRIST                  0x0382
179 /** Generic Human Interface Device */
180 #define BT_APPEARANCE_GENERIC_HID                           0x03C0
181 /** Keyboard */
182 #define BT_APPEARANCE_HID_KEYBOARD                          0x03C1
183 /** Mouse */
184 #define BT_APPEARANCE_HID_MOUSE                             0x03C2
185 /** Joystick */
186 #define BT_APPEARANCE_HID_JOYSTICK                          0x03C3
187 /** Gamepad */
188 #define BT_APPEARANCE_HID_GAMEPAD                           0x03C4
189 /** Digitizer Tablet */
190 #define BT_APPEARANCE_HID_DIGITIZER_TABLET                  0x03C5
191 /** Card Reader */
192 #define BT_APPEARANCE_HID_CARD_READER                       0x03C6
193 /** Digital Pen */
194 #define BT_APPEARANCE_HID_DIGITAL_PEN                       0x03C7
195 /** Barcode Scanner */
196 #define BT_APPEARANCE_HID_BARCODE_SCANNER                   0x03C8
197 /** Touchpad */
198 #define BT_APPEARANCE_HID_TOUCHPAD                          0x03C9
199 /** Presentation Remote */
200 #define BT_APPEARANCE_HID_PRESENTATION_REMOTE               0x03CA
201 /** Generic Glucose Meter */
202 #define BT_APPEARANCE_GENERIC_GLUCOSE                       0x0400
203 /** Generic Running Walking Sensor */
204 #define BT_APPEARANCE_GENERIC_WALKING                       0x0440
205 /** In-Shoe Running Walking Sensor */
206 #define BT_APPEARANCE_WALKING_IN_SHOE                       0x0441
207 /** On-Shoe Running Walking Sensor */
208 #define BT_APPEARANCE_WALKING_ON_SHOE                       0x0442
209 /** On-Hip Running Walking Sensor */
210 #define BT_APPEARANCE_WALKING_ON_HIP                        0x0443
211 /** Generic Cycling */
212 #define BT_APPEARANCE_GENERIC_CYCLING                       0x0480
213 /** Cycling Computer */
214 #define BT_APPEARANCE_CYCLING_COMPUTER                      0x0481
215 /** Speed Sensor */
216 #define BT_APPEARANCE_CYCLING_SPEED                         0x0482
217 /** Cadence Sensor */
218 #define BT_APPEARANCE_CYCLING_CADENCE                       0x0483
219 /** Power Sensor */
220 #define BT_APPEARANCE_CYCLING_POWER                         0x0484
221 /** Speed and Cadence Sensor */
222 #define BT_APPEARANCE_CYCLING_SPEED_CADENCE                 0x0485
223 /** Generic Control Device */
224 #define BT_APPEARANCE_GENERIC_CONTROL_DEVICE                0x04C0
225 /** Switch */
226 #define BT_APPEARANCE_CONTROL_SWITCH                        0x04C1
227 /** Multi-switch */
228 #define BT_APPEARANCE_CONTROL_MULTI_SWITCH                  0x04C2
229 /** Button */
230 #define BT_APPEARANCE_CONTROL_BUTTON                        0x04C3
231 /** Slider */
232 #define BT_APPEARANCE_CONTROL_SLIDER                        0x04C4
233 /** Rotary Switch */
234 #define BT_APPEARANCE_CONTROL_ROTARY_SWITCH                 0x04C5
235 /** Touch Panel */
236 #define BT_APPEARANCE_CONTROL_TOUCH_PANEL                   0x04C6
237 /** Single Switch */
238 #define BT_APPEARANCE_CONTROL_SINGLE_SWITCH                 0x04C7
239 /** Double Switch */
240 #define BT_APPEARANCE_CONTROL_DOUBLE_SWITCH                 0x04C8
241 /** Triple Switch */
242 #define BT_APPEARANCE_CONTROL_TRIPLE_SWITCH                 0x04C9
243 /** Battery Switch */
244 #define BT_APPEARANCE_CONTROL_BATTERY_SWITCH                0x04CA
245 /** Energy Harvesting Switch */
246 #define BT_APPEARANCE_CONTROL_ENERGY_HARVESTING_SWITCH      0x04CB
247 /** Push Button */
248 #define BT_APPEARANCE_CONTROL_PUSH_BUTTON                   0x04CC
249 /** Generic Network Device */
250 #define BT_APPEARANCE_GENERIC_NETWORK_DEVICE                0x0500
251 /** Access Point */
252 #define BT_APPEARANCE_NETWORK_ACCESS_POINT                  0x0501
253 /** Mesh Device */
254 #define BT_APPEARANCE_NETWORK_MESH_DEVICE                   0x0502
255 /** Mesh Network Proxy */
256 #define BT_APPEARANCE_NETWORK_MESH_PROXY                    0x0503
257 /** Generic Sensor */
258 #define BT_APPEARANCE_GENERIC_SENSOR                        0x0540
259 /** Motion Sensor */
260 #define BT_APPEARANCE_SENSOR_MOTION                         0x0541
261 /** Air quality Sensor */
262 #define BT_APPEARANCE_SENSOR_AIR_QUALITY                    0x0542
263 /** Temperature Sensor */
264 #define BT_APPEARANCE_SENSOR_TEMPERATURE                    0x0543
265 /** Humidity Sensor */
266 #define BT_APPEARANCE_SENSOR_HUMIDITY                       0x0544
267 /** Leak Sensor */
268 #define BT_APPEARANCE_SENSOR_LEAK                           0x0545
269 /** Smoke Sensor */
270 #define BT_APPEARANCE_SENSOR_SMOKE                          0x0546
271 /** Occupancy Sensor */
272 #define BT_APPEARANCE_SENSOR_OCCUPANCY                      0x0547
273 /** Contact Sensor */
274 #define BT_APPEARANCE_SENSOR_CONTACT                        0x0548
275 /** Carbon Monoxide Sensor */
276 #define BT_APPEARANCE_SENSOR_CARBON_MONOXIDE                0x0549
277 /** Carbon Dioxide Sensor */
278 #define BT_APPEARANCE_SENSOR_CARBON_DIOXIDE                 0x054A
279 /** Ambient Light Sensor */
280 #define BT_APPEARANCE_SENSOR_AMBIENT_LIGHT                  0x054B
281 /** Energy Sensor */
282 #define BT_APPEARANCE_SENSOR_ENERGY                         0x054C
283 /** Color Light Sensor */
284 #define BT_APPEARANCE_SENSOR_COLOR_LIGHT                    0x054D
285 /** Rain Sensor */
286 #define BT_APPEARANCE_SENSOR_RAIN                           0x054E
287 /** Fire Sensor */
288 #define BT_APPEARANCE_SENSOR_FIRE                           0x054F
289 /** Wind Sensor */
290 #define BT_APPEARANCE_SENSOR_WIND                           0x0550
291 /** Proximity Sensor */
292 #define BT_APPEARANCE_SENSOR_PROXIMITY                      0x0551
293 /** Multi-Sensor */
294 #define BT_APPEARANCE_SENSOR_MULTI                          0x0552
295 /** Flush Mounted Sensor */
296 #define BT_APPEARANCE_SENSOR_FLUSH_MOUNTED                  0x0553
297 /** Ceiling Mounted Sensor */
298 #define BT_APPEARANCE_SENSOR_CEILING_MOUNTED                0x0554
299 /** Wall Mounted Sensor */
300 #define BT_APPEARANCE_SENSOR_WALL_MOUNTED                   0x0555
301 /** Multisensor */
302 #define BT_APPEARANCE_MULTISENSOR                           0x0556
303 /** Energy Meter */
304 #define BT_APPEARANCE_SENSOR_ENERGY_METER                   0x0557
305 /** Flame Detector */
306 #define BT_APPEARANCE_SENSOR_FLAME_DETECTOR                 0x0558
307 /** Vehicle Tire Pressure Sensor */
308 #define BT_APPEARANCE_SENSOR_VEHICLE_TIRE_PRESSURE          0x0559
309 /** Generic Light Fixtures */
310 #define BT_APPEARANCE_GENERIC_LIGHT_FIXTURES                0x0580
311 /** Wall Light */
312 #define BT_APPEARANCE_LIGHT_FIXTURES_WALL                   0x0581
313 /** Ceiling Light */
314 #define BT_APPEARANCE_LIGHT_FIXTURES_CEILING                0x0582
315 /** Floor Light */
316 #define BT_APPEARANCE_LIGHT_FIXTURES_FLOOR                  0x0583
317 /** Cabinet Light */
318 #define BT_APPEARANCE_LIGHT_FIXTURES_CABINET                0x0584
319 /** Desk Light */
320 #define BT_APPEARANCE_LIGHT_FIXTURES_DESK                   0x0585
321 /** Troffer Light */
322 #define BT_APPEARANCE_LIGHT_FIXTURES_TROFFER                0x0586
323 /** Pendant Light */
324 #define BT_APPEARANCE_LIGHT_FIXTURES_PENDANT                0x0587
325 /** In-ground Light */
326 #define BT_APPEARANCE_LIGHT_FIXTURES_IN_GROUND              0x0588
327 /** Flood Light */
328 #define BT_APPEARANCE_LIGHT_FIXTURES_FLOOD                  0x0589
329 /** Underwater Light */
330 #define BT_APPEARANCE_LIGHT_FIXTURES_UNDERWATER             0x058A
331 /** Bollard with Light */
332 #define BT_APPEARANCE_LIGHT_FIXTURES_BOLLARD_WITH           0x058B
333 /** Pathway Light */
334 #define BT_APPEARANCE_LIGHT_FIXTURES_PATHWAY                0x058C
335 /** Garden Light */
336 #define BT_APPEARANCE_LIGHT_FIXTURES_GARDEN                 0x058D
337 /** Pole-top Light */
338 #define BT_APPEARANCE_LIGHT_FIXTURES_POLE_TOP               0x058E
339 /** Spotlight */
340 #define BT_APPEARANCE_SPOT_LIGHT                            0x058F
341 /** Linear Light */
342 #define BT_APPEARANCE_LIGHT_FIXTURES_LINEAR                 0x0590
343 /** Street Light */
344 #define BT_APPEARANCE_LIGHT_FIXTURES_STREET                 0x0591
345 /** Shelves Light */
346 #define BT_APPEARANCE_LIGHT_FIXTURES_SHELVES                0x0592
347 /** Bay Light */
348 #define BT_APPEARANCE_LIGHT_FIXTURES_BAY                    0x0593
349 /** Emergency Exit Light */
350 #define BT_APPEARANCE_LIGHT_FIXTURES_EMERGENCY_EXIT         0x0594
351 /** Light Controller */
352 #define BT_APPEARANCE_LIGHT_FIXTURES_CONTROLLER             0x0595
353 /** Light Driver */
354 #define BT_APPEARANCE_LIGHT_FIXTURES_DRIVER                 0x0596
355 /** Bulb */
356 #define BT_APPEARANCE_LIGHT_FIXTURES_BULB                   0x0597
357 /** Low-bay Light */
358 #define BT_APPEARANCE_LIGHT_FIXTURES_LOW_BAY                0x0598
359 /** High-bay Light */
360 #define BT_APPEARANCE_LIGHT_FIXTURES_HIGH_BAY               0x0599
361 /** Generic Fan */
362 #define BT_APPEARANCE_GENERIC_FAN                           0x05C0
363 /** Ceiling Fan */
364 #define BT_APPEARANCE_FAN_CEILING                           0x05C1
365 /** Axial Fan */
366 #define BT_APPEARANCE_FAN_AXIAL                             0x05C2
367 /** Exhaust Fan */
368 #define BT_APPEARANCE_FAN_EXHAUST                           0x05C3
369 /** Pedestal Fan */
370 #define BT_APPEARANCE_FAN_PEDESTAL                          0x05C4
371 /** Desk Fan */
372 #define BT_APPEARANCE_FAN_DESK                              0x05C5
373 /** Wall Fan */
374 #define BT_APPEARANCE_FAN_WALL                              0x05C6
375 /** Generic HVAC */
376 #define BT_APPEARANCE_GENERIC_HVAC                          0x0600
377 /** Thermostat */
378 #define BT_APPEARANCE_HVAC_THERMOSTAT                       0x0601
379 /** Humidifier */
380 #define BT_APPEARANCE_HVAC_HUMIDIFIER                       0x0602
381 /** De-humidifier */
382 #define BT_APPEARANCE_HVAC_DEHUMIDIFIER                     0x0603
383 /** Heater */
384 #define BT_APPEARANCE_HVAC_HEATER                           0x0604
385 /** Radiator */
386 #define BT_APPEARANCE_HVAC_RADIATOR                         0x0605
387 /** Boiler */
388 #define BT_APPEARANCE_HVAC_BOILER                           0x0606
389 /** Heat Pump */
390 #define BT_APPEARANCE_HVAC_HEAT_PUMP                        0x0607
391 /** Infrared Heater */
392 #define BT_APPEARANCE_HVAC_INFRARED_HEATER                  0x0608
393 /** Radiant Panel Heater */
394 #define BT_APPEARANCE_HVAC_RADIANT_PANEL_HEATER             0x0609
395 /** Fan Heater */
396 #define BT_APPEARANCE_HVAC_FAN_HEATER                       0x060A
397 /** Air Curtain */
398 #define BT_APPEARANCE_HVAC_AIR_CURTAIN                      0x060B
399 /** Generic Air Conditioning */
400 #define BT_APPEARANCE_GENERIC_AIR_CONDITIONING              0x0640
401 /** Generic Humidifier */
402 #define BT_APPEARANCE_GENERIC_HUMIDIFIER                    0x0680
403 /** Generic Heating */
404 #define BT_APPEARANCE_GENERIC_HEATING                       0x06C0
405 /** Radiator */
406 #define BT_APPEARANCE_HEATING_RADIATOR                      0x06C1
407 /** Boiler */
408 #define BT_APPEARANCE_HEATING_BOILER                        0x06C2
409 /** Heat Pump */
410 #define BT_APPEARANCE_HEATING_HEAT_PUMP                     0x06C3
411 /** Infrared Heater */
412 #define BT_APPEARANCE_HEATING_INFRARED_HEATER               0x06C4
413 /** Radiant Panel Heater */
414 #define BT_APPEARANCE_HEATING_RADIANT_PANEL_HEATER          0x06C5
415 /** Fan Heater */
416 #define BT_APPEARANCE_HEATING_FAN_HEATER                    0x06C6
417 /** Air Curtain */
418 #define BT_APPEARANCE_HEATING_AIR_CURTAIN                   0x06C7
419 /** Generic Access Control */
420 #define BT_APPEARANCE_GENERIC_ACCESS_CONTROL                0x0700
421 /** Access Door */
422 #define BT_APPEARANCE_CONTROL_ACCESS_DOOR                   0x0701
423 /** Garage Door */
424 #define BT_APPEARANCE_CONTROL_GARAGE_DOOR                   0x0702
425 /** Emergency Exit Door */
426 #define BT_APPEARANCE_CONTROL_EMERGENCY_EXIT_DOOR           0x0703
427 /** Access Lock */
428 #define BT_APPEARANCE_CONTROL_ACCESS_LOCK                   0x0704
429 /** Elevator */
430 #define BT_APPEARANCE_CONTROL_ELEVATOR                      0x0705
431 /** Window */
432 #define BT_APPEARANCE_CONTROL_WINDOW                        0x0706
433 /** Entrance Gate */
434 #define BT_APPEARANCE_CONTROL_ENTRANCE_GATE                 0x0707
435 /** Door Lock */
436 #define BT_APPEARANCE_CONTROL_DOOR_LOCK                     0x0708
437 /** Locker */
438 #define BT_APPEARANCE_CONTROL_LOCKER                        0x0709
439 /** Generic Motorized Device */
440 #define BT_APPEARANCE_GENERIC_MOTORIZED_DEVICE              0x0740
441 /** Motorized Gate */
442 #define BT_APPEARANCE_MOTORIZED_GATE                        0x0741
443 /** Awning */
444 #define BT_APPEARANCE_MOTORIZED_AWNING                      0x0742
445 /** Blinds or Shades */
446 #define BT_APPEARANCE_MOTORIZED_BLINDS_OR_SHADES            0x0743
447 /** Curtains */
448 #define BT_APPEARANCE_MOTORIZED_CURTAINS                    0x0744
449 /** Screen */
450 #define BT_APPEARANCE_MOTORIZED_SCREEN                      0x0745
451 /** Generic Power Device */
452 #define BT_APPEARANCE_GENERIC_POWER_DEVICE                  0x0780
453 /** Power Outlet */
454 #define BT_APPEARANCE_POWER_OUTLET                          0x0781
455 /** Power Strip */
456 #define BT_APPEARANCE_POWER_STRIP                           0x0782
457 /** Plug */
458 #define BT_APPEARANCE_POWER_PLUG                            0x0783
459 /** Power Supply */
460 #define BT_APPEARANCE_POWER_SUPPLY                          0x0784
461 /** LED Driver */
462 #define BT_APPEARANCE_POWER_LED_DRIVER                      0x0785
463 /** Fluorescent Lamp Gear */
464 #define BT_APPEARANCE_POWER_FLUORESCENT_LAMP_GEAR           0x0786
465 /** HID Lamp Gear */
466 #define BT_APPEARANCE_POWER_HID_LAMP_GEAR                   0x0787
467 /** Charge Case */
468 #define BT_APPEARANCE_POWER_CHARGE_CASE                     0x0788
469 /** Power Bank */
470 #define BT_APPEARANCE_POWER_POWER_BANK                      0x0789
471 /** Generic Light Source */
472 #define BT_APPEARANCE_GENERIC_LIGHT_SOURCE                  0x07C0
473 /** Incandescent Light Bulb */
474 #define BT_APPEARANCE_LIGHT_SOURCE_INCANDESCENT_BULB        0x07C1
475 /** LED Lamp */
476 #define BT_APPEARANCE_LIGHT_SOURCE_LED_LAMP                 0x07C2
477 /** HID Lamp */
478 #define BT_APPEARANCE_LIGHT_SOURCE_HID_LAMP                 0x07C3
479 /** Fluorescent Lamp */
480 #define BT_APPEARANCE_LIGHT_SOURCE_FLUORESCENT_LAMP         0x07C4
481 /** LED Array */
482 #define BT_APPEARANCE_LIGHT_SOURCE_LED_ARRAY                0x07C5
483 /** Multi-Color LED Array */
484 #define BT_APPEARANCE_LIGHT_SOURCE_MULTICOLOR_LED_ARRAY     0x07C6
485 /** Low voltage halogen */
486 #define BT_APPEARANCE_LIGHT_SOURCE_LOW_VOLTAGE_HALOGEN      0x07C7
487 /** Organic light emitting diode */
488 #define BT_APPEARANCE_LIGHT_SOURCE_OLED                     0x07C8
489 /** Generic Window Covering */
490 #define BT_APPEARANCE_GENERIC_WINDOW_COVERING               0x0800
491 /** Window Shades */
492 #define BT_APPEARANCE_WINDOW_SHADES                         0x0801
493 /** Window Blinds */
494 #define BT_APPEARANCE_WINDOW_BLINDS                         0x0802
495 /** Window Awning */
496 #define BT_APPEARANCE_WINDOW_AWNING                         0x0803
497 /** Window Curtain */
498 #define BT_APPEARANCE_WINDOW_CURTAIN                        0x0804
499 /** Exterior Shutter */
500 #define BT_APPEARANCE_WINDOW_EXTERIOR_SHUTTER               0x0805
501 /** Exterior Screen */
502 #define BT_APPEARANCE_WINDOW_EXTERIOR_SCREEN                0x0806
503 /** Generic Audio Sink */
504 #define BT_APPEARANCE_GENERIC_AUDIO_SINK                    0x0840
505 /** Standalone Speaker */
506 #define BT_APPEARANCE_AUDIO_SINK_STANDALONE_SPEAKER         0x0841
507 /** Soundbar */
508 #define BT_APPEARANCE_AUDIO_SINK_SOUNDBAR                   0x0842
509 /** Bookshelf Speaker */
510 #define BT_APPEARANCE_AUDIO_SINK_BOOKSHELF_SPEAKER          0x0843
511 /** Standmounted Speaker */
512 #define BT_APPEARANCE_AUDIO_SINK_STANDMOUNTED_SPEAKER       0x0844
513 /** Speakerphone */
514 #define BT_APPEARANCE_AUDIO_SINK_SPEAKERPHONE               0x0845
515 /** Generic Audio Source */
516 #define BT_APPEARANCE_GENERIC_AUDIO_SOURCE                  0x0880
517 /** Microphone */
518 #define BT_APPEARANCE_AUDIO_SOURCE_MICROPHONE               0x0881
519 /** Alarm */
520 #define BT_APPEARANCE_AUDIO_SOURCE_ALARM                    0x0882
521 /** Bell */
522 #define BT_APPEARANCE_AUDIO_SOURCE_BELL                     0x0883
523 /** Horn */
524 #define BT_APPEARANCE_AUDIO_SOURCE_HORN                     0x0884
525 /** Broadcasting Device */
526 #define BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_DEVICE      0x0885
527 /** Service Desk */
528 #define BT_APPEARANCE_AUDIO_SOURCE_SERVICE_DESK             0x0886
529 /** Kiosk */
530 #define BT_APPEARANCE_AUDIO_SOURCE_KIOSK                    0x0887
531 /** Broadcasting Room */
532 #define BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_ROOM        0x0888
533 /** Auditorium */
534 #define BT_APPEARANCE_AUDIO_SOURCE_AUDITORIUM               0x0889
535 /** Generic Motorized Vehicle */
536 #define BT_APPEARANCE_GENERIC_MOTORIZED_VEHICLE             0x08C0
537 /** Car */
538 #define BT_APPEARANCE_VEHICLE_CAR                           0x08C1
539 /** Large Goods Vehicle */
540 #define BT_APPEARANCE_VEHICLE_LARGE_GOODS                   0x08C2
541 /** 2-Wheeled Vehicle */
542 #define BT_APPEARANCE_VEHICLE_TWO_WHEELED                   0x08C3
543 /** Motorbike */
544 #define BT_APPEARANCE_VEHICLE_MOTORBIKE                     0x08C4
545 /** Scooter */
546 #define BT_APPEARANCE_VEHICLE_SCOOTER                       0x08C5
547 /** Moped */
548 #define BT_APPEARANCE_VEHICLE_MOPED                         0x08C6
549 /** 3-Wheeled Vehicle */
550 #define BT_APPEARANCE_VEHICLE_THREE_WHEELED                 0x08C7
551 /** Light Vehicle */
552 #define BT_APPEARANCE_VEHICLE_LIGHT                         0x08C8
553 /** Quad Bike */
554 #define BT_APPEARANCE_VEHICLE_QUAD_BIKE                     0x08C9
555 /** Minibus */
556 #define BT_APPEARANCE_VEHICLE_MINIBUS                       0x08CA
557 /** Bus */
558 #define BT_APPEARANCE_VEHICLE_BUS                           0x08CB
559 /** Trolley */
560 #define BT_APPEARANCE_VEHICLE_TROLLEY                       0x08CC
561 /** Agricultural Vehicle */
562 #define BT_APPEARANCE_VEHICLE_AGRICULTURAL                  0x08CD
563 /** Camper/Caravan */
564 #define BT_APPEARANCE_VEHICLE_CAMPER_OR_CARAVAN             0x08CE
565 /** Recreational Vehicle/Motor Home */
566 #define BT_APPEARANCE_VEHICLE_RECREATIONAL                  0x08CF
567 /** Generic Domestic Appliance */
568 #define BT_APPEARANCE_GENERIC_DOMESTIC_APPLIANCE            0x0900
569 /** Refrigerator */
570 #define BT_APPEARANCE_APPLIANCE_REFRIGERATOR                0x0901
571 /** Freezer */
572 #define BT_APPEARANCE_APPLIANCE_FREEZER                     0x0902
573 /** Oven */
574 #define BT_APPEARANCE_APPLIANCE_OVEN                        0x0903
575 /** Microwave */
576 #define BT_APPEARANCE_APPLIANCE_MICROWAVE                   0x0904
577 /** Toaster */
578 #define BT_APPEARANCE_APPLIANCE_TOASTER                     0x0905
579 /** Washing Machine */
580 #define BT_APPEARANCE_APPLIANCE_WASHING_MACHINE             0x0906
581 /** Dryer */
582 #define BT_APPEARANCE_APPLIANCE_DRYER                       0x0907
583 /** Coffee maker */
584 #define BT_APPEARANCE_APPLIANCE_COFFEE_MAKER                0x0908
585 /** Clothes iron */
586 #define BT_APPEARANCE_APPLIANCE_CLOTHES_IRON                0x0909
587 /** Curling iron */
588 #define BT_APPEARANCE_APPLIANCE_CURLING_IRON                0x090A
589 /** Hair dryer */
590 #define BT_APPEARANCE_APPLIANCE_HAIR_DRYER                  0x090B
591 /** Vacuum cleaner */
592 #define BT_APPEARANCE_APPLIANCE_VACUUM_CLEANER              0x090C
593 /** Robotic vacuum cleaner */
594 #define BT_APPEARANCE_APPLIANCE_ROBOTIC_VACUUM_CLEANER      0x090D
595 /** Rice cooker */
596 #define BT_APPEARANCE_APPLIANCE_RICE_COOKER                 0x090E
597 /** Clothes steamer */
598 #define BT_APPEARANCE_APPLIANCE_CLOTHES_STEAMER             0x090F
599 /** Generic Wearable Audio Device */
600 #define BT_APPEARANCE_GENERIC_WEARABLE_AUDIO_DEVICE         0x0940
601 /** Earbud */
602 #define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_EARBUD          0x0941
603 /** Headset */
604 #define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADSET         0x0942
605 /** Headphones */
606 #define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADPHONES      0x0943
607 /** Neck Band */
608 #define BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_NECK_BAND       0x0944
609 /** Generic Aircraft */
610 #define BT_APPEARANCE_GENERIC_AIRCRAFT                      0x0980
611 /** Light Aircraft */
612 #define BT_APPEARANCE_AIRCRAFT_LIGHT                        0x0981
613 /** Microlight */
614 #define BT_APPEARANCE_AIRCRAFT_MICROLIGHT                   0x0982
615 /** Paraglider */
616 #define BT_APPEARANCE_AIRCRAFT_PARAGLIDER                   0x0983
617 /** Large Passenger Aircraft */
618 #define BT_APPEARANCE_AIRCRAFT_LARGE_PASSENGER              0x0984
619 /** Generic AV Equipment */
620 #define BT_APPEARANCE_GENERIC_AV_EQUIPMENT                  0x09C0
621 /** Amplifier */
622 #define BT_APPEARANCE_AV_EQUIPMENT_AMPLIFIER                0x09C1
623 /** Receiver */
624 #define BT_APPEARANCE_AV_EQUIPMENT_RECEIVER                 0x09C2
625 /** Radio */
626 #define BT_APPEARANCE_AV_EQUIPMENT_RADIO                    0x09C3
627 /** Tuner */
628 #define BT_APPEARANCE_AV_EQUIPMENT_TUNER                    0x09C4
629 /** Turntable */
630 #define BT_APPEARANCE_AV_EQUIPMENT_TURNTABLE                0x09C5
631 /** CD Player */
632 #define BT_APPEARANCE_AV_EQUIPMENT_CD_PLAYER                0x09C6
633 /** DVD Player */
634 #define BT_APPEARANCE_AV_EQUIPMENT_DVD_PLAYER               0x09C7
635 /** Bluray Player */
636 #define BT_APPEARANCE_AV_EQUIPMENT_BLURAY_PLAYER            0x09C8
637 /** Optical Disc Player */
638 #define BT_APPEARANCE_AV_EQUIPMENT_OPTICAL_DISC_PLAYER      0x09C9
639 /** Set-Top Box */
640 #define BT_APPEARANCE_AV_EQUIPMENT_SET_TOP_BOX              0x09CA
641 /** Generic Display Equipment */
642 #define BT_APPEARANCE_GENERIC_DISPLAY_EQUIPMENT             0x0A00
643 /** Television */
644 #define BT_APPEARANCE_DISPLAY_EQUIPMENT_TELEVISION          0x0A01
645 /** Monitor */
646 #define BT_APPEARANCE_DISPLAY_EQUIPMENT_MONITOR             0x0A02
647 /** Projector */
648 #define BT_APPEARANCE_DISPLAY_EQUIPMENT_PROJECTOR           0x0A03
649 /** Generic Hearing aid */
650 #define BT_APPEARANCE_GENERIC_HEARING_AID                   0x0A40
651 /** In-ear hearing aid */
652 #define BT_APPEARANCE_HEARING_AID_IN_EAR                    0x0A41
653 /** Behind-ear hearing aid */
654 #define BT_APPEARANCE_HEARING_AID_BEHIND_EAR                0x0A42
655 /** Cochlear Implant */
656 #define BT_APPEARANCE_HEARING_AID_COCHLEAR_IMPLANT          0x0A43
657 /** Generic Gaming */
658 #define BT_APPEARANCE_GENERIC_GAMING                        0x0A80
659 /** Home Video Game Console */
660 #define BT_APPEARANCE_HOME_VIDEO_GAME_CONSOLE               0x0A81
661 /** Portable handheld console */
662 #define BT_APPEARANCE_PORTABLE_HANDHELD_CONSOLE             0x0A82
663 /** Generic Signage */
664 #define BT_APPEARANCE_GENERIC_SIGNAGE                       0x0AC0
665 /** Digital Signage */
666 #define BT_APPEARANCE_SIGNAGE_DIGITAL                       0x0AC1
667 /** Electronic Label */
668 #define BT_APPEARANCE_SIGNAGE_ELECTRONIC_LABEL              0x0AC2
669 /** Generic Pulse Oximeter */
670 #define BT_APPEARANCE_GENERIC_PULSE_OXIMETER                0x0C40
671 /** Fingertip Pulse Oximeter */
672 #define BT_APPEARANCE_PULSE_OXIMETER_FINGERTIP              0x0C41
673 /** Wrist Worn Pulse Oximeter */
674 #define BT_APPEARANCE_PULSE_OXIMETER_WRIST                  0x0C42
675 /** Generic Weight Scale */
676 #define BT_APPEARANCE_GENERIC_WEIGHT_SCALE                  0x0C80
677 /** Generic Personal Mobility Device */
678 #define BT_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE      0x0CC0
679 /** Powered Wheelchair */
680 #define BT_APPEARANCE_MOBILITY_POWERED_WHEELCHAIR           0x0CC1
681 /** Mobility Scooter */
682 #define BT_APPEARANCE_MOBILITY_SCOOTER                      0x0CC2
683 /** Continuous Glucose Monitor */
684 #define BT_APPEARANCE_CONTINUOUS_GLUCOSE_MONITOR            0x0D00
685 /** Generic Insulin Pump */
686 #define BT_APPEARANCE_GENERIC_INSULIN_PUMP                  0x0D40
687 /** Insulin Pump, durable pump */
688 #define BT_APPEARANCE_INSULIN_PUMP_DURABLE                  0x0D41
689 /** Insulin Pump, patch pump */
690 #define BT_APPEARANCE_INSULIN_PUMP_PATCH                    0x0D44
691 /** Insulin Pen */
692 #define BT_APPEARANCE_INSULIN_PEN                           0x0D48
693 /** Generic Medication Delivery */
694 #define BT_APPEARANCE_GENERIC_MEDICATION_DELIVERY           0x0D80
695 /** Generic Spirometer */
696 #define BT_APPEARANCE_GENERIC_SPIROMETER                    0x0DC0
697 /** Handheld Spirometer */
698 #define BT_APPEARANCE_SPIROMETER_HANDHELD                   0x0DC1
699 /** Generic Outdoor Sports Activity */
700 #define BT_APPEARANCE_GENERIC_OUTDOOR_SPORTS                0x1440
701 /** Location Display */
702 #define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION               0x1441
703 /** Location and Navigation Display */
704 #define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV       0x1442
705 /** Location Pod */
706 #define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD           0x1443
707 /** Location and Navigation Pod */
708 #define BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV   0x1444
709 /**
710  * @}
711  */
712 
713 /**
714  * @name Defined GAP timers
715  * @{
716  */
717 #define BT_GAP_SCAN_FAST_INTERVAL_MIN           0x0030  /* 30 ms    */
718 #define BT_GAP_SCAN_FAST_INTERVAL               0x0060  /* 60 ms    */
719 #define BT_GAP_SCAN_FAST_WINDOW                 0x0030  /* 30 ms    */
720 #define BT_GAP_SCAN_SLOW_INTERVAL_1             0x0800  /* 1.28 s   */
721 #define BT_GAP_SCAN_SLOW_WINDOW_1               0x0012  /* 11.25 ms */
722 #define BT_GAP_SCAN_SLOW_INTERVAL_2             0x1000  /* 2.56 s   */
723 #define BT_GAP_SCAN_SLOW_WINDOW_2               0x0012  /* 11.25 ms */
724 #define BT_GAP_ADV_FAST_INT_MIN_1               0x0030  /* 30 ms    */
725 #define BT_GAP_ADV_FAST_INT_MAX_1               0x0060  /* 60 ms    */
726 #define BT_GAP_ADV_FAST_INT_MIN_2               0x00a0  /* 100 ms   */
727 #define BT_GAP_ADV_FAST_INT_MAX_2               0x00f0  /* 150 ms   */
728 #define BT_GAP_ADV_SLOW_INT_MIN                 0x0640  /* 1 s      */
729 #define BT_GAP_ADV_SLOW_INT_MAX                 0x0780  /* 1.2 s    */
730 #define BT_GAP_PER_ADV_FAST_INT_MIN_1           0x0018  /* 30 ms    */
731 #define BT_GAP_PER_ADV_FAST_INT_MAX_1           0x0030  /* 60 ms    */
732 #define BT_GAP_PER_ADV_FAST_INT_MIN_2           0x0050  /* 100 ms   */
733 #define BT_GAP_PER_ADV_FAST_INT_MAX_2           0x0078  /* 150 ms   */
734 #define BT_GAP_PER_ADV_SLOW_INT_MIN             0x0320  /* 1 s      */
735 #define BT_GAP_PER_ADV_SLOW_INT_MAX             0x03C0  /* 1.2 s    */
736 #define BT_GAP_INIT_CONN_INT_MIN                0x0018  /* 30 ms    */
737 #define BT_GAP_INIT_CONN_INT_MAX                0x0028  /* 50 ms    */
738 /**
739  * @}
740  */
741 
742 /** LE PHY types */
743 enum {
744 	/** Convenience macro for when no PHY is set. */
745 	BT_GAP_LE_PHY_NONE                    = 0,
746 	/** LE 1M PHY */
747 	BT_GAP_LE_PHY_1M                      = BIT(0),
748 	 /** LE 2M PHY */
749 	BT_GAP_LE_PHY_2M                      = BIT(1),
750 	/** LE Coded PHY */
751 	BT_GAP_LE_PHY_CODED                   = BIT(2),
752 };
753 
754 /** Advertising PDU types */
755 enum {
756 	/** Scannable and connectable advertising. */
757 	BT_GAP_ADV_TYPE_ADV_IND               = 0x00,
758 	/** Directed connectable advertising. */
759 	BT_GAP_ADV_TYPE_ADV_DIRECT_IND        = 0x01,
760 	/** Non-connectable and scannable advertising. */
761 	BT_GAP_ADV_TYPE_ADV_SCAN_IND          = 0x02,
762 	/** Non-connectable and non-scannable advertising. */
763 	BT_GAP_ADV_TYPE_ADV_NONCONN_IND       = 0x03,
764 	/** Additional advertising data requested by an active scanner. */
765 	BT_GAP_ADV_TYPE_SCAN_RSP              = 0x04,
766 	/** Extended advertising, see advertising properties. */
767 	BT_GAP_ADV_TYPE_EXT_ADV               = 0x05,
768 };
769 
770 /** Advertising PDU properties */
771 enum {
772 	/** Connectable advertising. */
773 	BT_GAP_ADV_PROP_CONNECTABLE           = BIT(0),
774 	/** Scannable advertising. */
775 	BT_GAP_ADV_PROP_SCANNABLE             = BIT(1),
776 	/** Directed advertising. */
777 	BT_GAP_ADV_PROP_DIRECTED              = BIT(2),
778 	/** Additional advertising data requested by an active scanner. */
779 	BT_GAP_ADV_PROP_SCAN_RESPONSE         = BIT(3),
780 	/** Extended advertising. */
781 	BT_GAP_ADV_PROP_EXT_ADV               = BIT(4),
782 };
783 
784 /** Maximum advertising data length. */
785 #define BT_GAP_ADV_MAX_ADV_DATA_LEN             31
786 /** Maximum extended advertising data length.
787  *
788  *  @note The maximum advertising data length that can be sent by an extended
789  *        advertiser is defined by the controller.
790  */
791 #define BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN         1650
792 
793 #define BT_GAP_TX_POWER_INVALID                 0x7f
794 #define BT_GAP_RSSI_INVALID                     0x7f
795 #define BT_GAP_SID_INVALID                      0xff
796 #define BT_GAP_NO_TIMEOUT                       0x0000
797 
798 /* The maximum allowed high duty cycle directed advertising timeout, 1.28
799  * seconds in 10 ms unit.
800  */
801 #define BT_GAP_ADV_HIGH_DUTY_CYCLE_MAX_TIMEOUT  128
802 
803 /** Default data length */
804 #define BT_GAP_DATA_LEN_DEFAULT                 0x001b /* 27 bytes */
805 /** Maximum data length */
806 #define BT_GAP_DATA_LEN_MAX                     0x00fb /* 251 bytes */
807 
808 /** Default data time */
809 #define BT_GAP_DATA_TIME_DEFAULT                0x0148 /* 328 us */
810 /** Maximum data time */
811 #define BT_GAP_DATA_TIME_MAX                    0x4290 /* 17040 us */
812 
813 /** Maximum advertising set number */
814 #define BT_GAP_SID_MAX                          0x0F
815 /** Maximum number of consecutive periodic advertisement events that can be
816  *  skipped after a successful receive.
817  */
818 #define BT_GAP_PER_ADV_MAX_SKIP                 0x01F3
819 /** Minimum Periodic Advertising Timeout (N * 10 ms) */
820 #define BT_GAP_PER_ADV_MIN_TIMEOUT              0x000A /* 100 ms */
821 /** Maximum Periodic Advertising Timeout (N * 10 ms) */
822 #define BT_GAP_PER_ADV_MAX_TIMEOUT              0x4000 /* 163.84 s */
823 /** Minimum Periodic Advertising Interval (N * 1.25 ms) */
824 #define BT_GAP_PER_ADV_MIN_INTERVAL             0x0006 /* 7.5 ms */
825 /** Maximum Periodic Advertising Interval (N * 1.25 ms) */
826 #define BT_GAP_PER_ADV_MAX_INTERVAL             0xFFFF /* 81.91875 s */
827 
828 /**
829  * @brief Convert periodic advertising interval (N * 1.25 ms) to milliseconds
830  *
831  * 5 / 4 represents 1.25 ms unit.
832  */
833 #define BT_GAP_PER_ADV_INTERVAL_TO_MS(interval) ((interval) * 5 / 4)
834 
835 /** Constant Tone Extension (CTE) types */
836 enum {
837 	/** Angle of Arrival */
838 	BT_GAP_CTE_AOA = 0x00,
839 	/** Angle of Departure with 1 us slots */
840 	BT_GAP_CTE_AOD_1US = 0x01,
841 	/** Angle of Departure with 2 us slots */
842 	BT_GAP_CTE_AOD_2US = 0x02,
843 	/** No extensions */
844 	BT_GAP_CTE_NONE = 0xFF,
845 };
846 
847 /** @brief Peripheral sleep clock accuracy (SCA) in ppm (parts per million) */
848 enum {
849 	BT_GAP_SCA_UNKNOWN = 0,   /**< Unknown */
850 	BT_GAP_SCA_251_500 = 0,   /**< 251 ppm to 500 ppm */
851 	BT_GAP_SCA_151_250 = 1,   /**< 151 ppm to 250 ppm */
852 	BT_GAP_SCA_101_150 = 2,   /**< 101 ppm to 150 ppm */
853 	BT_GAP_SCA_76_100 = 3,    /**< 76 ppm to 100 ppm */
854 	BT_GAP_SCA_51_75 = 4,     /**< 51 ppm to 75 ppm */
855 	BT_GAP_SCA_31_50 = 5,     /**< 31 ppm to 50 ppm */
856 	BT_GAP_SCA_21_30 = 6,     /**< 21 ppm to 30 ppm */
857 	BT_GAP_SCA_0_20 = 7,      /**< 0 ppm to 20 ppm */
858 };
859 
860 /**
861  * @brief Encode 40 least significant bits of 64-bit LE Supported Features into array values
862  *        in little-endian format.
863  *
864  * Helper macro to encode 40 least significant bits of 64-bit LE Supported Features value into
865  * advertising data. The number of bits that are encoded is a number of LE Supported Features
866  * defined by BT 5.3 Core specification.
867  *
868  * Example of how to encode the `0x000000DFF00DF00D` into advertising data.
869  *
870  * @code
871  * BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_40_ENCODE(0x000000DFF00DF00D))
872  * @endcode
873  *
874  * @param w64 LE Supported Features value (64-bits)
875  *
876  * @return The comma separated values for LE Supported Features value that
877  *         may be used directly as an argument for @ref BT_DATA_BYTES.
878  */
879 #define BT_LE_SUPP_FEAT_40_ENCODE(w64) BT_BYTES_LIST_LE40(w64)
880 
881 /** @brief Encode 4 least significant bytes of 64-bit LE Supported Features into
882  *         4 bytes long array of values in little-endian format.
883  *
884  *  Helper macro to encode 64-bit LE Supported Features value into advertising
885  *  data. The macro encodes 4 least significant bytes into advertising data.
886  *  Other 4 bytes are not encoded.
887  *
888  *  Example of how to encode the `0x000000DFF00DF00D` into advertising data.
889  *
890  *  @code
891  *  BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_32_ENCODE(0x000000DFF00DF00D))
892  *  @endcode
893  *
894  * @param w64 LE Supported Features value (64-bits)
895  *
896  * @return The comma separated values for LE Supported Features value that
897  *         may be used directly as an argument for @ref BT_DATA_BYTES.
898  */
899 #define BT_LE_SUPP_FEAT_32_ENCODE(w64) BT_BYTES_LIST_LE32(w64)
900 
901 /**
902  * @brief Encode 3 least significant bytes of 64-bit LE Supported Features into
903  *        3 bytes long array of values in little-endian format.
904  *
905  * Helper macro to encode 64-bit LE Supported Features value into advertising
906  * data. The macro encodes 3 least significant bytes into advertising data.
907  * Other 5 bytes are not encoded.
908  *
909  * Example of how to encode the `0x000000DFF00DF00D` into advertising data.
910  *
911  * @code
912  * BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_24_ENCODE(0x000000DFF00DF00D))
913  * @endcode
914  *
915  * @param w64 LE Supported Features value (64-bits)
916  *
917  * @return The comma separated values for LE Supported Features value that
918  *         may be used directly as an argument for @ref BT_DATA_BYTES.
919  */
920 #define BT_LE_SUPP_FEAT_24_ENCODE(w64) BT_BYTES_LIST_LE24(w64)
921 
922 /**
923  * @brief Encode 2 least significant bytes of 64-bit LE Supported Features into
924  *        2 bytes long array of values in little-endian format.
925  *
926  * Helper macro to encode 64-bit LE Supported Features value into advertising
927  * data. The macro encodes 3 least significant bytes into advertising data.
928  * Other 6 bytes are not encoded.
929  *
930  * Example of how to encode the `0x000000DFF00DF00D` into advertising data.
931  *
932  * @code
933  * BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_16_ENCODE(0x000000DFF00DF00D))
934  * @endcode
935  *
936  * @param w64 LE Supported Features value (64-bits)
937  *
938  * @return The comma separated values for LE Supported Features value that
939  *         may be used directly as an argument for @ref BT_DATA_BYTES.
940  */
941 #define BT_LE_SUPP_FEAT_16_ENCODE(w64) BT_BYTES_LIST_LE16(w64)
942 
943 /**
944  * @brief Encode the least significant byte of 64-bit LE Supported Features into
945  *        single byte long array.
946  *
947  * Helper macro to encode 64-bit LE Supported Features value into advertising
948  * data. The macro encodes the least significant byte into advertising data.
949  * Other 7 bytes are not encoded.
950  *
951  * Example of how to encode the `0x000000DFF00DF00D` into advertising data.
952  *
953  * @code
954  * BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_8_ENCODE(0x000000DFF00DF00D))
955  * @endcode
956  *
957  * @param w64 LE Supported Features value (64-bits)
958  *
959  * @return The value of least significant byte of LE Supported Features value
960  *         that may be used directly as an argument for @ref BT_DATA_BYTES.
961  */
962 #define BT_LE_SUPP_FEAT_8_ENCODE(w64) \
963 	(((w64) >> 0) & 0xFF)
964 
965 /**
966  * @brief Validate whether LE Supported Features value does not use bits that are reserved for
967  *        future use.
968  *
969  * Helper macro to check if @p w64 has zeros as bits 40-63. The macro is compliant with BT 5.3
970  * Core Specification where bits 0-40 has assigned values. In case of invalid value, build time
971  * error is reported.
972  */
973 #define BT_LE_SUPP_FEAT_VALIDATE(w64) \
974 	BUILD_ASSERT(!((w64) & (~BIT64_MASK(40))), \
975 		     "RFU bit in LE Supported Features are not zeros.")
976 
977 /**
978  * @}
979  */
980 
981 #ifdef __cplusplus
982 }
983 #endif
984 
985 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_GAP_H_ */
986