@@ -65,7 +65,7 @@ static void swap_endian(uint8_t data[], uint32_t nbytes)
6565 }
6666}
6767
68- static void _passkey_display_cabllack_dfr (BLEPairing ::pair_passkey_cb_t func, uint16_t conn_hdl, uint8_t const passkey[6 ], bool match_request)
68+ static void _passkey_display_cabllack_dfr (BLESecurity ::pair_passkey_cb_t func, uint16_t conn_hdl, uint8_t const passkey[6 ], bool match_request)
6969{
7070 bool matched = func (conn_hdl, passkey, match_request);
7171
@@ -76,15 +76,15 @@ static void _passkey_display_cabllack_dfr(BLEPairing::pair_passkey_cb_t func, ui
7676 }
7777}
7878
79- BLEPairing::BLEPairing (void )
79+ BLESecurity::BLESecurity (void )
8080{
8181 _sec_param = _sec_param_default;
8282 _passkey_cb = NULL ;
8383 _complete_cb = NULL ;
8484 _secured_cb = NULL ;
8585}
8686
87- bool BLEPairing ::begin (void )
87+ bool BLESecurity ::begin (void )
8888{
8989#ifdef NRF_CRYPTOCELL
9090 // Initalize Crypto lib for LESC (safe to call multiple times)
@@ -113,7 +113,7 @@ bool BLEPairing::begin(void)
113113 return true ;
114114}
115115
116- void BLEPairing ::setIOCaps (bool display, bool yes_no, bool keyboard)
116+ void BLESecurity ::setIOCaps (bool display, bool yes_no, bool keyboard)
117117{
118118 uint8_t io_caps = BLE_GAP_IO_CAPS_NONE;
119119
@@ -138,7 +138,7 @@ void BLEPairing::setIOCaps(bool display, bool yes_no, bool keyboard)
138138 _sec_param.io_caps = io_caps;
139139}
140140
141- void BLEPairing ::setMITM (bool enabled)
141+ void BLESecurity ::setMITM (bool enabled)
142142{
143143 _sec_param.mitm = (enabled ? 1 : 0 );
144144}
@@ -149,7 +149,7 @@ void BLEPairing::setMITM(bool enabled)
149149 *
150150 * To check if it matches we recreate local AES Hash with IRK to compare with
151151*/
152- bool BLEPairing ::resolveAddress (ble_gap_addr_t const * p_addr, ble_gap_irk_t const * irk)
152+ bool BLESecurity ::resolveAddress (ble_gap_addr_t const * p_addr, ble_gap_irk_t const * irk)
153153{
154154 VERIFY (p_addr->addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE);
155155
@@ -177,7 +177,7 @@ bool BLEPairing::resolveAddress(ble_gap_addr_t const * p_addr, ble_gap_irk_t con
177177}
178178
179179// Use Legacy SC static Passkey
180- bool BLEPairing ::setPIN (const char * pin)
180+ bool BLESecurity ::setPIN (const char * pin)
181181{
182182 VERIFY (pin && strlen (pin) == BLE_GAP_PASSKEY_LEN);
183183
@@ -197,7 +197,7 @@ bool BLEPairing::setPIN(const char* pin)
197197}
198198
199199// Pairing using LESC with peripheral display
200- bool BLEPairing ::setPasskeyCallback (pair_passkey_cb_t fp)
200+ bool BLESecurity ::setPasskeyCallback (pair_passkey_cb_t fp)
201201{
202202 _passkey_cb = fp;
203203
@@ -207,23 +207,23 @@ bool BLEPairing::setPasskeyCallback(pair_passkey_cb_t fp)
207207 return true ;
208208}
209209
210- void BLEPairing ::setCompleteCallback (pair_complete_cb_t fp)
210+ void BLESecurity ::setCompleteCallback (pair_complete_cb_t fp)
211211{
212212 _complete_cb = fp;
213213}
214214
215- void BLEPairing ::setSecuredCallback (pair_secured_cb_t fp)
215+ void BLESecurity ::setSecuredCallback (pair_secured_cb_t fp)
216216{
217217 _secured_cb = fp;
218218}
219219
220- bool BLEPairing ::_authenticate (uint16_t conn_hdl)
220+ bool BLESecurity ::_authenticate (uint16_t conn_hdl)
221221{
222222 VERIFY_STATUS (sd_ble_gap_authenticate (conn_hdl, &_sec_param ), false );
223223 return true ;
224224}
225225
226- bool BLEPairing ::_encrypt (uint16_t conn_hdl, bond_keys_t const * ltkey)
226+ bool BLESecurity ::_encrypt (uint16_t conn_hdl, bond_keys_t const * ltkey)
227227{
228228 // LESC use own key, Legacy use peer key
229229 ble_gap_enc_key_t const * enc_key = ltkey->own_enc .enc_info .lesc ? <key->own_enc : <key->peer_enc ;
@@ -249,7 +249,7 @@ bool BLEPairing::_encrypt(uint16_t conn_hdl, bond_keys_t const* ltkey)
249249 * 3. Connection is secured BLE_GAP_EVT_CONN_SEC_UPDATE
250250 */
251251// --------------------------------------------------------------------+
252- void BLEPairing ::_eventHandler (ble_evt_t * evt)
252+ void BLESecurity ::_eventHandler (ble_evt_t * evt)
253253{
254254 uint16_t const conn_hdl = evt->evt .common_evt .conn_handle ;
255255 BLEConnection* conn = Bluefruit.Connection (conn_hdl);
0 commit comments