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