Bluetooth Low Energy based Firmware Over The Air with Mbed. Mbed part is a external processor of the IoT devices and communicate with a Bluetooth module. The Bluetooth module have to support BLE and implement BLE FOTA profile designed by ours. BLE FOTA profile specification is available from our GIT hub wiki(https://github.com/sevencore/BLEFOTA).

Dependencies:   mbed

Fork of mbed_fota by KIM HyoengJun

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gapc_task.h Source File

gapc_task.h

Go to the documentation of this file.
00001 /**
00002  * @file gapc_task.h
00003  * @brief Generic Access Profile Controller Header.
00004  * Copyright 2015 SEVENCORE Co., Ltd.
00005  *
00006  * @author HyeongJun Kim 
00007  * @version 1.0.0  
00008  * @date 2015-08-20
00009 */
00010 #ifndef GAPC_TASK_H
00011 #define GAPC_TASK_H
00012 
00013 #include "dialog_fota_config.h"
00014 #include "gap.h"
00015 
00016 /**
00017  ****************************************************************************************
00018  * @addtogroup dialog_fota module
00019  * @brief Generic Access Profile Controller Header.
00020  *
00021  * @{
00022  ****************************************************************************************
00023  */
00024 namespace sevencore_fota{
00025     
00026 /// GAP Controller Task messages
00027 enum gapc_msg_id
00028 {
00029     /* Default event */
00030     /// Command Complete event
00031     GAPC_CMP_EVT = 14336,
00032 
00033     /* Connection state information */
00034     /// Indicate that a connection has been established
00035     GAPC_CONNECTION_REQ_IND,
00036     /// Set specific link data configuration.
00037     GAPC_CONNECTION_CFM,
00038 
00039     /// Indicate that a link has been disconnected
00040     GAPC_DISCONNECT_IND,
00041 
00042     /* Link management command */
00043     /// Request disconnection of current link command.
00044     GAPC_DISCONNECT_CMD,
00045 
00046     /* Peer device info */
00047     /// Retrieve information command
00048     GAPC_GET_INFO_CMD,
00049     /// Name of peer device indication
00050     GAPC_PEER_NAME_IND,
00051     /// Indication of peer version info
00052     GAPC_PEER_VERSION_IND,
00053     /// Indication of peer features info
00054     GAPC_PEER_FEATURES_IND,
00055 
00056     /// Indication of ongoing connection RSSI
00057     GAPC_CON_RSSI_IND,
00058     /// Indication of peer privacy info
00059     GAPC_PRIVACY_IND,
00060     /// Indication of peer reconnection address info
00061     GAPC_RECON_ADDR_IND,
00062 
00063     /* Privacy configuration */
00064     /// Set Privacy flag command.
00065     GAPC_SET_PRIVACY_CMD,
00066     /// Set Reconnection Address Value command.
00067     GAPC_SET_RECON_ADDR_CMD,
00068 
00069     /* Connection parameters update */
00070     /// Perform update of connection parameters command
00071     GAPC_PARAM_UPDATE_CMD,
00072     /// Request of updating connection parameters indication
00073     GAPC_PARAM_UPDATE_REQ_IND,
00074     /// Master confirm or not that parameters proposed by slave are accepted or not
00075     GAPC_PARAM_UPDATE_CFM,
00076     /// Connection parameters updated indication
00077     GAPC_PARAM_UPDATED_IND,
00078 
00079     /* Bonding procedure */
00080     /// Start Bonding command procedure
00081     GAPC_BOND_CMD,
00082     /// Bonding requested by peer device indication message.
00083     GAPC_BOND_REQ_IND,
00084     /// Confirm requested bond information.
00085     GAPC_BOND_CFM,
00086     /// Bonding information indication message
00087     GAPC_BOND_IND,
00088 
00089     /* Encryption procedure */
00090     /// Start Encryption command procedure
00091     GAPC_ENCRYPT_CMD,
00092     /// Encryption requested by peer device indication message.
00093     GAPC_ENCRYPT_REQ_IND,
00094     /// Confirm requested Encryption information.
00095     GAPC_ENCRYPT_CFM,
00096     /// Encryption information indication message
00097     GAPC_ENCRYPT_IND,
00098 
00099     /* Security request procedure */
00100     /// Start Security Request command procedure
00101     GAPC_SECURITY_CMD,
00102     /// Security requested by peer device indication message
00103     GAPC_SECURITY_IND,
00104 
00105     /* Signature procedure */
00106     /// Indicate the current sign counters to the application
00107     GAPC_SIGN_COUNTER_IND,
00108 
00109     /* Device information */
00110     /// Indication of ongoing connection Channel Map
00111     GAPC_CON_CHANNEL_MAP_IND,
00112 
00113 
00114     /* Internal messages for timer events, not part of API*/
00115     /// Parameter update procedure timeout indication
00116     GAPC_PARAM_UPDATE_TO_IND,
00117 
00118 };
00119 
00120 /// request operation type - application interface
00121 enum gapc_operation
00122 {
00123     /*                 Operation Flags                  */
00124     /* No Operation (if nothing has been requested)     */
00125     /* ************************************************ */
00126     /// No operation
00127     GAPC_NO_OP                                    = 0x00,
00128 
00129     /* Connection management */
00130     /// Disconnect link
00131     GAPC_DISCONNECT,
00132 
00133     /* Connection information */
00134     /// Retrieve name of peer device.
00135     GAPC_GET_PEER_NAME,
00136     /// Retrieve peer device version info.
00137     GAPC_GET_PEER_VERSION,
00138     /// Retrieve peer device features.
00139     GAPC_GET_PEER_FEATURES,
00140     /// Retrieve connection RSSI.
00141     GAPC_GET_CON_RSSI,
00142     /// Retrieve Privacy Info.
00143     GAPC_GET_PRIVACY,
00144     /// Retrieve Reconnection Address Value.
00145     GAPC_GET_RECON_ADDR,
00146 
00147     /* Privacy Configuration */
00148     /// Set Privacy flag.
00149     GAPC_SET_PRIVACY,
00150     /// Set Reconnection Address Value.
00151     GAPC_SET_RECON_ADDR,
00152 
00153     /* Connection parameters update */
00154     /// Perform update of connection parameters.
00155     GAPC_UPDATE_PARAMS,
00156 
00157     /* Security procedures */
00158     /// Start bonding procedure.
00159     GAPC_BOND,
00160     /// Start encryption procedure.
00161     GAPC_ENCRYPT,
00162     /// Start security request procedure
00163     GAPC_SECURITY_REQ,
00164 
00165     /* Connection information */
00166     /// Retrieve Connection Channel MAP.
00167     GAPC_GET_CON_CHANNEL_MAP,
00168 
00169 
00170     /// Last GAPC operation flag
00171     GAPC_LAST
00172 };
00173 
00174 /// Bond event type.
00175 enum gapc_bond
00176 {
00177     /// Bond Pairing request
00178     GAPC_PAIRING_REQ,
00179     /// Respond to Pairing request
00180     GAPC_PAIRING_RSP,
00181 
00182     /// Pairing Finished information
00183     GAPC_PAIRING_SUCCEED,
00184     /// Pairing Failed information
00185     GAPC_PAIRING_FAILED,
00186 
00187     /// Used to retrieve pairing Temporary Key
00188     GAPC_TK_EXCH,
00189     /// Used for Identity Resolving Key exchange
00190     GAPC_IRK_EXCH,
00191     /// Used for Connection Signature Resolving Key exchange
00192     GAPC_CSRK_EXCH,
00193     /// Used for Long Term Key exchange
00194     GAPC_LTK_EXCH,
00195 
00196     /// Bond Pairing request issue, Repeated attempt
00197     GAPC_REPEATED_ATTEMPT,
00198 };
00199 
00200 /// Command complete event data structure
00201 struct gapc_cmp_evt
00202 {
00203     /// GAP request type
00204     uint8_t operation;
00205     /// Status of the request
00206     uint8_t status;
00207 };  
00208 
00209 /// Indicate that a connection has been established
00210 struct gapc_connection_req_ind
00211 {
00212     /// Connection handle
00213     uint16_t conhdl;
00214     /// Connection interval
00215     uint16_t con_interval;
00216     /// Connection latency
00217     uint16_t con_latency;
00218     /// Link supervision timeout
00219     uint16_t sup_to;
00220     /// Clock accuracy
00221     uint8_t clk_accuracy;
00222     /// Peer address type
00223     uint8_t peer_addr_type;
00224     /// Peer BT address
00225     struct bd_addr peer_addr;
00226 };  
00227 
00228 
00229 
00230 /// Indicate that a link has been disconnected
00231 struct gapc_disconnect_ind
00232 {
00233     /// Connection handle
00234     uint16_t conhdl;
00235     /// Reason of disconnection
00236     uint8_t reason;
00237 };
00238 
00239 /// Set specific link data configuration.
00240 struct gapc_connection_cfm
00241 {
00242     /// Local CSRK value
00243     struct gap_sec_key lcsrk;
00244     /// Local signature counter value
00245     uint32_t lsign_counter;
00246 
00247     /// Remote CSRK value
00248     struct gap_sec_key rcsrk;
00249     /// Remote signature counter value
00250     uint32_t rsign_counter;
00251 
00252     /// Authentication (@see gap_auth)
00253     uint8_t auth;
00254     /// Peer device is authorized to access database parameters requiring authorizations.
00255     ///  - GAP_AUTHZ_NOT_SET: Authorization not set
00256     ///  - GAP_AUTHZ_ACCEPT:  Authorization automatically accepted
00257     ///  - GAP_AUTHZ_REJECT:  Authorization automatically rejected
00258     uint8_t authorize;
00259 };
00260   
00261 }//namespace
00262 
00263 /// @} dialog_fota module
00264 
00265 #endif//GAPC_TASK_H