BLE fota Robot Demo
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_lamp_control by
Diff: dialog_fota/gapc_task.h
- Revision:
- 4:60be78a172c2
- Child:
- 5:e11b23f9aacc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dialog_fota/gapc_task.h Wed Jun 24 08:50:07 2015 +0000 @@ -0,0 +1,210 @@ +#ifndef GAPC_TASK_H +#define GAPC_TASK_H + +#include "dialog_fota_config.h" + +namespace sevencore_fota{ +/// GAP Controller Task messages +enum gapc_msg_id +{ + /* Default event */ + /// Command Complete event + GAPC_CMP_EVT = 14336, + + /* Connection state information */ + /// Indicate that a connection has been established + GAPC_CONNECTION_REQ_IND, + /// Set specific link data configuration. + GAPC_CONNECTION_CFM, + + /// Indicate that a link has been disconnected + GAPC_DISCONNECT_IND, + + /* Link management command */ + /// Request disconnection of current link command. + GAPC_DISCONNECT_CMD, + + /* Peer device info */ + /// Retrieve information command + GAPC_GET_INFO_CMD, + /// Name of peer device indication + GAPC_PEER_NAME_IND, + /// Indication of peer version info + GAPC_PEER_VERSION_IND, + /// Indication of peer features info + GAPC_PEER_FEATURES_IND, + + /// Indication of ongoing connection RSSI + GAPC_CON_RSSI_IND, + /// Indication of peer privacy info + GAPC_PRIVACY_IND, + /// Indication of peer reconnection address info + GAPC_RECON_ADDR_IND, + + /* Privacy configuration */ + /// Set Privacy flag command. + GAPC_SET_PRIVACY_CMD, + /// Set Reconnection Address Value command. + GAPC_SET_RECON_ADDR_CMD, + + /* Connection parameters update */ + /// Perform update of connection parameters command + GAPC_PARAM_UPDATE_CMD, + /// Request of updating connection parameters indication + GAPC_PARAM_UPDATE_REQ_IND, + /// Master confirm or not that parameters proposed by slave are accepted or not + GAPC_PARAM_UPDATE_CFM, + /// Connection parameters updated indication + GAPC_PARAM_UPDATED_IND, + + /* Bonding procedure */ + /// Start Bonding command procedure + GAPC_BOND_CMD, + /// Bonding requested by peer device indication message. + GAPC_BOND_REQ_IND, + /// Confirm requested bond information. + GAPC_BOND_CFM, + /// Bonding information indication message + GAPC_BOND_IND, + + /* Encryption procedure */ + /// Start Encryption command procedure + GAPC_ENCRYPT_CMD, + /// Encryption requested by peer device indication message. + GAPC_ENCRYPT_REQ_IND, + /// Confirm requested Encryption information. + GAPC_ENCRYPT_CFM, + /// Encryption information indication message + GAPC_ENCRYPT_IND, + + /* Security request procedure */ + /// Start Security Request command procedure + GAPC_SECURITY_CMD, + /// Security requested by peer device indication message + GAPC_SECURITY_IND, + + /* Signature procedure */ + /// Indicate the current sign counters to the application + GAPC_SIGN_COUNTER_IND, + + /* Device information */ + /// Indication of ongoing connection Channel Map + GAPC_CON_CHANNEL_MAP_IND, + + + /* Internal messages for timer events, not part of API*/ + /// Parameter update procedure timeout indication + GAPC_PARAM_UPDATE_TO_IND, + +}; + +/// request operation type - application interface +enum gapc_operation +{ + /* Operation Flags */ + /* No Operation (if nothing has been requested) */ + /* ************************************************ */ + /// No operation + GAPC_NO_OP = 0x00, + + /* Connection management */ + /// Disconnect link + GAPC_DISCONNECT, + + /* Connection information */ + /// Retrieve name of peer device. + GAPC_GET_PEER_NAME, + /// Retrieve peer device version info. + GAPC_GET_PEER_VERSION, + /// Retrieve peer device features. + GAPC_GET_PEER_FEATURES, + /// Retrieve connection RSSI. + GAPC_GET_CON_RSSI, + /// Retrieve Privacy Info. + GAPC_GET_PRIVACY, + /// Retrieve Reconnection Address Value. + GAPC_GET_RECON_ADDR, + + /* Privacy Configuration */ + /// Set Privacy flag. + GAPC_SET_PRIVACY, + /// Set Reconnection Address Value. + GAPC_SET_RECON_ADDR, + + /* Connection parameters update */ + /// Perform update of connection parameters. + GAPC_UPDATE_PARAMS, + + /* Security procedures */ + /// Start bonding procedure. + GAPC_BOND, + /// Start encryption procedure. + GAPC_ENCRYPT, + /// Start security request procedure + GAPC_SECURITY_REQ, + + /* Connection information */ + /// Retrieve Connection Channel MAP. + GAPC_GET_CON_CHANNEL_MAP, + + + /// Last GAPC operation flag + GAPC_LAST +}; + +/// Bond event type. +enum gapc_bond +{ + /// Bond Pairing request + GAPC_PAIRING_REQ, + /// Respond to Pairing request + GAPC_PAIRING_RSP, + + /// Pairing Finished information + GAPC_PAIRING_SUCCEED, + /// Pairing Failed information + GAPC_PAIRING_FAILED, + + /// Used to retrieve pairing Temporary Key + GAPC_TK_EXCH, + /// Used for Identity Resolving Key exchange + GAPC_IRK_EXCH, + /// Used for Connection Signature Resolving Key exchange + GAPC_CSRK_EXCH, + /// Used for Long Term Key exchange + GAPC_LTK_EXCH, + + /// Bond Pairing request issue, Repeated attempt + GAPC_REPEATED_ATTEMPT, +}; + +/// Command complete event data structure +struct gapc_cmp_evt +{ + /// GAP request type + uint8_t operation; + /// Status of the request + uint8_t status; +}; + +/// Indicate that a connection has been established +struct gapc_connection_req_ind +{ + /// Connection handle + uint16_t conhdl; + /// Connection interval + uint16_t con_interval; + /// Connection latency + uint16_t con_latency; + /// Link supervision timeout + uint16_t sup_to; + /// Clock accuracy + uint8_t clk_accuracy; + /// Peer address type + uint8_t peer_addr_type; + /// Peer BT address + struct bd_addr peer_addr; +}; + +}//namespace +#endif//GAPC_TASK_H