sevencore fota solution development project
dialog_fota/gapc_task.h@4:60be78a172c2, 2015-06-24 (annotated)
- Committer:
- dudnwjs
- Date:
- Wed Jun 24 08:50:07 2015 +0000
- Revision:
- 4:60be78a172c2
- Child:
- 5:e11b23f9aacc
Add advertising feature;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudnwjs | 4:60be78a172c2 | 1 | #ifndef GAPC_TASK_H |
dudnwjs | 4:60be78a172c2 | 2 | #define GAPC_TASK_H |
dudnwjs | 4:60be78a172c2 | 3 | |
dudnwjs | 4:60be78a172c2 | 4 | #include "dialog_fota_config.h" |
dudnwjs | 4:60be78a172c2 | 5 | |
dudnwjs | 4:60be78a172c2 | 6 | namespace sevencore_fota{ |
dudnwjs | 4:60be78a172c2 | 7 | /// GAP Controller Task messages |
dudnwjs | 4:60be78a172c2 | 8 | enum gapc_msg_id |
dudnwjs | 4:60be78a172c2 | 9 | { |
dudnwjs | 4:60be78a172c2 | 10 | /* Default event */ |
dudnwjs | 4:60be78a172c2 | 11 | /// Command Complete event |
dudnwjs | 4:60be78a172c2 | 12 | GAPC_CMP_EVT = 14336, |
dudnwjs | 4:60be78a172c2 | 13 | |
dudnwjs | 4:60be78a172c2 | 14 | /* Connection state information */ |
dudnwjs | 4:60be78a172c2 | 15 | /// Indicate that a connection has been established |
dudnwjs | 4:60be78a172c2 | 16 | GAPC_CONNECTION_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 17 | /// Set specific link data configuration. |
dudnwjs | 4:60be78a172c2 | 18 | GAPC_CONNECTION_CFM, |
dudnwjs | 4:60be78a172c2 | 19 | |
dudnwjs | 4:60be78a172c2 | 20 | /// Indicate that a link has been disconnected |
dudnwjs | 4:60be78a172c2 | 21 | GAPC_DISCONNECT_IND, |
dudnwjs | 4:60be78a172c2 | 22 | |
dudnwjs | 4:60be78a172c2 | 23 | /* Link management command */ |
dudnwjs | 4:60be78a172c2 | 24 | /// Request disconnection of current link command. |
dudnwjs | 4:60be78a172c2 | 25 | GAPC_DISCONNECT_CMD, |
dudnwjs | 4:60be78a172c2 | 26 | |
dudnwjs | 4:60be78a172c2 | 27 | /* Peer device info */ |
dudnwjs | 4:60be78a172c2 | 28 | /// Retrieve information command |
dudnwjs | 4:60be78a172c2 | 29 | GAPC_GET_INFO_CMD, |
dudnwjs | 4:60be78a172c2 | 30 | /// Name of peer device indication |
dudnwjs | 4:60be78a172c2 | 31 | GAPC_PEER_NAME_IND, |
dudnwjs | 4:60be78a172c2 | 32 | /// Indication of peer version info |
dudnwjs | 4:60be78a172c2 | 33 | GAPC_PEER_VERSION_IND, |
dudnwjs | 4:60be78a172c2 | 34 | /// Indication of peer features info |
dudnwjs | 4:60be78a172c2 | 35 | GAPC_PEER_FEATURES_IND, |
dudnwjs | 4:60be78a172c2 | 36 | |
dudnwjs | 4:60be78a172c2 | 37 | /// Indication of ongoing connection RSSI |
dudnwjs | 4:60be78a172c2 | 38 | GAPC_CON_RSSI_IND, |
dudnwjs | 4:60be78a172c2 | 39 | /// Indication of peer privacy info |
dudnwjs | 4:60be78a172c2 | 40 | GAPC_PRIVACY_IND, |
dudnwjs | 4:60be78a172c2 | 41 | /// Indication of peer reconnection address info |
dudnwjs | 4:60be78a172c2 | 42 | GAPC_RECON_ADDR_IND, |
dudnwjs | 4:60be78a172c2 | 43 | |
dudnwjs | 4:60be78a172c2 | 44 | /* Privacy configuration */ |
dudnwjs | 4:60be78a172c2 | 45 | /// Set Privacy flag command. |
dudnwjs | 4:60be78a172c2 | 46 | GAPC_SET_PRIVACY_CMD, |
dudnwjs | 4:60be78a172c2 | 47 | /// Set Reconnection Address Value command. |
dudnwjs | 4:60be78a172c2 | 48 | GAPC_SET_RECON_ADDR_CMD, |
dudnwjs | 4:60be78a172c2 | 49 | |
dudnwjs | 4:60be78a172c2 | 50 | /* Connection parameters update */ |
dudnwjs | 4:60be78a172c2 | 51 | /// Perform update of connection parameters command |
dudnwjs | 4:60be78a172c2 | 52 | GAPC_PARAM_UPDATE_CMD, |
dudnwjs | 4:60be78a172c2 | 53 | /// Request of updating connection parameters indication |
dudnwjs | 4:60be78a172c2 | 54 | GAPC_PARAM_UPDATE_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 55 | /// Master confirm or not that parameters proposed by slave are accepted or not |
dudnwjs | 4:60be78a172c2 | 56 | GAPC_PARAM_UPDATE_CFM, |
dudnwjs | 4:60be78a172c2 | 57 | /// Connection parameters updated indication |
dudnwjs | 4:60be78a172c2 | 58 | GAPC_PARAM_UPDATED_IND, |
dudnwjs | 4:60be78a172c2 | 59 | |
dudnwjs | 4:60be78a172c2 | 60 | /* Bonding procedure */ |
dudnwjs | 4:60be78a172c2 | 61 | /// Start Bonding command procedure |
dudnwjs | 4:60be78a172c2 | 62 | GAPC_BOND_CMD, |
dudnwjs | 4:60be78a172c2 | 63 | /// Bonding requested by peer device indication message. |
dudnwjs | 4:60be78a172c2 | 64 | GAPC_BOND_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 65 | /// Confirm requested bond information. |
dudnwjs | 4:60be78a172c2 | 66 | GAPC_BOND_CFM, |
dudnwjs | 4:60be78a172c2 | 67 | /// Bonding information indication message |
dudnwjs | 4:60be78a172c2 | 68 | GAPC_BOND_IND, |
dudnwjs | 4:60be78a172c2 | 69 | |
dudnwjs | 4:60be78a172c2 | 70 | /* Encryption procedure */ |
dudnwjs | 4:60be78a172c2 | 71 | /// Start Encryption command procedure |
dudnwjs | 4:60be78a172c2 | 72 | GAPC_ENCRYPT_CMD, |
dudnwjs | 4:60be78a172c2 | 73 | /// Encryption requested by peer device indication message. |
dudnwjs | 4:60be78a172c2 | 74 | GAPC_ENCRYPT_REQ_IND, |
dudnwjs | 4:60be78a172c2 | 75 | /// Confirm requested Encryption information. |
dudnwjs | 4:60be78a172c2 | 76 | GAPC_ENCRYPT_CFM, |
dudnwjs | 4:60be78a172c2 | 77 | /// Encryption information indication message |
dudnwjs | 4:60be78a172c2 | 78 | GAPC_ENCRYPT_IND, |
dudnwjs | 4:60be78a172c2 | 79 | |
dudnwjs | 4:60be78a172c2 | 80 | /* Security request procedure */ |
dudnwjs | 4:60be78a172c2 | 81 | /// Start Security Request command procedure |
dudnwjs | 4:60be78a172c2 | 82 | GAPC_SECURITY_CMD, |
dudnwjs | 4:60be78a172c2 | 83 | /// Security requested by peer device indication message |
dudnwjs | 4:60be78a172c2 | 84 | GAPC_SECURITY_IND, |
dudnwjs | 4:60be78a172c2 | 85 | |
dudnwjs | 4:60be78a172c2 | 86 | /* Signature procedure */ |
dudnwjs | 4:60be78a172c2 | 87 | /// Indicate the current sign counters to the application |
dudnwjs | 4:60be78a172c2 | 88 | GAPC_SIGN_COUNTER_IND, |
dudnwjs | 4:60be78a172c2 | 89 | |
dudnwjs | 4:60be78a172c2 | 90 | /* Device information */ |
dudnwjs | 4:60be78a172c2 | 91 | /// Indication of ongoing connection Channel Map |
dudnwjs | 4:60be78a172c2 | 92 | GAPC_CON_CHANNEL_MAP_IND, |
dudnwjs | 4:60be78a172c2 | 93 | |
dudnwjs | 4:60be78a172c2 | 94 | |
dudnwjs | 4:60be78a172c2 | 95 | /* Internal messages for timer events, not part of API*/ |
dudnwjs | 4:60be78a172c2 | 96 | /// Parameter update procedure timeout indication |
dudnwjs | 4:60be78a172c2 | 97 | GAPC_PARAM_UPDATE_TO_IND, |
dudnwjs | 4:60be78a172c2 | 98 | |
dudnwjs | 4:60be78a172c2 | 99 | }; |
dudnwjs | 4:60be78a172c2 | 100 | |
dudnwjs | 4:60be78a172c2 | 101 | /// request operation type - application interface |
dudnwjs | 4:60be78a172c2 | 102 | enum gapc_operation |
dudnwjs | 4:60be78a172c2 | 103 | { |
dudnwjs | 4:60be78a172c2 | 104 | /* Operation Flags */ |
dudnwjs | 4:60be78a172c2 | 105 | /* No Operation (if nothing has been requested) */ |
dudnwjs | 4:60be78a172c2 | 106 | /* ************************************************ */ |
dudnwjs | 4:60be78a172c2 | 107 | /// No operation |
dudnwjs | 4:60be78a172c2 | 108 | GAPC_NO_OP = 0x00, |
dudnwjs | 4:60be78a172c2 | 109 | |
dudnwjs | 4:60be78a172c2 | 110 | /* Connection management */ |
dudnwjs | 4:60be78a172c2 | 111 | /// Disconnect link |
dudnwjs | 4:60be78a172c2 | 112 | GAPC_DISCONNECT, |
dudnwjs | 4:60be78a172c2 | 113 | |
dudnwjs | 4:60be78a172c2 | 114 | /* Connection information */ |
dudnwjs | 4:60be78a172c2 | 115 | /// Retrieve name of peer device. |
dudnwjs | 4:60be78a172c2 | 116 | GAPC_GET_PEER_NAME, |
dudnwjs | 4:60be78a172c2 | 117 | /// Retrieve peer device version info. |
dudnwjs | 4:60be78a172c2 | 118 | GAPC_GET_PEER_VERSION, |
dudnwjs | 4:60be78a172c2 | 119 | /// Retrieve peer device features. |
dudnwjs | 4:60be78a172c2 | 120 | GAPC_GET_PEER_FEATURES, |
dudnwjs | 4:60be78a172c2 | 121 | /// Retrieve connection RSSI. |
dudnwjs | 4:60be78a172c2 | 122 | GAPC_GET_CON_RSSI, |
dudnwjs | 4:60be78a172c2 | 123 | /// Retrieve Privacy Info. |
dudnwjs | 4:60be78a172c2 | 124 | GAPC_GET_PRIVACY, |
dudnwjs | 4:60be78a172c2 | 125 | /// Retrieve Reconnection Address Value. |
dudnwjs | 4:60be78a172c2 | 126 | GAPC_GET_RECON_ADDR, |
dudnwjs | 4:60be78a172c2 | 127 | |
dudnwjs | 4:60be78a172c2 | 128 | /* Privacy Configuration */ |
dudnwjs | 4:60be78a172c2 | 129 | /// Set Privacy flag. |
dudnwjs | 4:60be78a172c2 | 130 | GAPC_SET_PRIVACY, |
dudnwjs | 4:60be78a172c2 | 131 | /// Set Reconnection Address Value. |
dudnwjs | 4:60be78a172c2 | 132 | GAPC_SET_RECON_ADDR, |
dudnwjs | 4:60be78a172c2 | 133 | |
dudnwjs | 4:60be78a172c2 | 134 | /* Connection parameters update */ |
dudnwjs | 4:60be78a172c2 | 135 | /// Perform update of connection parameters. |
dudnwjs | 4:60be78a172c2 | 136 | GAPC_UPDATE_PARAMS, |
dudnwjs | 4:60be78a172c2 | 137 | |
dudnwjs | 4:60be78a172c2 | 138 | /* Security procedures */ |
dudnwjs | 4:60be78a172c2 | 139 | /// Start bonding procedure. |
dudnwjs | 4:60be78a172c2 | 140 | GAPC_BOND, |
dudnwjs | 4:60be78a172c2 | 141 | /// Start encryption procedure. |
dudnwjs | 4:60be78a172c2 | 142 | GAPC_ENCRYPT, |
dudnwjs | 4:60be78a172c2 | 143 | /// Start security request procedure |
dudnwjs | 4:60be78a172c2 | 144 | GAPC_SECURITY_REQ, |
dudnwjs | 4:60be78a172c2 | 145 | |
dudnwjs | 4:60be78a172c2 | 146 | /* Connection information */ |
dudnwjs | 4:60be78a172c2 | 147 | /// Retrieve Connection Channel MAP. |
dudnwjs | 4:60be78a172c2 | 148 | GAPC_GET_CON_CHANNEL_MAP, |
dudnwjs | 4:60be78a172c2 | 149 | |
dudnwjs | 4:60be78a172c2 | 150 | |
dudnwjs | 4:60be78a172c2 | 151 | /// Last GAPC operation flag |
dudnwjs | 4:60be78a172c2 | 152 | GAPC_LAST |
dudnwjs | 4:60be78a172c2 | 153 | }; |
dudnwjs | 4:60be78a172c2 | 154 | |
dudnwjs | 4:60be78a172c2 | 155 | /// Bond event type. |
dudnwjs | 4:60be78a172c2 | 156 | enum gapc_bond |
dudnwjs | 4:60be78a172c2 | 157 | { |
dudnwjs | 4:60be78a172c2 | 158 | /// Bond Pairing request |
dudnwjs | 4:60be78a172c2 | 159 | GAPC_PAIRING_REQ, |
dudnwjs | 4:60be78a172c2 | 160 | /// Respond to Pairing request |
dudnwjs | 4:60be78a172c2 | 161 | GAPC_PAIRING_RSP, |
dudnwjs | 4:60be78a172c2 | 162 | |
dudnwjs | 4:60be78a172c2 | 163 | /// Pairing Finished information |
dudnwjs | 4:60be78a172c2 | 164 | GAPC_PAIRING_SUCCEED, |
dudnwjs | 4:60be78a172c2 | 165 | /// Pairing Failed information |
dudnwjs | 4:60be78a172c2 | 166 | GAPC_PAIRING_FAILED, |
dudnwjs | 4:60be78a172c2 | 167 | |
dudnwjs | 4:60be78a172c2 | 168 | /// Used to retrieve pairing Temporary Key |
dudnwjs | 4:60be78a172c2 | 169 | GAPC_TK_EXCH, |
dudnwjs | 4:60be78a172c2 | 170 | /// Used for Identity Resolving Key exchange |
dudnwjs | 4:60be78a172c2 | 171 | GAPC_IRK_EXCH, |
dudnwjs | 4:60be78a172c2 | 172 | /// Used for Connection Signature Resolving Key exchange |
dudnwjs | 4:60be78a172c2 | 173 | GAPC_CSRK_EXCH, |
dudnwjs | 4:60be78a172c2 | 174 | /// Used for Long Term Key exchange |
dudnwjs | 4:60be78a172c2 | 175 | GAPC_LTK_EXCH, |
dudnwjs | 4:60be78a172c2 | 176 | |
dudnwjs | 4:60be78a172c2 | 177 | /// Bond Pairing request issue, Repeated attempt |
dudnwjs | 4:60be78a172c2 | 178 | GAPC_REPEATED_ATTEMPT, |
dudnwjs | 4:60be78a172c2 | 179 | }; |
dudnwjs | 4:60be78a172c2 | 180 | |
dudnwjs | 4:60be78a172c2 | 181 | /// Command complete event data structure |
dudnwjs | 4:60be78a172c2 | 182 | struct gapc_cmp_evt |
dudnwjs | 4:60be78a172c2 | 183 | { |
dudnwjs | 4:60be78a172c2 | 184 | /// GAP request type |
dudnwjs | 4:60be78a172c2 | 185 | uint8_t operation; |
dudnwjs | 4:60be78a172c2 | 186 | /// Status of the request |
dudnwjs | 4:60be78a172c2 | 187 | uint8_t status; |
dudnwjs | 4:60be78a172c2 | 188 | }; |
dudnwjs | 4:60be78a172c2 | 189 | |
dudnwjs | 4:60be78a172c2 | 190 | /// Indicate that a connection has been established |
dudnwjs | 4:60be78a172c2 | 191 | struct gapc_connection_req_ind |
dudnwjs | 4:60be78a172c2 | 192 | { |
dudnwjs | 4:60be78a172c2 | 193 | /// Connection handle |
dudnwjs | 4:60be78a172c2 | 194 | uint16_t conhdl; |
dudnwjs | 4:60be78a172c2 | 195 | /// Connection interval |
dudnwjs | 4:60be78a172c2 | 196 | uint16_t con_interval; |
dudnwjs | 4:60be78a172c2 | 197 | /// Connection latency |
dudnwjs | 4:60be78a172c2 | 198 | uint16_t con_latency; |
dudnwjs | 4:60be78a172c2 | 199 | /// Link supervision timeout |
dudnwjs | 4:60be78a172c2 | 200 | uint16_t sup_to; |
dudnwjs | 4:60be78a172c2 | 201 | /// Clock accuracy |
dudnwjs | 4:60be78a172c2 | 202 | uint8_t clk_accuracy; |
dudnwjs | 4:60be78a172c2 | 203 | /// Peer address type |
dudnwjs | 4:60be78a172c2 | 204 | uint8_t peer_addr_type; |
dudnwjs | 4:60be78a172c2 | 205 | /// Peer BT address |
dudnwjs | 4:60be78a172c2 | 206 | struct bd_addr peer_addr; |
dudnwjs | 4:60be78a172c2 | 207 | }; |
dudnwjs | 4:60be78a172c2 | 208 | |
dudnwjs | 4:60be78a172c2 | 209 | }//namespace |
dudnwjs | 4:60be78a172c2 | 210 | #endif//GAPC_TASK_H |