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 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 /** 19 * @brief Bluetooth Generic Access Profile defines and Assigned Numbers. 20 * @defgroup bt_gap_defines Defines and Assigned Numbers 21 * @ingroup bluetooth 22 * @{ 23 */ 24 25 /** Company Identifiers (see Bluetooth Assigned Numbers) */ 26 #define BT_COMP_ID_LF 0x05f1 /* The Linux Foundation */ 27 28 /** EIR/AD data type definitions */ 29 #define BT_DATA_FLAGS 0x01 /* AD flags */ 30 #define BT_DATA_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 31 #define BT_DATA_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ 32 #define BT_DATA_UUID32_SOME 0x04 /* 32-bit UUID, more available */ 33 #define BT_DATA_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ 34 #define BT_DATA_UUID128_SOME 0x06 /* 128-bit UUID, more available */ 35 #define BT_DATA_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ 36 #define BT_DATA_NAME_SHORTENED 0x08 /* Shortened name */ 37 #define BT_DATA_NAME_COMPLETE 0x09 /* Complete name */ 38 #define BT_DATA_TX_POWER 0x0a /* Tx Power */ 39 #define BT_DATA_SM_TK_VALUE 0x10 /* Security Manager TK Value */ 40 #define BT_DATA_SM_OOB_FLAGS 0x11 /* Security Manager OOB Flags */ 41 #define BT_DATA_SOLICIT16 0x14 /* Solicit UUIDs, 16-bit */ 42 #define BT_DATA_SOLICIT128 0x15 /* Solicit UUIDs, 128-bit */ 43 #define BT_DATA_SVC_DATA16 0x16 /* Service data, 16-bit UUID */ 44 #define BT_DATA_GAP_APPEARANCE 0x19 /* GAP appearance */ 45 #define BT_DATA_LE_BT_DEVICE_ADDRESS 0x1b /* LE Bluetooth Device Address */ 46 #define BT_DATA_LE_ROLE 0x1c /* LE Role */ 47 #define BT_DATA_SOLICIT32 0x1f /* Solicit UUIDs, 32-bit */ 48 #define BT_DATA_SVC_DATA32 0x20 /* Service data, 32-bit UUID */ 49 #define BT_DATA_SVC_DATA128 0x21 /* Service data, 128-bit UUID */ 50 #define BT_DATA_LE_SC_CONFIRM_VALUE 0x22 /* LE SC Confirmation Value */ 51 #define BT_DATA_LE_SC_RANDOM_VALUE 0x23 /* LE SC Random Value */ 52 #define BT_DATA_URI 0x24 /* URI */ 53 #define BT_DATA_CHANNEL_MAP_UPDATE_IND 0x28 /* Channel Map Update Indication */ 54 #define BT_DATA_MESH_PROV 0x29 /* Mesh Provisioning PDU */ 55 #define BT_DATA_MESH_MESSAGE 0x2a /* Mesh Networking PDU */ 56 #define BT_DATA_MESH_BEACON 0x2b /* Mesh Beacon */ 57 #define BT_DATA_BIG_INFO 0x2c /* BIGInfo */ 58 #define BT_DATA_BROADCAST_CODE 0x2d /* Broadcast Code */ 59 60 #define BT_DATA_MANUFACTURER_DATA 0xff /* Manufacturer Specific Data */ 61 62 #define BT_LE_AD_LIMITED 0x01 /* Limited Discoverable */ 63 #define BT_LE_AD_GENERAL 0x02 /* General Discoverable */ 64 #define BT_LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */ 65 66 /* Defined GAP timers */ 67 #define BT_GAP_SCAN_FAST_INTERVAL 0x0060 /* 60 ms */ 68 #define BT_GAP_SCAN_FAST_WINDOW 0x0030 /* 30 ms */ 69 #define BT_GAP_SCAN_SLOW_INTERVAL_1 0x0800 /* 1.28 s */ 70 #define BT_GAP_SCAN_SLOW_WINDOW_1 0x0012 /* 11.25 ms */ 71 #define BT_GAP_SCAN_SLOW_INTERVAL_2 0x1000 /* 2.56 s */ 72 #define BT_GAP_SCAN_SLOW_WINDOW_2 0x0012 /* 11.25 ms */ 73 #define BT_GAP_ADV_FAST_INT_MIN_1 0x0030 /* 30 ms */ 74 #define BT_GAP_ADV_FAST_INT_MAX_1 0x0060 /* 60 ms */ 75 #define BT_GAP_ADV_FAST_INT_MIN_2 0x00a0 /* 100 ms */ 76 #define BT_GAP_ADV_FAST_INT_MAX_2 0x00f0 /* 150 ms */ 77 #define BT_GAP_ADV_SLOW_INT_MIN 0x0640 /* 1 s */ 78 #define BT_GAP_ADV_SLOW_INT_MAX 0x0780 /* 1.2 s */ 79 #define BT_GAP_PER_ADV_FAST_INT_MIN_1 0x0018 /* 30 ms */ 80 #define BT_GAP_PER_ADV_FAST_INT_MAX_1 0x0030 /* 60 ms */ 81 #define BT_GAP_PER_ADV_FAST_INT_MIN_2 0x0050 /* 100 ms */ 82 #define BT_GAP_PER_ADV_FAST_INT_MAX_2 0x0078 /* 150 ms */ 83 #define BT_GAP_PER_ADV_SLOW_INT_MIN 0x0320 /* 1 s */ 84 #define BT_GAP_PER_ADV_SLOW_INT_MAX 0x03C0 /* 1.2 s */ 85 #define BT_GAP_INIT_CONN_INT_MIN 0x0018 /* 30 ms */ 86 #define BT_GAP_INIT_CONN_INT_MAX 0x0028 /* 50 ms */ 87 88 /** LE PHY types */ 89 enum { 90 /** Convenience macro for when no PHY is set. */ 91 BT_GAP_LE_PHY_NONE = 0, 92 /** LE 1M PHY */ 93 BT_GAP_LE_PHY_1M = BIT(0), 94 /** LE 2M PHY */ 95 BT_GAP_LE_PHY_2M = BIT(1), 96 /** LE Coded PHY */ 97 BT_GAP_LE_PHY_CODED = BIT(2), 98 }; 99 100 /** Advertising PDU types */ 101 enum { 102 /** Scannable and connectable advertising. */ 103 BT_GAP_ADV_TYPE_ADV_IND = 0x00, 104 /** Directed connectable advertising. */ 105 BT_GAP_ADV_TYPE_ADV_DIRECT_IND = 0x01, 106 /** Non-connectable and scannable advertising. */ 107 BT_GAP_ADV_TYPE_ADV_SCAN_IND = 0x02, 108 /** Non-connectable and non-scannable advertising. */ 109 BT_GAP_ADV_TYPE_ADV_NONCONN_IND = 0x03, 110 /** Additional advertising data requested by an active scanner. */ 111 BT_GAP_ADV_TYPE_SCAN_RSP = 0x04, 112 /** Extended advertising, see advertising properties. */ 113 BT_GAP_ADV_TYPE_EXT_ADV = 0x05, 114 }; 115 116 /** Advertising PDU properties */ 117 enum { 118 /** Connectable advertising. */ 119 BT_GAP_ADV_PROP_CONNECTABLE = BIT(0), 120 /** Scannable advertising. */ 121 BT_GAP_ADV_PROP_SCANNABLE = BIT(1), 122 /** Directed advertising. */ 123 BT_GAP_ADV_PROP_DIRECTED = BIT(2), 124 /** Additional advertising data requested by an active scanner. */ 125 BT_GAP_ADV_PROP_SCAN_RESPONSE = BIT(3), 126 /** Extended advertising. */ 127 BT_GAP_ADV_PROP_EXT_ADV = BIT(4), 128 }; 129 130 /** Maximum advertising data length. */ 131 #define BT_GAP_ADV_MAX_ADV_DATA_LEN 31 132 /** Maximum extended advertising data length. 133 * 134 * @note The maximum advertising data length that can be sent by an extended 135 * advertiser is defined by the controller. 136 */ 137 #define BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN 1650 138 139 #define BT_GAP_TX_POWER_INVALID 0x7f 140 #define BT_GAP_RSSI_INVALID 0x7f 141 #define BT_GAP_SID_INVALID 0xff 142 #define BT_GAP_NO_TIMEOUT 0x0000 143 144 /* The maximum allowed high duty cycle directed advertising timeout, 1.28 145 * seconds in 10 ms unit. 146 */ 147 #define BT_GAP_ADV_HIGH_DUTY_CYCLE_MAX_TIMEOUT 128 148 149 #define BT_GAP_DATA_LEN_DEFAULT 0x001b /* 27 bytes */ 150 #define BT_GAP_DATA_LEN_MAX 0x00fb /* 251 bytes */ 151 152 #define BT_GAP_DATA_TIME_DEFAULT 0x0148 /* 328 us */ 153 #define BT_GAP_DATA_TIME_MAX 0x4290 /* 17040 us */ 154 155 #define BT_GAP_SID_MAX 0x0F 156 #define BT_GAP_PER_ADV_MAX_SKIP 0x01F3 157 #define BT_GAP_PER_ADV_MIN_TIMEOUT 0x000A 158 #define BT_GAP_PER_ADV_MAX_TIMEOUT 0x4000 159 /** Minimum Periodic Advertising Interval (N * 1.25 ms) */ 160 #define BT_GAP_PER_ADV_MIN_INTERVAL 0x0006 161 /** Maximum Periodic Advertising Interval (N * 1.25 ms) */ 162 #define BT_GAP_PER_ADV_MAX_INTERVAL 0xFFFF 163 164 165 /** Constant Tone Extension (CTE) types */ 166 enum { 167 /** Angle of Arrival */ 168 BT_GAP_CTE_AOA = 0x00, 169 /** Angle of Departure with 1 us slots */ 170 BT_GAP_CTE_AOD_1US = 0x01, 171 /** Angle of Departure with 2 us slots */ 172 BT_GAP_CTE_AOD_2US = 0x02, 173 /** No extensions */ 174 BT_GAP_CTE_NONE = 0xFF, 175 }; 176 177 178 /** @brief Peripheral sleep clock accuracy (SCA) in ppm (parts per million) */ 179 enum { 180 BT_GAP_SCA_UNKNOWN = 0, 181 BT_GAP_SCA_251_500 = 0, 182 BT_GAP_SCA_151_250 = 1, 183 BT_GAP_SCA_101_150 = 2, 184 BT_GAP_SCA_76_100 = 3, 185 BT_GAP_SCA_51_75 = 4, 186 BT_GAP_SCA_31_50 = 5, 187 BT_GAP_SCA_21_30 = 6, 188 BT_GAP_SCA_0_20 = 7, 189 }; 190 191 /** 192 * @} 193 */ 194 195 #ifdef __cplusplus 196 } 197 #endif 198 199 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_GAP_H_ */ 200