![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
BLE fota Robot Demo
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_lamp_control by
dialog_fota/gapc_task.h@10:18044afe4364, 2015-08-24 (annotated)
- Committer:
- dudnwjs
- Date:
- Mon Aug 24 03:11:00 2015 +0000
- Revision:
- 10:18044afe4364
- Parent:
- 9:fcf91f563147
Add header comment;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 10:18044afe4364 | 1 | /** |
dudnwjs | 10:18044afe4364 | 2 | * @file gapc_task.h |
dudnwjs | 10:18044afe4364 | 3 | * @brief Generic Access Profile Controller Header. |
dudnwjs | 10:18044afe4364 | 4 | * Copyright 2015 SEVENCORE Co., Ltd. |
dudnwjs | 10:18044afe4364 | 5 | * |
dudnwjs | 10:18044afe4364 | 6 | * @author HyeongJun Kim |
dudnwjs | 10:18044afe4364 | 7 | * @version 1.0.0 |
dudnwjs | 10:18044afe4364 | 8 | * @date 2015-08-20 |
dudnwjs | 10:18044afe4364 | 9 | */ |
dudnwjs | 4:60be78a172c2 | 10 | #ifndef GAPC_TASK_H |
dudnwjs | 4:60be78a172c2 | 11 | #define GAPC_TASK_H |
dudnwjs | 4:60be78a172c2 | 12 | |
dudnwjs | 4:60be78a172c2 | 13 | #include "dialog_fota_config.h" |
dudnwjs | 5:e11b23f9aacc | 14 | #include "gap.h" |
dudnwjs | 4:60be78a172c2 | 15 | |
dudnwjs | 9:fcf91f563147 | 16 | /** |
dudnwjs | 9:fcf91f563147 | 17 | **************************************************************************************** |
dudnwjs | 9:fcf91f563147 | 18 | * @addtogroup dialog_fota module |
dudnwjs | 9:fcf91f563147 | 19 | * @brief Generic Access Profile Controller Header. |
dudnwjs | 9:fcf91f563147 | 20 | * |
dudnwjs | 9:fcf91f563147 | 21 | * @{ |
dudnwjs | 9:fcf91f563147 | 22 | **************************************************************************************** |
dudnwjs | 9:fcf91f563147 | 23 | */ |
dudnwjs | 4:60be78a172c2 | 24 | namespace sevencore_fota{ |
dudnwjs | 9:fcf91f563147 | 25 | |
dudnwjs | 4:60be78a172c2 | 26 | /// GAP Controller Task messages |
dudnwjs | 4:60be78a172c2 | 27 | enum gapc_msg_id |
dudnwjs | 4:60be78a172c2 | 28 | { |
dudnwjs | 4:60be78a172c2 | 29 | /* Default event */ |
dudnwjs | 4:60be78a172c2 | 30 | /// Command Complete event |
dudnwjs | 4:60be78a172c2 | 31 | GAPC_CMP_EVT = 14336, |
dudnwjs | 4:60be78a172c2 | 32 | |
dudnwjs | 4:60be78a172c2 | 33 | /* Connection state information */ |
dudnwjs | 4:60be78a172c2 | 34 | /// Indicate that a connection has been established |
dudnwjs | 4:60be78a172c2 | 35 | GAPC_CONNECTION_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 36 | /// Set specific link data configuration. |
dudnwjs | 4:60be78a172c2 | 37 | GAPC_CONNECTION_CFM, |
dudnwjs | 4:60be78a172c2 | 38 | |
dudnwjs | 4:60be78a172c2 | 39 | /// Indicate that a link has been disconnected |
dudnwjs | 4:60be78a172c2 | 40 | GAPC_DISCONNECT_IND, |
dudnwjs | 4:60be78a172c2 | 41 | |
dudnwjs | 4:60be78a172c2 | 42 | /* Link management command */ |
dudnwjs | 4:60be78a172c2 | 43 | /// Request disconnection of current link command. |
dudnwjs | 4:60be78a172c2 | 44 | GAPC_DISCONNECT_CMD, |
dudnwjs | 4:60be78a172c2 | 45 | |
dudnwjs | 4:60be78a172c2 | 46 | /* Peer device info */ |
dudnwjs | 4:60be78a172c2 | 47 | /// Retrieve information command |
dudnwjs | 4:60be78a172c2 | 48 | GAPC_GET_INFO_CMD, |
dudnwjs | 4:60be78a172c2 | 49 | /// Name of peer device indication |
dudnwjs | 4:60be78a172c2 | 50 | GAPC_PEER_NAME_IND, |
dudnwjs | 4:60be78a172c2 | 51 | /// Indication of peer version info |
dudnwjs | 4:60be78a172c2 | 52 | GAPC_PEER_VERSION_IND, |
dudnwjs | 4:60be78a172c2 | 53 | /// Indication of peer features info |
dudnwjs | 4:60be78a172c2 | 54 | GAPC_PEER_FEATURES_IND, |
dudnwjs | 4:60be78a172c2 | 55 | |
dudnwjs | 4:60be78a172c2 | 56 | /// Indication of ongoing connection RSSI |
dudnwjs | 4:60be78a172c2 | 57 | GAPC_CON_RSSI_IND, |
dudnwjs | 4:60be78a172c2 | 58 | /// Indication of peer privacy info |
dudnwjs | 4:60be78a172c2 | 59 | GAPC_PRIVACY_IND, |
dudnwjs | 4:60be78a172c2 | 60 | /// Indication of peer reconnection address info |
dudnwjs | 4:60be78a172c2 | 61 | GAPC_RECON_ADDR_IND, |
dudnwjs | 4:60be78a172c2 | 62 | |
dudnwjs | 4:60be78a172c2 | 63 | /* Privacy configuration */ |
dudnwjs | 4:60be78a172c2 | 64 | /// Set Privacy flag command. |
dudnwjs | 4:60be78a172c2 | 65 | GAPC_SET_PRIVACY_CMD, |
dudnwjs | 4:60be78a172c2 | 66 | /// Set Reconnection Address Value command. |
dudnwjs | 4:60be78a172c2 | 67 | GAPC_SET_RECON_ADDR_CMD, |
dudnwjs | 4:60be78a172c2 | 68 | |
dudnwjs | 4:60be78a172c2 | 69 | /* Connection parameters update */ |
dudnwjs | 4:60be78a172c2 | 70 | /// Perform update of connection parameters command |
dudnwjs | 4:60be78a172c2 | 71 | GAPC_PARAM_UPDATE_CMD, |
dudnwjs | 4:60be78a172c2 | 72 | /// Request of updating connection parameters indication |
dudnwjs | 4:60be78a172c2 | 73 | GAPC_PARAM_UPDATE_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 74 | /// Master confirm or not that parameters proposed by slave are accepted or not |
dudnwjs | 4:60be78a172c2 | 75 | GAPC_PARAM_UPDATE_CFM, |
dudnwjs | 4:60be78a172c2 | 76 | /// Connection parameters updated indication |
dudnwjs | 4:60be78a172c2 | 77 | GAPC_PARAM_UPDATED_IND, |
dudnwjs | 4:60be78a172c2 | 78 | |
dudnwjs | 4:60be78a172c2 | 79 | /* Bonding procedure */ |
dudnwjs | 4:60be78a172c2 | 80 | /// Start Bonding command procedure |
dudnwjs | 4:60be78a172c2 | 81 | GAPC_BOND_CMD, |
dudnwjs | 4:60be78a172c2 | 82 | /// Bonding requested by peer device indication message. |
dudnwjs | 4:60be78a172c2 | 83 | GAPC_BOND_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 84 | /// Confirm requested bond information. |
dudnwjs | 4:60be78a172c2 | 85 | GAPC_BOND_CFM, |
dudnwjs | 4:60be78a172c2 | 86 | /// Bonding information indication message |
dudnwjs | 4:60be78a172c2 | 87 | GAPC_BOND_IND, |
dudnwjs | 4:60be78a172c2 | 88 | |
dudnwjs | 4:60be78a172c2 | 89 | /* Encryption procedure */ |
dudnwjs | 4:60be78a172c2 | 90 | /// Start Encryption command procedure |
dudnwjs | 4:60be78a172c2 | 91 | GAPC_ENCRYPT_CMD, |
dudnwjs | 4:60be78a172c2 | 92 | /// Encryption requested by peer device indication message. |
dudnwjs | 4:60be78a172c2 | 93 | GAPC_ENCRYPT_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 94 | /// Confirm requested Encryption information. |
dudnwjs | 4:60be78a172c2 | 95 | GAPC_ENCRYPT_CFM, |
dudnwjs | 4:60be78a172c2 | 96 | /// Encryption information indication message |
dudnwjs | 4:60be78a172c2 | 97 | GAPC_ENCRYPT_IND, |
dudnwjs | 4:60be78a172c2 | 98 | |
dudnwjs | 4:60be78a172c2 | 99 | /* Security request procedure */ |
dudnwjs | 4:60be78a172c2 | 100 | /// Start Security Request command procedure |
dudnwjs | 4:60be78a172c2 | 101 | GAPC_SECURITY_CMD, |
dudnwjs | 4:60be78a172c2 | 102 | /// Security requested by peer device indication message |
dudnwjs | 4:60be78a172c2 | 103 | GAPC_SECURITY_IND, |
dudnwjs | 4:60be78a172c2 | 104 | |
dudnwjs | 4:60be78a172c2 | 105 | /* Signature procedure */ |
dudnwjs | 4:60be78a172c2 | 106 | /// Indicate the current sign counters to the application |
dudnwjs | 4:60be78a172c2 | 107 | GAPC_SIGN_COUNTER_IND, |
dudnwjs | 4:60be78a172c2 | 108 | |
dudnwjs | 4:60be78a172c2 | 109 | /* Device information */ |
dudnwjs | 4:60be78a172c2 | 110 | /// Indication of ongoing connection Channel Map |
dudnwjs | 4:60be78a172c2 | 111 | GAPC_CON_CHANNEL_MAP_IND, |
dudnwjs | 4:60be78a172c2 | 112 | |
dudnwjs | 4:60be78a172c2 | 113 | |
dudnwjs | 4:60be78a172c2 | 114 | /* Internal messages for timer events, not part of API*/ |
dudnwjs | 4:60be78a172c2 | 115 | /// Parameter update procedure timeout indication |
dudnwjs | 4:60be78a172c2 | 116 | GAPC_PARAM_UPDATE_TO_IND, |
dudnwjs | 4:60be78a172c2 | 117 | |
dudnwjs | 4:60be78a172c2 | 118 | }; |
dudnwjs | 4:60be78a172c2 | 119 | |
dudnwjs | 4:60be78a172c2 | 120 | /// request operation type - application interface |
dudnwjs | 4:60be78a172c2 | 121 | enum gapc_operation |
dudnwjs | 4:60be78a172c2 | 122 | { |
dudnwjs | 4:60be78a172c2 | 123 | /* Operation Flags */ |
dudnwjs | 4:60be78a172c2 | 124 | /* No Operation (if nothing has been requested) */ |
dudnwjs | 4:60be78a172c2 | 125 | /* ************************************************ */ |
dudnwjs | 4:60be78a172c2 | 126 | /// No operation |
dudnwjs | 4:60be78a172c2 | 127 | GAPC_NO_OP = 0x00, |
dudnwjs | 4:60be78a172c2 | 128 | |
dudnwjs | 4:60be78a172c2 | 129 | /* Connection management */ |
dudnwjs | 4:60be78a172c2 | 130 | /// Disconnect link |
dudnwjs | 4:60be78a172c2 | 131 | GAPC_DISCONNECT, |
dudnwjs | 4:60be78a172c2 | 132 | |
dudnwjs | 4:60be78a172c2 | 133 | /* Connection information */ |
dudnwjs | 4:60be78a172c2 | 134 | /// Retrieve name of peer device. |
dudnwjs | 4:60be78a172c2 | 135 | GAPC_GET_PEER_NAME, |
dudnwjs | 4:60be78a172c2 | 136 | /// Retrieve peer device version info. |
dudnwjs | 4:60be78a172c2 | 137 | GAPC_GET_PEER_VERSION, |
dudnwjs | 4:60be78a172c2 | 138 | /// Retrieve peer device features. |
dudnwjs | 4:60be78a172c2 | 139 | GAPC_GET_PEER_FEATURES, |
dudnwjs | 4:60be78a172c2 | 140 | /// Retrieve connection RSSI. |
dudnwjs | 4:60be78a172c2 | 141 | GAPC_GET_CON_RSSI, |
dudnwjs | 4:60be78a172c2 | 142 | /// Retrieve Privacy Info. |
dudnwjs | 4:60be78a172c2 | 143 | GAPC_GET_PRIVACY, |
dudnwjs | 4:60be78a172c2 | 144 | /// Retrieve Reconnection Address Value. |
dudnwjs | 4:60be78a172c2 | 145 | GAPC_GET_RECON_ADDR, |
dudnwjs | 4:60be78a172c2 | 146 | |
dudnwjs | 4:60be78a172c2 | 147 | /* Privacy Configuration */ |
dudnwjs | 4:60be78a172c2 | 148 | /// Set Privacy flag. |
dudnwjs | 4:60be78a172c2 | 149 | GAPC_SET_PRIVACY, |
dudnwjs | 4:60be78a172c2 | 150 | /// Set Reconnection Address Value. |
dudnwjs | 4:60be78a172c2 | 151 | GAPC_SET_RECON_ADDR, |
dudnwjs | 4:60be78a172c2 | 152 | |
dudnwjs | 4:60be78a172c2 | 153 | /* Connection parameters update */ |
dudnwjs | 4:60be78a172c2 | 154 | /// Perform update of connection parameters. |
dudnwjs | 4:60be78a172c2 | 155 | GAPC_UPDATE_PARAMS, |
dudnwjs | 4:60be78a172c2 | 156 | |
dudnwjs | 4:60be78a172c2 | 157 | /* Security procedures */ |
dudnwjs | 4:60be78a172c2 | 158 | /// Start bonding procedure. |
dudnwjs | 4:60be78a172c2 | 159 | GAPC_BOND, |
dudnwjs | 4:60be78a172c2 | 160 | /// Start encryption procedure. |
dudnwjs | 4:60be78a172c2 | 161 | GAPC_ENCRYPT, |
dudnwjs | 4:60be78a172c2 | 162 | /// Start security request procedure |
dudnwjs | 4:60be78a172c2 | 163 | GAPC_SECURITY_REQ, |
dudnwjs | 4:60be78a172c2 | 164 | |
dudnwjs | 4:60be78a172c2 | 165 | /* Connection information */ |
dudnwjs | 4:60be78a172c2 | 166 | /// Retrieve Connection Channel MAP. |
dudnwjs | 4:60be78a172c2 | 167 | GAPC_GET_CON_CHANNEL_MAP, |
dudnwjs | 4:60be78a172c2 | 168 | |
dudnwjs | 4:60be78a172c2 | 169 | |
dudnwjs | 4:60be78a172c2 | 170 | /// Last GAPC operation flag |
dudnwjs | 4:60be78a172c2 | 171 | GAPC_LAST |
dudnwjs | 4:60be78a172c2 | 172 | }; |
dudnwjs | 4:60be78a172c2 | 173 | |
dudnwjs | 4:60be78a172c2 | 174 | /// Bond event type. |
dudnwjs | 4:60be78a172c2 | 175 | enum gapc_bond |
dudnwjs | 4:60be78a172c2 | 176 | { |
dudnwjs | 4:60be78a172c2 | 177 | /// Bond Pairing request |
dudnwjs | 4:60be78a172c2 | 178 | GAPC_PAIRING_REQ, |
dudnwjs | 4:60be78a172c2 | 179 | /// Respond to Pairing request |
dudnwjs | 4:60be78a172c2 | 180 | GAPC_PAIRING_RSP, |
dudnwjs | 4:60be78a172c2 | 181 | |
dudnwjs | 4:60be78a172c2 | 182 | /// Pairing Finished information |
dudnwjs | 4:60be78a172c2 | 183 | GAPC_PAIRING_SUCCEED, |
dudnwjs | 4:60be78a172c2 | 184 | /// Pairing Failed information |
dudnwjs | 4:60be78a172c2 | 185 | GAPC_PAIRING_FAILED, |
dudnwjs | 4:60be78a172c2 | 186 | |
dudnwjs | 4:60be78a172c2 | 187 | /// Used to retrieve pairing Temporary Key |
dudnwjs | 4:60be78a172c2 | 188 | GAPC_TK_EXCH, |
dudnwjs | 4:60be78a172c2 | 189 | /// Used for Identity Resolving Key exchange |
dudnwjs | 4:60be78a172c2 | 190 | GAPC_IRK_EXCH, |
dudnwjs | 4:60be78a172c2 | 191 | /// Used for Connection Signature Resolving Key exchange |
dudnwjs | 4:60be78a172c2 | 192 | GAPC_CSRK_EXCH, |
dudnwjs | 4:60be78a172c2 | 193 | /// Used for Long Term Key exchange |
dudnwjs | 4:60be78a172c2 | 194 | GAPC_LTK_EXCH, |
dudnwjs | 4:60be78a172c2 | 195 | |
dudnwjs | 4:60be78a172c2 | 196 | /// Bond Pairing request issue, Repeated attempt |
dudnwjs | 4:60be78a172c2 | 197 | GAPC_REPEATED_ATTEMPT, |
dudnwjs | 4:60be78a172c2 | 198 | }; |
dudnwjs | 4:60be78a172c2 | 199 | |
dudnwjs | 4:60be78a172c2 | 200 | /// Command complete event data structure |
dudnwjs | 4:60be78a172c2 | 201 | struct gapc_cmp_evt |
dudnwjs | 4:60be78a172c2 | 202 | { |
dudnwjs | 4:60be78a172c2 | 203 | /// GAP request type |
dudnwjs | 4:60be78a172c2 | 204 | uint8_t operation; |
dudnwjs | 4:60be78a172c2 | 205 | /// Status of the request |
dudnwjs | 4:60be78a172c2 | 206 | uint8_t status; |
dudnwjs | 4:60be78a172c2 | 207 | }; |
dudnwjs | 4:60be78a172c2 | 208 | |
dudnwjs | 4:60be78a172c2 | 209 | /// Indicate that a connection has been established |
dudnwjs | 4:60be78a172c2 | 210 | struct gapc_connection_req_ind |
dudnwjs | 4:60be78a172c2 | 211 | { |
dudnwjs | 4:60be78a172c2 | 212 | /// Connection handle |
dudnwjs | 4:60be78a172c2 | 213 | uint16_t conhdl; |
dudnwjs | 4:60be78a172c2 | 214 | /// Connection interval |
dudnwjs | 4:60be78a172c2 | 215 | uint16_t con_interval; |
dudnwjs | 4:60be78a172c2 | 216 | /// Connection latency |
dudnwjs | 4:60be78a172c2 | 217 | uint16_t con_latency; |
dudnwjs | 4:60be78a172c2 | 218 | /// Link supervision timeout |
dudnwjs | 4:60be78a172c2 | 219 | uint16_t sup_to; |
dudnwjs | 4:60be78a172c2 | 220 | /// Clock accuracy |
dudnwjs | 4:60be78a172c2 | 221 | uint8_t clk_accuracy; |
dudnwjs | 4:60be78a172c2 | 222 | /// Peer address type |
dudnwjs | 4:60be78a172c2 | 223 | uint8_t peer_addr_type; |
dudnwjs | 4:60be78a172c2 | 224 | /// Peer BT address |
dudnwjs | 4:60be78a172c2 | 225 | struct bd_addr peer_addr; |
dudnwjs | 4:60be78a172c2 | 226 | }; |
dudnwjs | 5:e11b23f9aacc | 227 | |
dudnwjs | 5:e11b23f9aacc | 228 | |
dudnwjs | 5:e11b23f9aacc | 229 | |
dudnwjs | 5:e11b23f9aacc | 230 | /// Indicate that a link has been disconnected |
dudnwjs | 5:e11b23f9aacc | 231 | struct gapc_disconnect_ind |
dudnwjs | 5:e11b23f9aacc | 232 | { |
dudnwjs | 5:e11b23f9aacc | 233 | /// Connection handle |
dudnwjs | 5:e11b23f9aacc | 234 | uint16_t conhdl; |
dudnwjs | 5:e11b23f9aacc | 235 | /// Reason of disconnection |
dudnwjs | 5:e11b23f9aacc | 236 | uint8_t reason; |
dudnwjs | 5:e11b23f9aacc | 237 | }; |
dudnwjs | 5:e11b23f9aacc | 238 | |
dudnwjs | 5:e11b23f9aacc | 239 | /// Set specific link data configuration. |
dudnwjs | 5:e11b23f9aacc | 240 | struct gapc_connection_cfm |
dudnwjs | 5:e11b23f9aacc | 241 | { |
dudnwjs | 5:e11b23f9aacc | 242 | /// Local CSRK value |
dudnwjs | 5:e11b23f9aacc | 243 | struct gap_sec_key lcsrk; |
dudnwjs | 5:e11b23f9aacc | 244 | /// Local signature counter value |
dudnwjs | 5:e11b23f9aacc | 245 | uint32_t lsign_counter; |
dudnwjs | 5:e11b23f9aacc | 246 | |
dudnwjs | 5:e11b23f9aacc | 247 | /// Remote CSRK value |
dudnwjs | 5:e11b23f9aacc | 248 | struct gap_sec_key rcsrk; |
dudnwjs | 5:e11b23f9aacc | 249 | /// Remote signature counter value |
dudnwjs | 5:e11b23f9aacc | 250 | uint32_t rsign_counter; |
dudnwjs | 5:e11b23f9aacc | 251 | |
dudnwjs | 5:e11b23f9aacc | 252 | /// Authentication (@see gap_auth) |
dudnwjs | 5:e11b23f9aacc | 253 | uint8_t auth; |
dudnwjs | 5:e11b23f9aacc | 254 | /// Peer device is authorized to access database parameters requiring authorizations. |
dudnwjs | 5:e11b23f9aacc | 255 | /// - GAP_AUTHZ_NOT_SET: Authorization not set |
dudnwjs | 5:e11b23f9aacc | 256 | /// - GAP_AUTHZ_ACCEPT: Authorization automatically accepted |
dudnwjs | 5:e11b23f9aacc | 257 | /// - GAP_AUTHZ_REJECT: Authorization automatically rejected |
dudnwjs | 5:e11b23f9aacc | 258 | uint8_t authorize; |
dudnwjs | 5:e11b23f9aacc | 259 | }; |
dudnwjs | 5:e11b23f9aacc | 260 | |
dudnwjs | 4:60be78a172c2 | 261 | }//namespace |
dudnwjs | 9:fcf91f563147 | 262 | |
dudnwjs | 9:fcf91f563147 | 263 | /// @} dialog_fota module |
dudnwjs | 9:fcf91f563147 | 264 | |
dudnwjs | 4:60be78a172c2 | 265 | #endif//GAPC_TASK_H |