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