@@ -189,6 +189,30 @@ class SMDevice : private mbed::NonCopyable<SMDevice>,
189
189
printf (" Error during preserveBondingStateOnReset %d\r\n " , error);
190
190
}
191
191
192
+ #if MBED_CONF_APP_FILESYSTEM_SUPPORT
193
+ /* Enable privacy so we can find the keys */
194
+ error = _ble.gap ().enablePrivacy (true );
195
+
196
+ if (error) {
197
+ printf (" Error enabling privacy\r\n " );
198
+ }
199
+
200
+ Gap::PeripheralPrivacyConfiguration_t configuration_p = {
201
+ /* use_non_resolvable_random_address */ false ,
202
+ Gap::PeripheralPrivacyConfiguration_t::REJECT_NON_RESOLVED_ADDRESS
203
+ };
204
+ _ble.gap ().setPeripheralPrivacyConfiguration (&configuration_p);
205
+
206
+ Gap::CentralPrivacyConfiguration_t configuration_c = {
207
+ /* use_non_resolvable_random_address */ false ,
208
+ Gap::CentralPrivacyConfiguration_t::RESOLVE_AND_FORWARD
209
+ };
210
+ _ble.gap ().setCentralPrivacyConfiguration (&configuration_c);
211
+
212
+ /* this demo switches between being master and slave */
213
+ _ble.securityManager ().setHintFutureRoleReversal (true );
214
+ #endif
215
+
192
216
/* Tell the security manager to use methods in this class to inform us
193
217
* of any events. Class needs to implement SecurityManagerEventHandler. */
194
218
_ble.securityManager ().setSecurityManagerEventHandler (this );
@@ -362,9 +386,6 @@ class SMDeviceCentral : public SMDevice {
362
386
printf (" Error during Gap::startScan %d\r\n " , error);
363
387
return ;
364
388
}
365
-
366
- /* send our keys since we will be a peripheral next */
367
- _ble.securityManager ().setHintFutureRoleReversal (true );
368
389
}
369
390
370
391
/* * Look at scan payload to find a peer device and connect to it */
@@ -379,7 +400,7 @@ class SMDeviceCentral : public SMDevice {
379
400
if (memcmp (params->peerAddr , _peer_address, sizeof (_peer_address)) == 0 ) {
380
401
381
402
ble_error_t error = _ble.gap ().connect (
382
- params->peerAddr , params->addressType ,
403
+ params->peerAddr , params->peerAddrType ,
383
404
NULL , NULL
384
405
);
385
406
0 commit comments