File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
libraries/Bluefruit52Lib/src Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -133,12 +133,22 @@ void BLECentral::_eventHandler(ble_evt_t* evt)
133
133
{
134
134
// conn handle has fixed offset regardless of event type
135
135
const uint16_t conn_hdl = evt->evt .common_evt .conn_handle ;
136
+ BLEConnection* conn = Bluefruit.Connection (conn_hdl);
136
137
137
138
/* PrPh handle connection is already filtered. Only handle Central events or
138
139
* connection handle is BLE_CONN_HANDLE_INVALID (e.g BLE_GAP_EVT_ADV_REPORT) */
139
140
switch ( evt->header .evt_id )
140
141
{
141
142
case BLE_GAP_EVT_CONNECTED:
143
+ {
144
+ // Try to secure connection if we bonded previously
145
+ static bond_keys_t ltkey;
146
+ if ( conn->loadLongTermKey (<key) )
147
+ {
148
+ BLEPairing* secure = &Bluefruit.Pairing ;
149
+ secure->_encrypt (conn_hdl, <key);
150
+ }
151
+ }
142
152
break ;
143
153
144
154
case BLE_GAP_EVT_DISCONNECTED:
You can’t perform that action at this time.
0 commit comments