Skip to content

Commit 393ee6c

Browse files
committed
renamed bonded to paired
1 parent a05d467 commit 393ee6c

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

libraries/Bluefruit52Lib/src/BLEGap.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,28 +159,30 @@ bool BLEGap::connected(uint16_t conn_hdl)
159159
return _peers[conn_hdl].connected;
160160
}
161161

162-
bool BLEGap::bonded(uint16_t conn_hdl)
162+
bool BLEGap::paired(uint16_t conn_hdl)
163163
{
164-
return _peers[conn_hdl].bonded;
164+
return _peers[conn_hdl].paired;
165165
}
166166

167167
bool BLEGap::requestPairing(uint16_t conn_hdl)
168168
{
169169
gap_peer_t* peer = &_peers[conn_hdl];
170170

171171
// skip if already bonded
172-
if ( peer->bonded ) return true;
172+
if ( peer->paired ) return true;
173+
174+
173175

174176
VERIFY_STATUS( sd_ble_gap_authenticate(conn_hdl, &_sec_param ), false);
175177
uint32_t start = millis();
176178

177179
// timeout in 30 seconds
178-
while ( ! ((volatile bool) peer->bonded) && (start + 30000 > millis()) )
180+
while ( ! ((volatile bool) peer->paired) && (start + 30000 > millis()) )
179181
{
180182
yield();
181183
}
182184

183-
return peer->bonded;
185+
return peer->paired;
184186
}
185187

186188
uint8_t BLEGap::getRole(uint16_t conn_hdl)
@@ -266,7 +268,7 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
266268
ble_gap_evt_disconnected_t const* para = &evt->evt.gap_evt.params.disconnected;
267269

268270
// mark as disconnected, but keep the role for sub sequence event handler
269-
peer->connected = peer->bonded = false;
271+
peer->connected = peer->paired = false;
270272

271273
vSemaphoreDelete( peer->hvn_tx_sem );
272274
peer->hvn_tx_sem = NULL;
@@ -334,7 +336,7 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
334336
// Pairing succeeded --> save encryption keys ( Bonding )
335337
if (BLE_GAP_SEC_STATUS_SUCCESS == status->auth_status)
336338
{
337-
peer->bonded = true;
339+
peer->paired = true;
338340
peer->ediv = peer->bond_data->own_enc.master_id.ediv;
339341

340342
bond_save_keys(peer->role, conn_hdl, peer->bond_data);
@@ -378,7 +380,7 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
378380
bond_load_cccd(peer->role, conn_hdl, peer->ediv);
379381

380382
// Paired is Bonded (as we always save keys)
381-
peer->bonded = true;
383+
peer->paired = true;
382384
break;
383385

384386
case BLE_GAP_EVT_PASSKEY_DISPLAY:

libraries/Bluefruit52Lib/src/BLEGap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class BLEGap
6060
// bool setPrivacy (); sd_ble_gap_privacy_set()
6161

6262
bool connected (uint16_t conn_hdl);
63-
bool bonded (uint16_t conn_hdl);
63+
bool paired (uint16_t conn_hdl);
6464
bool requestPairing (uint16_t conn_hdl);
6565

6666
uint8_t getRole (uint16_t conn_hdl);
@@ -93,7 +93,7 @@ class BLEGap
9393
// Peer info where conn_hdl serves as index
9494
typedef struct {
9595
bool connected;
96-
bool bonded;
96+
bool paired;
9797
uint8_t role;
9898
uint16_t att_mtu;
9999

libraries/Bluefruit52Lib/src/bluefruit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ uint16_t AdafruitBluefruit::connHandle(void)
578578

579579
bool AdafruitBluefruit::connPaired(void)
580580
{
581-
return Gap.bonded(_conn_hdl);
581+
return Gap.paired(_conn_hdl);
582582
}
583583

584584
uint16_t AdafruitBluefruit::connInterval(void)

libraries/Bluefruit52Lib/src/services/BLEDfu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static void bledfu_control_wr_authorize_cb(BLECharacteristic& chr, ble_gatts_evt
135135
// Get Bond Data or using Address if not bonded
136136
peer_data->addr = Bluefruit.Gap.getPeerAddr(conn_hdl);
137137

138-
if ( Bluefruit.Gap.bonded(conn_hdl) )
138+
if ( Bluefruit.Gap.paired(conn_hdl) )
139139
{
140140
bond_data_t bdata;
141141

0 commit comments

Comments
 (0)