KIM HyoengJun
/
mbed_fota_fan_control
Fan Control Demo
Fork of mbed_fota by
dialog_fota/gapm_task.h@4:60be78a172c2, 2015-06-24 (annotated)
- Committer:
- dudnwjs
- Date:
- Wed Jun 24 08:50:07 2015 +0000
- Revision:
- 4:60be78a172c2
- Parent:
- 3:1e70387e1337
- Child:
- 5:e11b23f9aacc
Add advertising feature;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 3:1e70387e1337 | 1 | #ifndef GAPM_TASK_H |
dudnwjs | 3:1e70387e1337 | 2 | #define GAPM_TASK_H |
dudnwjs | 3:1e70387e1337 | 3 | |
dudnwjs | 4:60be78a172c2 | 4 | #include "dialog_fota_config.h" |
dudnwjs | 4:60be78a172c2 | 5 | |
dudnwjs | 3:1e70387e1337 | 6 | namespace sevencore_fota{ |
dudnwjs | 3:1e70387e1337 | 7 | |
dudnwjs | 4:60be78a172c2 | 8 | /// Advertising or scanning report information event |
dudnwjs | 4:60be78a172c2 | 9 | struct gapm_adv_report_ind |
dudnwjs | 4:60be78a172c2 | 10 | { |
dudnwjs | 4:60be78a172c2 | 11 | /// Advertising report structure |
dudnwjs | 4:60be78a172c2 | 12 | struct adv_report report; |
dudnwjs | 4:60be78a172c2 | 13 | }; |
dudnwjs | 4:60be78a172c2 | 14 | |
dudnwjs | 3:1e70387e1337 | 15 | /// Reset link layer and the host command |
dudnwjs | 3:1e70387e1337 | 16 | struct gapm_reset_cmd |
dudnwjs | 3:1e70387e1337 | 17 | { |
dudnwjs | 3:1e70387e1337 | 18 | /// GAPM requested operation: |
dudnwjs | 3:1e70387e1337 | 19 | /// - GAPM_RESET: Reset BLE subsystem: LL and HL. |
dudnwjs | 3:1e70387e1337 | 20 | uint8_t operation; |
dudnwjs | 3:1e70387e1337 | 21 | }; |
dudnwjs | 4:60be78a172c2 | 22 | /// Command complete event data structure |
dudnwjs | 4:60be78a172c2 | 23 | struct gapm_cmp_evt |
dudnwjs | 4:60be78a172c2 | 24 | { |
dudnwjs | 4:60be78a172c2 | 25 | /// GAP requested operation |
dudnwjs | 4:60be78a172c2 | 26 | uint8_t operation; |
dudnwjs | 4:60be78a172c2 | 27 | /// Status of the request |
dudnwjs | 4:60be78a172c2 | 28 | uint8_t status; |
dudnwjs | 4:60be78a172c2 | 29 | }; |
dudnwjs | 4:60be78a172c2 | 30 | |
dudnwjs | 4:60be78a172c2 | 31 | /// Air operation default parameters |
dudnwjs | 4:60be78a172c2 | 32 | struct gapm_air_operation |
dudnwjs | 4:60be78a172c2 | 33 | { |
dudnwjs | 4:60be78a172c2 | 34 | /// Operation code. |
dudnwjs | 4:60be78a172c2 | 35 | uint8_t code; |
dudnwjs | 4:60be78a172c2 | 36 | |
dudnwjs | 4:60be78a172c2 | 37 | |
dudnwjs | 4:60be78a172c2 | 38 | /** Own BD address source of the device: |
dudnwjs | 4:60be78a172c2 | 39 | * - GAPM_PUBLIC_ADDR: Public Address |
dudnwjs | 4:60be78a172c2 | 40 | * - GAPM_PROVIDED_RND_ADDR: Provided random address |
dudnwjs | 4:60be78a172c2 | 41 | * - GAPM_GEN_STATIC_RND_ADDR: Generated static random address |
dudnwjs | 4:60be78a172c2 | 42 | * - GAPM_GEN_RSLV_ADDR: Generated resolvable private random address |
dudnwjs | 4:60be78a172c2 | 43 | * - GAPM_GEN_NON_RSLV_ADDR: Generated non-resolvable private random address |
dudnwjs | 4:60be78a172c2 | 44 | * - GAPM_PROVIDED_RECON_ADDR: Provided Reconnection address (only for GAPM_ADV_DIRECT) |
dudnwjs | 4:60be78a172c2 | 45 | */ |
dudnwjs | 4:60be78a172c2 | 46 | uint8_t addr_src; |
dudnwjs | 4:60be78a172c2 | 47 | |
dudnwjs | 4:60be78a172c2 | 48 | /// Dummy data use to retrieve internal operation state (should be set to 0). |
dudnwjs | 4:60be78a172c2 | 49 | uint16_t state; |
dudnwjs | 4:60be78a172c2 | 50 | |
dudnwjs | 4:60be78a172c2 | 51 | /// Duration of resolvable address before regenerate it. |
dudnwjs | 4:60be78a172c2 | 52 | uint16_t renew_dur; |
dudnwjs | 4:60be78a172c2 | 53 | |
dudnwjs | 4:60be78a172c2 | 54 | /// Provided own static private random address (addr_src = 1 or 5) |
dudnwjs | 4:60be78a172c2 | 55 | struct bd_addr addr; |
dudnwjs | 4:60be78a172c2 | 56 | }; |
dudnwjs | 4:60be78a172c2 | 57 | |
dudnwjs | 4:60be78a172c2 | 58 | /// Advertising data that contains information set by host. |
dudnwjs | 4:60be78a172c2 | 59 | struct gapm_adv_host |
dudnwjs | 4:60be78a172c2 | 60 | { |
dudnwjs | 4:60be78a172c2 | 61 | /// Advertising mode : |
dudnwjs | 4:60be78a172c2 | 62 | /// - GAP_NON_DISCOVERABLE: Non discoverable mode |
dudnwjs | 4:60be78a172c2 | 63 | /// - GAP_GEN_DISCOVERABLE: General discoverable mode |
dudnwjs | 4:60be78a172c2 | 64 | /// - GAP_LIM_DISCOVERABLE: Limited discoverable mode |
dudnwjs | 4:60be78a172c2 | 65 | /// - GAP_BROADCASTER_MODE: Broadcaster mode |
dudnwjs | 4:60be78a172c2 | 66 | uint8_t mode; |
dudnwjs | 4:60be78a172c2 | 67 | |
dudnwjs | 4:60be78a172c2 | 68 | /// Advertising filter policy: |
dudnwjs | 4:60be78a172c2 | 69 | /// - ADV_ALLOW_SCAN_ANY_CON_ANY: Allow both scan and connection requests from anyone |
dudnwjs | 4:60be78a172c2 | 70 | /// - ADV_ALLOW_SCAN_WLST_CON_ANY: Allow both scan req from White List devices only and |
dudnwjs | 4:60be78a172c2 | 71 | /// connection req from anyone |
dudnwjs | 4:60be78a172c2 | 72 | /// - ADV_ALLOW_SCAN_ANY_CON_WLST: Allow both scan req from anyone and connection req |
dudnwjs | 4:60be78a172c2 | 73 | /// from White List devices only |
dudnwjs | 4:60be78a172c2 | 74 | /// - ADV_ALLOW_SCAN_WLST_CON_WLST: Allow scan and connection requests from White List |
dudnwjs | 4:60be78a172c2 | 75 | /// devices only |
dudnwjs | 4:60be78a172c2 | 76 | uint8_t adv_filt_policy; |
dudnwjs | 4:60be78a172c2 | 77 | |
dudnwjs | 4:60be78a172c2 | 78 | /// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set |
dudnwjs | 4:60be78a172c2 | 79 | /// Advertising AD type flags, shall not be set in advertising data |
dudnwjs | 4:60be78a172c2 | 80 | uint8_t adv_data_len; |
dudnwjs | 4:60be78a172c2 | 81 | /// Advertising data |
dudnwjs | 4:60be78a172c2 | 82 | uint8_t adv_data[ADV_DATA_LEN-3]; |
dudnwjs | 4:60be78a172c2 | 83 | /// Scan response data length- maximum 31 bytes |
dudnwjs | 4:60be78a172c2 | 84 | uint8_t scan_rsp_data_len; |
dudnwjs | 4:60be78a172c2 | 85 | /// Scan response data |
dudnwjs | 4:60be78a172c2 | 86 | uint8_t scan_rsp_data[SCAN_RSP_DATA_LEN]; |
dudnwjs | 4:60be78a172c2 | 87 | }; |
dudnwjs | 4:60be78a172c2 | 88 | |
dudnwjs | 4:60be78a172c2 | 89 | |
dudnwjs | 4:60be78a172c2 | 90 | //////////////GAP |
dudnwjs | 4:60be78a172c2 | 91 | #define KEY_LEN 0x10 |
dudnwjs | 4:60be78a172c2 | 92 | /// Generic Security key structure |
dudnwjs | 4:60be78a172c2 | 93 | struct gap_sec_key |
dudnwjs | 4:60be78a172c2 | 94 | { |
dudnwjs | 4:60be78a172c2 | 95 | /// Key value MSB -> LSB |
dudnwjs | 4:60be78a172c2 | 96 | uint8_t key[KEY_LEN]; |
dudnwjs | 4:60be78a172c2 | 97 | }; |
dudnwjs | 4:60be78a172c2 | 98 | |
dudnwjs | 4:60be78a172c2 | 99 | /// Address information about a device address |
dudnwjs | 4:60be78a172c2 | 100 | struct gap_bdaddr |
dudnwjs | 4:60be78a172c2 | 101 | { |
dudnwjs | 4:60be78a172c2 | 102 | /// BD Address of device |
dudnwjs | 4:60be78a172c2 | 103 | struct bd_addr addr; |
dudnwjs | 4:60be78a172c2 | 104 | /// Address type of the device 0=public/1=private random |
dudnwjs | 4:60be78a172c2 | 105 | uint8_t addr_type; |
dudnwjs | 4:60be78a172c2 | 106 | }; |
dudnwjs | 4:60be78a172c2 | 107 | |
dudnwjs | 4:60be78a172c2 | 108 | /// Advertising mode |
dudnwjs | 4:60be78a172c2 | 109 | enum gap_adv_mode |
dudnwjs | 4:60be78a172c2 | 110 | { |
dudnwjs | 4:60be78a172c2 | 111 | /// Mode in non-discoverable |
dudnwjs | 4:60be78a172c2 | 112 | GAP_NON_DISCOVERABLE, |
dudnwjs | 4:60be78a172c2 | 113 | /// Mode in general discoverable |
dudnwjs | 4:60be78a172c2 | 114 | GAP_GEN_DISCOVERABLE, |
dudnwjs | 4:60be78a172c2 | 115 | /// Mode in limited discoverable |
dudnwjs | 4:60be78a172c2 | 116 | GAP_LIM_DISCOVERABLE, |
dudnwjs | 4:60be78a172c2 | 117 | /// Broadcaster mode which is a non discoverable and non connectable mode. |
dudnwjs | 4:60be78a172c2 | 118 | GAP_BROADCASTER_MODE, |
dudnwjs | 4:60be78a172c2 | 119 | }; |
dudnwjs | 4:60be78a172c2 | 120 | /****************** GAP Role **********************/ |
dudnwjs | 4:60be78a172c2 | 121 | enum gap_role |
dudnwjs | 4:60be78a172c2 | 122 | { |
dudnwjs | 4:60be78a172c2 | 123 | /// No role set yet |
dudnwjs | 4:60be78a172c2 | 124 | GAP_NO_ROLE = 0x00, |
dudnwjs | 4:60be78a172c2 | 125 | |
dudnwjs | 4:60be78a172c2 | 126 | /// Observer role |
dudnwjs | 4:60be78a172c2 | 127 | GAP_OBSERVER_SCA = 0x01, |
dudnwjs | 4:60be78a172c2 | 128 | |
dudnwjs | 4:60be78a172c2 | 129 | /// Broadcaster role |
dudnwjs | 4:60be78a172c2 | 130 | GAP_BROADCASTER_ADV = 0x02, |
dudnwjs | 4:60be78a172c2 | 131 | |
dudnwjs | 4:60be78a172c2 | 132 | /// Master/Central role |
dudnwjs | 4:60be78a172c2 | 133 | GAP_CENTRAL_MST = (0x04 | GAP_OBSERVER_SCA), |
dudnwjs | 4:60be78a172c2 | 134 | |
dudnwjs | 4:60be78a172c2 | 135 | /// Peripheral/Slave role |
dudnwjs | 4:60be78a172c2 | 136 | GAP_PERIPHERAL_SLV = (0x08 | GAP_BROADCASTER_ADV), |
dudnwjs | 4:60be78a172c2 | 137 | }; |
dudnwjs | 4:60be78a172c2 | 138 | |
dudnwjs | 4:60be78a172c2 | 139 | //////////////GAP |
dudnwjs | 4:60be78a172c2 | 140 | |
dudnwjs | 4:60be78a172c2 | 141 | /// Set advertising mode Command |
dudnwjs | 4:60be78a172c2 | 142 | struct gapm_start_advertise_cmd |
dudnwjs | 4:60be78a172c2 | 143 | { |
dudnwjs | 4:60be78a172c2 | 144 | /// GAPM requested operation: |
dudnwjs | 4:60be78a172c2 | 145 | /// - GAPM_ADV_NON_CONN: Start non connectable advertising |
dudnwjs | 4:60be78a172c2 | 146 | /// - GAPM_ADV_UNDIRECT: Start undirected connectable advertising |
dudnwjs | 4:60be78a172c2 | 147 | /// - GAPM_ADV_DIRECT: Start directed connectable advertising |
dudnwjs | 4:60be78a172c2 | 148 | struct gapm_air_operation op; |
dudnwjs | 4:60be78a172c2 | 149 | |
dudnwjs | 4:60be78a172c2 | 150 | /// Minimum interval for advertising |
dudnwjs | 4:60be78a172c2 | 151 | uint16_t intv_min; |
dudnwjs | 4:60be78a172c2 | 152 | /// Maximum interval for advertising |
dudnwjs | 4:60be78a172c2 | 153 | uint16_t intv_max; |
dudnwjs | 4:60be78a172c2 | 154 | |
dudnwjs | 4:60be78a172c2 | 155 | ///Advertising channel map |
dudnwjs | 4:60be78a172c2 | 156 | uint8_t channel_map; |
dudnwjs | 4:60be78a172c2 | 157 | |
dudnwjs | 4:60be78a172c2 | 158 | /// Advertising information |
dudnwjs | 4:60be78a172c2 | 159 | union gapm_adv_info |
dudnwjs | 4:60be78a172c2 | 160 | { |
dudnwjs | 4:60be78a172c2 | 161 | /// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT) |
dudnwjs | 4:60be78a172c2 | 162 | struct gapm_adv_host host; |
dudnwjs | 4:60be78a172c2 | 163 | /// Direct address information (GAPM_ADV_DIRECT) |
dudnwjs | 4:60be78a172c2 | 164 | /// (used only if reconnection address isn't set or privacy disabled) |
dudnwjs | 4:60be78a172c2 | 165 | struct gap_bdaddr direct; |
dudnwjs | 4:60be78a172c2 | 166 | } info; |
dudnwjs | 4:60be78a172c2 | 167 | }; |
dudnwjs | 4:60be78a172c2 | 168 | |
dudnwjs | 4:60be78a172c2 | 169 | |
dudnwjs | 4:60be78a172c2 | 170 | /// Set device configuration command |
dudnwjs | 4:60be78a172c2 | 171 | struct gapm_set_dev_config_cmd |
dudnwjs | 4:60be78a172c2 | 172 | { |
dudnwjs | 4:60be78a172c2 | 173 | /// GAPM requested operation: |
dudnwjs | 4:60be78a172c2 | 174 | /// - GAPM_SET_DEV_CONFIG: Set device configuration |
dudnwjs | 4:60be78a172c2 | 175 | uint8_t operation; |
dudnwjs | 4:60be78a172c2 | 176 | /// Device Role: Central, Peripheral, Observer or Broadcaster |
dudnwjs | 4:60be78a172c2 | 177 | uint8_t role; |
dudnwjs | 4:60be78a172c2 | 178 | /// Device IRK used for resolvable random BD address generation (LSB first) |
dudnwjs | 4:60be78a172c2 | 179 | struct gap_sec_key irk; |
dudnwjs | 4:60be78a172c2 | 180 | |
dudnwjs | 4:60be78a172c2 | 181 | /// Device Appearance (0x0000 - Unknown appearance) |
dudnwjs | 4:60be78a172c2 | 182 | uint16_t appearance; |
dudnwjs | 4:60be78a172c2 | 183 | /// Device Appearance write permission requirements for peer device (@see gapm_write_att_perm) |
dudnwjs | 4:60be78a172c2 | 184 | uint8_t appearance_write_perm; |
dudnwjs | 4:60be78a172c2 | 185 | /// Device Name write permission requirements for peer device (@see gapm_write_att_perm) |
dudnwjs | 4:60be78a172c2 | 186 | uint8_t name_write_perm; |
dudnwjs | 4:60be78a172c2 | 187 | |
dudnwjs | 4:60be78a172c2 | 188 | /// Maximal MTU |
dudnwjs | 4:60be78a172c2 | 189 | uint16_t max_mtu; |
dudnwjs | 4:60be78a172c2 | 190 | |
dudnwjs | 4:60be78a172c2 | 191 | /// Peripheral only: ***************************************************************** |
dudnwjs | 4:60be78a172c2 | 192 | /// Slave preferred Minimum of connection interval |
dudnwjs | 4:60be78a172c2 | 193 | uint16_t con_intv_min; |
dudnwjs | 4:60be78a172c2 | 194 | /// Slave preferred Maximum of connection interval |
dudnwjs | 4:60be78a172c2 | 195 | uint16_t con_intv_max; |
dudnwjs | 4:60be78a172c2 | 196 | /// Slave preferred Connection latency |
dudnwjs | 4:60be78a172c2 | 197 | uint16_t con_latency; |
dudnwjs | 4:60be78a172c2 | 198 | /// Slave preferred Link supervision timeout |
dudnwjs | 4:60be78a172c2 | 199 | uint16_t superv_to; |
dudnwjs | 4:60be78a172c2 | 200 | |
dudnwjs | 4:60be78a172c2 | 201 | /// Privacy settings bit field (0b1 = enabled, 0b0 = disabled) |
dudnwjs | 4:60be78a172c2 | 202 | /// - [bit 0]: Privacy Support |
dudnwjs | 4:60be78a172c2 | 203 | /// - [bit 1]: Multiple Bond Support (Peripheral only); If enabled, privacy flag is |
dudnwjs | 4:60be78a172c2 | 204 | /// read only. |
dudnwjs | 4:60be78a172c2 | 205 | /// - [bit 2]: Reconnection address visible. |
dudnwjs | 4:60be78a172c2 | 206 | uint8_t flags; |
dudnwjs | 4:60be78a172c2 | 207 | }; |
dudnwjs | 4:60be78a172c2 | 208 | |
dudnwjs | 3:1e70387e1337 | 209 | |
dudnwjs | 3:1e70387e1337 | 210 | |
dudnwjs | 3:1e70387e1337 | 211 | /// GAP Manager Message Interface |
dudnwjs | 3:1e70387e1337 | 212 | enum gapm_msg_id |
dudnwjs | 3:1e70387e1337 | 213 | { |
dudnwjs | 3:1e70387e1337 | 214 | /* Default event */ |
dudnwjs | 3:1e70387e1337 | 215 | /// Command Complete event |
dudnwjs | 3:1e70387e1337 | 216 | GAPM_CMP_EVT = 13312, |
dudnwjs | 3:1e70387e1337 | 217 | /// Event triggered to inform that lower layers are ready |
dudnwjs | 3:1e70387e1337 | 218 | GAPM_DEVICE_READY_IND, |
dudnwjs | 3:1e70387e1337 | 219 | |
dudnwjs | 3:1e70387e1337 | 220 | /* Default commands */ |
dudnwjs | 3:1e70387e1337 | 221 | /// Reset link layer and the host command |
dudnwjs | 3:1e70387e1337 | 222 | GAPM_RESET_CMD, |
dudnwjs | 3:1e70387e1337 | 223 | /// Cancel ongoing operation |
dudnwjs | 3:1e70387e1337 | 224 | GAPM_CANCEL_CMD, |
dudnwjs | 3:1e70387e1337 | 225 | |
dudnwjs | 3:1e70387e1337 | 226 | /* Device Configuration */ |
dudnwjs | 3:1e70387e1337 | 227 | /// Set device configuration command |
dudnwjs | 3:1e70387e1337 | 228 | GAPM_SET_DEV_CONFIG_CMD, |
dudnwjs | 3:1e70387e1337 | 229 | /// Set device name command |
dudnwjs | 3:1e70387e1337 | 230 | GAPM_SET_DEV_NAME_CMD, |
dudnwjs | 3:1e70387e1337 | 231 | /// Set device channel map |
dudnwjs | 3:1e70387e1337 | 232 | GAPM_SET_CHANNEL_MAP_CMD, |
dudnwjs | 3:1e70387e1337 | 233 | |
dudnwjs | 3:1e70387e1337 | 234 | /* Local device information */ |
dudnwjs | 3:1e70387e1337 | 235 | /// Get local device info command |
dudnwjs | 3:1e70387e1337 | 236 | GAPM_GET_DEV_INFO_CMD, |
dudnwjs | 3:1e70387e1337 | 237 | /// Local device name indication event |
dudnwjs | 3:1e70387e1337 | 238 | GAPM_DEV_NAME_IND, |
dudnwjs | 3:1e70387e1337 | 239 | /// Local device appearance indication event |
dudnwjs | 3:1e70387e1337 | 240 | GAPM_APPEARANCE_IND, |
dudnwjs | 3:1e70387e1337 | 241 | /// Local device version indication event |
dudnwjs | 3:1e70387e1337 | 242 | GAPM_DEV_VERSION_IND, |
dudnwjs | 3:1e70387e1337 | 243 | /// Local device BD Address indication event |
dudnwjs | 3:1e70387e1337 | 244 | GAPM_DEV_BDADDR_IND, |
dudnwjs | 3:1e70387e1337 | 245 | |
dudnwjs | 3:1e70387e1337 | 246 | /* White List */ |
dudnwjs | 3:1e70387e1337 | 247 | /// White List Management Command |
dudnwjs | 3:1e70387e1337 | 248 | GAPM_WHITE_LIST_MGT_CMD, |
dudnwjs | 3:1e70387e1337 | 249 | /// White List Size indication event |
dudnwjs | 3:1e70387e1337 | 250 | GAPM_WHITE_LIST_SIZE_IND, |
dudnwjs | 3:1e70387e1337 | 251 | |
dudnwjs | 3:1e70387e1337 | 252 | /* Air Operations */ |
dudnwjs | 3:1e70387e1337 | 253 | /// Set advertising mode Command |
dudnwjs | 3:1e70387e1337 | 254 | GAPM_START_ADVERTISE_CMD, |
dudnwjs | 3:1e70387e1337 | 255 | |
dudnwjs | 3:1e70387e1337 | 256 | /// Set Scan mode Command |
dudnwjs | 3:1e70387e1337 | 257 | GAPM_START_SCAN_CMD, |
dudnwjs | 3:1e70387e1337 | 258 | /// Advertising or scanning report information event |
dudnwjs | 3:1e70387e1337 | 259 | GAPM_ADV_REPORT_IND, |
dudnwjs | 3:1e70387e1337 | 260 | |
dudnwjs | 3:1e70387e1337 | 261 | /// Set connection initialization Command |
dudnwjs | 3:1e70387e1337 | 262 | GAPM_START_CONNECTION_CMD, |
dudnwjs | 3:1e70387e1337 | 263 | /// Name of peer device indication |
dudnwjs | 3:1e70387e1337 | 264 | GAPM_PEER_NAME_IND, |
dudnwjs | 3:1e70387e1337 | 265 | /// Confirm connection to a specific device (Connection Operation in Selective mode) |
dudnwjs | 3:1e70387e1337 | 266 | GAPM_CONNECTION_CFM, |
dudnwjs | 3:1e70387e1337 | 267 | |
dudnwjs | 3:1e70387e1337 | 268 | /* Privacy update events */ |
dudnwjs | 3:1e70387e1337 | 269 | /// Privacy flag value has been updated |
dudnwjs | 3:1e70387e1337 | 270 | GAPM_UPDATED_PRIVACY_IND, |
dudnwjs | 3:1e70387e1337 | 271 | /// Reconnection address has been updated |
dudnwjs | 3:1e70387e1337 | 272 | GAPM_UPDATED_RECON_ADDR_IND, |
dudnwjs | 3:1e70387e1337 | 273 | |
dudnwjs | 3:1e70387e1337 | 274 | /* Security / Encryption Toolbox */ |
dudnwjs | 3:1e70387e1337 | 275 | /// Resolve address command |
dudnwjs | 3:1e70387e1337 | 276 | GAPM_RESOLV_ADDR_CMD, |
dudnwjs | 3:1e70387e1337 | 277 | /// Indicate that resolvable random address has been solved |
dudnwjs | 3:1e70387e1337 | 278 | GAPM_ADDR_SOLVED_IND, |
dudnwjs | 3:1e70387e1337 | 279 | /// Generate a random address. |
dudnwjs | 3:1e70387e1337 | 280 | GAPM_GEN_RAND_ADDR_CMD, |
dudnwjs | 3:1e70387e1337 | 281 | /// Use the AES-128 block in the controller |
dudnwjs | 3:1e70387e1337 | 282 | GAPM_USE_ENC_BLOCK_CMD, |
dudnwjs | 3:1e70387e1337 | 283 | /// AES-128 block result indication |
dudnwjs | 3:1e70387e1337 | 284 | GAPM_USE_ENC_BLOCK_IND, |
dudnwjs | 3:1e70387e1337 | 285 | /// Generate a 8-byte random number |
dudnwjs | 3:1e70387e1337 | 286 | GAPM_GEN_RAND_NB_CMD, |
dudnwjs | 3:1e70387e1337 | 287 | /// Random Number Indication |
dudnwjs | 3:1e70387e1337 | 288 | GAPM_GEN_RAND_NB_IND, |
dudnwjs | 3:1e70387e1337 | 289 | |
dudnwjs | 3:1e70387e1337 | 290 | /* Debug */ |
dudnwjs | 3:1e70387e1337 | 291 | /// Indication containing information about memory usage. |
dudnwjs | 3:1e70387e1337 | 292 | GAPM_DBG_MEM_INFO_IND, |
dudnwjs | 3:1e70387e1337 | 293 | |
dudnwjs | 3:1e70387e1337 | 294 | /* Local device information -cont */ |
dudnwjs | 3:1e70387e1337 | 295 | /// Advertising channel Tx power level |
dudnwjs | 3:1e70387e1337 | 296 | GAPM_DEV_ADV_TX_POWER_IND, |
dudnwjs | 3:1e70387e1337 | 297 | |
dudnwjs | 3:1e70387e1337 | 298 | /* Internal messages for timer events, not part of API*/ |
dudnwjs | 3:1e70387e1337 | 299 | /// Limited discoverable timeout indication |
dudnwjs | 3:1e70387e1337 | 300 | GAPM_LIM_DISC_TO_IND, |
dudnwjs | 3:1e70387e1337 | 301 | /// Scan timeout indication |
dudnwjs | 3:1e70387e1337 | 302 | GAPM_SCAN_TO_IND, |
dudnwjs | 3:1e70387e1337 | 303 | /// Address renewal timeout indication |
dudnwjs | 3:1e70387e1337 | 304 | GAPM_ADDR_RENEW_TO_IND, |
dudnwjs | 3:1e70387e1337 | 305 | }; |
dudnwjs | 3:1e70387e1337 | 306 | |
dudnwjs | 3:1e70387e1337 | 307 | /// GAP Manager operation type - application interface |
dudnwjs | 3:1e70387e1337 | 308 | enum gapm_operation |
dudnwjs | 3:1e70387e1337 | 309 | { |
dudnwjs | 3:1e70387e1337 | 310 | /* No Operation (if nothing has been requested) */ |
dudnwjs | 3:1e70387e1337 | 311 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 312 | /// No operation. |
dudnwjs | 3:1e70387e1337 | 313 | GAPM_NO_OP = 0x00, |
dudnwjs | 3:1e70387e1337 | 314 | |
dudnwjs | 3:1e70387e1337 | 315 | /* Default operations */ |
dudnwjs | 3:1e70387e1337 | 316 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 317 | /// Reset BLE subsystem: LL and HL. |
dudnwjs | 3:1e70387e1337 | 318 | GAPM_RESET, |
dudnwjs | 3:1e70387e1337 | 319 | /// Cancel currently executed operation. |
dudnwjs | 3:1e70387e1337 | 320 | GAPM_CANCEL, |
dudnwjs | 3:1e70387e1337 | 321 | |
dudnwjs | 3:1e70387e1337 | 322 | /* Configuration operations */ |
dudnwjs | 3:1e70387e1337 | 323 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 324 | /// Set device configuration |
dudnwjs | 3:1e70387e1337 | 325 | GAPM_SET_DEV_CONFIG, |
dudnwjs | 3:1e70387e1337 | 326 | /// Set device name |
dudnwjs | 3:1e70387e1337 | 327 | GAPM_SET_DEV_NAME, |
dudnwjs | 3:1e70387e1337 | 328 | /// Set device channel map |
dudnwjs | 3:1e70387e1337 | 329 | GAPM_SET_CHANNEL_MAP, |
dudnwjs | 3:1e70387e1337 | 330 | |
dudnwjs | 3:1e70387e1337 | 331 | /* Retrieve device information */ |
dudnwjs | 3:1e70387e1337 | 332 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 333 | /// Get Local device name |
dudnwjs | 3:1e70387e1337 | 334 | GAPM_GET_DEV_NAME, |
dudnwjs | 3:1e70387e1337 | 335 | /// Get Local device version |
dudnwjs | 3:1e70387e1337 | 336 | GAPM_GET_DEV_VERSION, |
dudnwjs | 3:1e70387e1337 | 337 | /// Get Local device BD Address |
dudnwjs | 3:1e70387e1337 | 338 | GAPM_GET_DEV_BDADDR, |
dudnwjs | 3:1e70387e1337 | 339 | |
dudnwjs | 3:1e70387e1337 | 340 | /* Operation on White list */ |
dudnwjs | 3:1e70387e1337 | 341 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 342 | /// Get White List Size. |
dudnwjs | 3:1e70387e1337 | 343 | GAPM_GET_WLIST_SIZE, |
dudnwjs | 3:1e70387e1337 | 344 | /// Add devices in white list. |
dudnwjs | 3:1e70387e1337 | 345 | GAPM_ADD_DEV_IN_WLIST, |
dudnwjs | 3:1e70387e1337 | 346 | /// Remove devices form white list. |
dudnwjs | 3:1e70387e1337 | 347 | GAPM_RMV_DEV_FRM_WLIST, |
dudnwjs | 3:1e70387e1337 | 348 | /// Clear all devices from white list. |
dudnwjs | 3:1e70387e1337 | 349 | GAPM_CLEAR_WLIST, |
dudnwjs | 3:1e70387e1337 | 350 | |
dudnwjs | 3:1e70387e1337 | 351 | /* Advertise mode operations */ |
dudnwjs | 3:1e70387e1337 | 352 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 353 | /// Start non connectable advertising |
dudnwjs | 3:1e70387e1337 | 354 | GAPM_ADV_NON_CONN, |
dudnwjs | 3:1e70387e1337 | 355 | /// Start undirected connectable advertising |
dudnwjs | 3:1e70387e1337 | 356 | GAPM_ADV_UNDIRECT, |
dudnwjs | 3:1e70387e1337 | 357 | /// Start directed connectable advertising |
dudnwjs | 3:1e70387e1337 | 358 | GAPM_ADV_DIRECT, |
dudnwjs | 3:1e70387e1337 | 359 | |
dudnwjs | 3:1e70387e1337 | 360 | /* Scan mode operations */ |
dudnwjs | 3:1e70387e1337 | 361 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 362 | /// Start active scan operation |
dudnwjs | 3:1e70387e1337 | 363 | GAPM_SCAN_ACTIVE, |
dudnwjs | 3:1e70387e1337 | 364 | /// Start passive scan operation |
dudnwjs | 3:1e70387e1337 | 365 | GAPM_SCAN_PASSIVE, |
dudnwjs | 3:1e70387e1337 | 366 | |
dudnwjs | 3:1e70387e1337 | 367 | /* Connection mode operations */ |
dudnwjs | 3:1e70387e1337 | 368 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 369 | /// Direct connection operation |
dudnwjs | 3:1e70387e1337 | 370 | GAPM_CONNECTION_DIRECT, |
dudnwjs | 3:1e70387e1337 | 371 | /// Automatic connection operation |
dudnwjs | 3:1e70387e1337 | 372 | GAPM_CONNECTION_AUTO, |
dudnwjs | 3:1e70387e1337 | 373 | /// Selective connection operation |
dudnwjs | 3:1e70387e1337 | 374 | GAPM_CONNECTION_SELECTIVE, |
dudnwjs | 3:1e70387e1337 | 375 | /// Name Request operation (requires to start a direct connection) |
dudnwjs | 3:1e70387e1337 | 376 | GAPM_CONNECTION_NAME_REQUEST, |
dudnwjs | 3:1e70387e1337 | 377 | |
dudnwjs | 3:1e70387e1337 | 378 | /* Security / Encryption Toolbox */ |
dudnwjs | 3:1e70387e1337 | 379 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 380 | /// Resolve device address |
dudnwjs | 3:1e70387e1337 | 381 | GAPM_RESOLV_ADDR, |
dudnwjs | 3:1e70387e1337 | 382 | /// Generate a random address |
dudnwjs | 3:1e70387e1337 | 383 | GAPM_GEN_RAND_ADDR, |
dudnwjs | 3:1e70387e1337 | 384 | /// Use the controller's AES-128 block |
dudnwjs | 3:1e70387e1337 | 385 | GAPM_USE_ENC_BLOCK, |
dudnwjs | 3:1e70387e1337 | 386 | /// Generate a 8-byte random number |
dudnwjs | 3:1e70387e1337 | 387 | GAPM_GEN_RAND_NB, |
dudnwjs | 3:1e70387e1337 | 388 | |
dudnwjs | 3:1e70387e1337 | 389 | /* DEBUG */ |
dudnwjs | 3:1e70387e1337 | 390 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 391 | /// Get memory usage |
dudnwjs | 3:1e70387e1337 | 392 | GAPM_DBG_GET_MEM_INFO, |
dudnwjs | 3:1e70387e1337 | 393 | /// Perform a platform reset |
dudnwjs | 3:1e70387e1337 | 394 | GAPM_PLF_RESET, |
dudnwjs | 3:1e70387e1337 | 395 | |
dudnwjs | 3:1e70387e1337 | 396 | /* Retrieve device information - cont */ |
dudnwjs | 3:1e70387e1337 | 397 | /* ************************************************ */ |
dudnwjs | 3:1e70387e1337 | 398 | /// Get device advertising power level |
dudnwjs | 3:1e70387e1337 | 399 | GAPM_GET_DEV_ADV_TX_POWER, |
dudnwjs | 3:1e70387e1337 | 400 | |
dudnwjs | 3:1e70387e1337 | 401 | /// Last GAPM operation flag |
dudnwjs | 3:1e70387e1337 | 402 | GAPM_LAST |
dudnwjs | 3:1e70387e1337 | 403 | }; |
dudnwjs | 3:1e70387e1337 | 404 | |
dudnwjs | 4:60be78a172c2 | 405 | /// Own BD address source of the device |
dudnwjs | 4:60be78a172c2 | 406 | enum gapm_own_addr_src |
dudnwjs | 4:60be78a172c2 | 407 | { |
dudnwjs | 4:60be78a172c2 | 408 | /// Public Address |
dudnwjs | 4:60be78a172c2 | 409 | GAPM_PUBLIC_ADDR, |
dudnwjs | 4:60be78a172c2 | 410 | /// Provided random address |
dudnwjs | 4:60be78a172c2 | 411 | GAPM_PROVIDED_RND_ADDR, |
dudnwjs | 4:60be78a172c2 | 412 | /// Provided static random address |
dudnwjs | 4:60be78a172c2 | 413 | GAPM_GEN_STATIC_RND_ADDR, |
dudnwjs | 4:60be78a172c2 | 414 | /// Generated resolvable private random address |
dudnwjs | 4:60be78a172c2 | 415 | GAPM_GEN_RSLV_ADDR, |
dudnwjs | 4:60be78a172c2 | 416 | /// Generated non-resolvable private random address |
dudnwjs | 4:60be78a172c2 | 417 | GAPM_GEN_NON_RSLV_ADDR, |
dudnwjs | 4:60be78a172c2 | 418 | /// Provided Reconnection address |
dudnwjs | 4:60be78a172c2 | 419 | GAPM_PROVIDED_RECON_ADDR, |
dudnwjs | 4:60be78a172c2 | 420 | }; |
dudnwjs | 4:60be78a172c2 | 421 | |
dudnwjs | 4:60be78a172c2 | 422 | /// Device Attribute write permission requirement |
dudnwjs | 4:60be78a172c2 | 423 | enum gapm_write_att_perm |
dudnwjs | 4:60be78a172c2 | 424 | { |
dudnwjs | 4:60be78a172c2 | 425 | /// Disable write access |
dudnwjs | 4:60be78a172c2 | 426 | GAPM_WRITE_DISABLE = 0, |
dudnwjs | 4:60be78a172c2 | 427 | /// Enable write access |
dudnwjs | 4:60be78a172c2 | 428 | GAPM_WRITE_ENABLE = 8, |
dudnwjs | 4:60be78a172c2 | 429 | /// Write access requires unauthenticated link |
dudnwjs | 4:60be78a172c2 | 430 | GAPM_WRITE_UNAUTH = 16, |
dudnwjs | 4:60be78a172c2 | 431 | /// Write access requires authenticated link |
dudnwjs | 4:60be78a172c2 | 432 | GAPM_WRITE_AUTH = 24, |
dudnwjs | 4:60be78a172c2 | 433 | }; |
dudnwjs | 4:60be78a172c2 | 434 | |
dudnwjs | 3:1e70387e1337 | 435 | }//namespace |
dudnwjs | 3:1e70387e1337 | 436 | |
dudnwjs | 3:1e70387e1337 | 437 | #endif//GAPM_TASK_H |