bleconnection make ediv private
This commit is contained in:
4 files changed
+18
-6
No files matched your search
@@ -108,6 +108,16 @@ bool BLEConnection::getWriteCmdPacket (void)
|
||||
return xSemaphoreTake(_wrcmd_sem, ms2tick(BLE_GENERIC_TIMEOUT));
|
||||
}
|
||||
|
||||
bool BLEConnection::_storeCccd(void)
|
||||
{
|
||||
return bond_save_cccd( _role, _conn_hdl, _ediv);
|
||||
}
|
||||
|
||||
bool BLEConnection::_loadKeys(bond_keys_t* bkeys)
|
||||
{
|
||||
return bond_load_keys(_role, _ediv, bkeys);
|
||||
}
|
||||
|
||||
bool BLEConnection::requestPairing(void)
|
||||
{
|
||||
// skip if already paired
|
||||
|
||||
@@ -53,6 +53,7 @@ class BLEConnection
|
||||
SemaphoreHandle_t _hvn_sem;
|
||||
SemaphoreHandle_t _wrcmd_sem;
|
||||
|
||||
uint16_t _ediv;
|
||||
bool _paired;
|
||||
bool _hvc_received;
|
||||
|
||||
@@ -63,9 +64,6 @@ class BLEConnection
|
||||
bond_keys_t* _bond_keys; // Shared keys with bonded device, size ~ 80 bytes
|
||||
|
||||
public:
|
||||
|
||||
uint16_t _ediv;
|
||||
|
||||
BLEConnection(uint16_t conn_hdl, ble_gap_evt_connected_t const * evt_connected, uint8_t hvn_qsize, uint8_t wrcmd_qsize);
|
||||
virtual ~BLEConnection();
|
||||
|
||||
@@ -85,11 +83,15 @@ class BLEConnection
|
||||
bool requestPairing(void);
|
||||
bool waitForIndicateConfirm(void);
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* INTERNAL USAGE ONLY
|
||||
* Although declare as public, it is meant to be invoked by internal code.
|
||||
*------------------------------------------------------------------*/
|
||||
void _eventHandler(ble_evt_t* evt);
|
||||
|
||||
bool _storeCccd(void);
|
||||
bool _loadKeys(bond_keys_t* bkeys);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -137,9 +137,9 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
|
||||
chr->_eventHandler(evt);
|
||||
|
||||
// Save CCCD if paired
|
||||
if ( Bluefruit.connPaired() && (evt_id == BLE_GATTS_EVT_WRITE) && (req_handle == chr->handles().cccd_handle) )
|
||||
if ( conn->paired() && (evt_id == BLE_GATTS_EVT_WRITE) && (req_handle == chr->handles().cccd_handle) )
|
||||
{
|
||||
bond_save_cccd( Bluefruit.Gap.getRole(evt_conn_hdl), evt_conn_hdl, conn->_ediv);
|
||||
conn->_storeCccd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ static void bledfu_control_wr_authorize_cb(BLECharacteristic& chr, ble_gatts_evt
|
||||
{
|
||||
bond_keys_t bkeys;
|
||||
|
||||
if ( bond_load_keys( BLE_GAP_ROLE_PERIPH, Bluefruit.Gap.getConnection(conn_hdl)->_ediv, &bkeys ) )
|
||||
if ( conn->_loadKeys(&bkeys) )
|
||||
{
|
||||
peer_data->addr = bkeys.peer_id.id_addr_info;
|
||||
peer_data->irk = bkeys.peer_id.id_info;
|
||||
|
||||
Reference in new issue
Block a user