@@ -929,9 +929,11 @@ ble_error_t Gap::enablePrivacy(bool enable)
929
929
_address_registry.stop_private_address_generation ();
930
930
}
931
931
932
+ #if !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
932
933
if (_address_registry.is_controller_privacy_supported ()) {
933
934
update_ll_address_resolution_setting ();
934
935
}
936
+ #endif // !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
935
937
936
938
return BLE_ERROR_NONE;
937
939
}
@@ -946,9 +948,11 @@ ble_error_t Gap::setPeripheralPrivacyConfiguration(
946
948
{
947
949
_peripheral_privacy_configuration = *configuration;
948
950
951
+ #if !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
949
952
if (_address_registry.is_controller_privacy_supported ()) {
950
953
update_ll_address_resolution_setting ();
951
954
}
955
+ #endif // !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
952
956
953
957
return BLE_ERROR_NONE;
954
958
}
@@ -978,9 +982,11 @@ ble_error_t Gap::setCentralPrivacyConfiguration(
978
982
{
979
983
_central_privacy_configuration = *configuration;
980
984
985
+ #if !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
981
986
if (_address_registry.is_controller_privacy_supported ()) {
982
987
update_ll_address_resolution_setting ();
983
988
}
989
+ #endif // !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
984
990
985
991
return BLE_ERROR_NONE;
986
992
}
@@ -1474,7 +1480,7 @@ bool Gap::initialize_whitelist() const
1474
1480
return true ;
1475
1481
}
1476
1482
1477
-
1483
+ # if BLE_FEATURE_PRIVACY && !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1478
1484
ble_error_t Gap::update_ll_address_resolution_setting ()
1479
1485
{
1480
1486
// enable if privacy is enabled and resolution is requested in either central or peripheral mode
@@ -1496,6 +1502,7 @@ ble_error_t Gap::update_ll_address_resolution_setting()
1496
1502
1497
1503
return _address_registry.enable_controller_address_resolution (enable);
1498
1504
}
1505
+ #endif // BLE_FEATURE_PRIVACY && !BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
1499
1506
1500
1507
#if BLE_ROLE_BROADCASTER
1501
1508
uint8_t Gap::getMaxAdvertisingSetNumber ()
@@ -2314,12 +2321,11 @@ void Gap::signal_connection_complete(
2314
2321
ConnectionCompleteEvent& event
2315
2322
)
2316
2323
{
2317
- #if BLE_FEATURE_PRIVACY
2324
+ #if BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2318
2325
bool address_resolved = false ;
2319
2326
2320
2327
/* if address resolution is not needed or already handled then the address is already resolved */
2321
2328
if (!_privacy_enabled ||
2322
- _address_registry.is_controller_privacy_supported () ||
2323
2329
event.getPeerAddressType () == peer_address_type_t ::PUBLIC ||
2324
2330
!is_random_private_resolvable_address (event.getPeerAddress ())) {
2325
2331
address_resolved = true ;
@@ -2330,7 +2336,7 @@ void Gap::signal_connection_complete(
2330
2336
address_resolved = true ;
2331
2337
}
2332
2338
}
2333
- #endif
2339
+ #endif // BLE_ROLE_CENTRAL
2334
2340
2335
2341
#if BLE_ROLE_PERIPHERAL
2336
2342
if (event.getOwnRole () == connection_role_t ::PERIPHERAL) {
@@ -2347,7 +2353,7 @@ void Gap::signal_connection_complete(
2347
2353
2348
2354
/* first try to resolve synchronously in cache */
2349
2355
if (!address_resolved) {
2350
- address_resolved = _address_registry.resolve_address_in_cache (
2356
+ address_resolved = _address_registry.resolve_address_in_host_cache (
2351
2357
event.getPeerAddress (),
2352
2358
&peer_address_type,
2353
2359
&peer_address
@@ -2372,7 +2378,7 @@ void Gap::signal_connection_complete(
2372
2378
_event_handler->onConnectionComplete (event);
2373
2379
} else {
2374
2380
bool resolution_pending = false ;
2375
- ble_error_t ret = _address_registry.queue_resolve_address (event.getPeerAddress ());
2381
+ ble_error_t ret = _address_registry.queue_resolve_address_on_host (event.getPeerAddress ());
2376
2382
2377
2383
if (ret == BLE_ERROR_NONE) {
2378
2384
ConnectionCompleteEvent* event_copy = new (std::nothrow) ConnectionCompleteEvent (event);
@@ -2397,11 +2403,10 @@ void Gap::signal_connection_complete(
2397
2403
#else
2398
2404
report_internal_connection_complete (event);
2399
2405
_event_handler->onConnectionComplete (event);
2400
- #endif // BLE_FEATURE_PRIVACY
2406
+ #endif // BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2401
2407
}
2402
2408
2403
2409
#if BLE_FEATURE_PRIVACY
2404
-
2405
2410
bool Gap::apply_peripheral_privacy_connection_policy (
2406
2411
const ConnectionCompleteEvent &event
2407
2412
)
@@ -2451,8 +2456,9 @@ bool Gap::apply_peripheral_privacy_connection_policy(
2451
2456
return true ;
2452
2457
#endif
2453
2458
}
2459
+ #endif // BLE_FEATURE_PRIVACY
2454
2460
2455
-
2461
+ # if BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2456
2462
void Gap::conclude_signal_connection_complete_after_address_resolution (
2457
2463
ConnectionCompleteEvent &event,
2458
2464
target_peer_address_type_t identity_address_type,
@@ -2478,21 +2484,20 @@ void Gap::conclude_signal_connection_complete_after_address_resolution(
2478
2484
report_internal_connection_complete (event);
2479
2485
_event_handler->onConnectionComplete (event);
2480
2486
}
2481
- #endif // BLE_FEATURE_PRIVACY
2487
+ #endif // BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2482
2488
#endif // BLE_FEATURE_CONNECTABLE
2483
2489
2484
2490
#if BLE_ROLE_OBSERVER
2485
2491
void Gap::signal_advertising_report (
2486
2492
AdvertisingReportEvent& event
2487
2493
)
2488
2494
{
2489
- #if BLE_FEATURE_PRIVACY
2495
+ #if BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2490
2496
bool address_resolved = false ;
2491
2497
2492
2498
/* if address resolution is not needed or already handled then the address is already resolved */
2493
2499
if (!_privacy_enabled ||
2494
2500
_central_privacy_configuration.resolution_strategy == central_privacy_configuration_t ::DO_NOT_RESOLVE ||
2495
- _address_registry.is_controller_privacy_supported () ||
2496
2501
event.getPeerAddressType () == peer_address_type_t ::PUBLIC ||
2497
2502
!is_random_private_resolvable_address (event.getPeerAddress ())) {
2498
2503
address_resolved = true ;
@@ -2503,7 +2508,7 @@ void Gap::signal_advertising_report(
2503
2508
const address_t *peer_address = nullptr ;
2504
2509
target_peer_address_type_t peer_address_type (target_peer_address_type_t ::RANDOM);
2505
2510
2506
- address_resolved = _address_registry.resolve_address_in_cache (
2511
+ address_resolved = _address_registry.resolve_address_in_host_cache (
2507
2512
event.getPeerAddress (),
2508
2513
&peer_address_type,
2509
2514
&peer_address
@@ -2536,7 +2541,7 @@ void Gap::signal_advertising_report(
2536
2541
2537
2542
/* if there is already an item with the same address pending don't kick off resolution*/
2538
2543
if (!duplicate_pending_event) {
2539
- ret = _address_registry.queue_resolve_address (event.getPeerAddress ());
2544
+ ret = _address_registry.queue_resolve_address_on_host (event.getPeerAddress ());
2540
2545
}
2541
2546
2542
2547
if (ret == BLE_ERROR_NONE) {
@@ -2553,11 +2558,11 @@ void Gap::signal_advertising_report(
2553
2558
_event_handler->onAdvertisingReport (
2554
2559
event
2555
2560
);
2556
- #endif // BLE_FEATURE_PRIVACY
2561
+ #endif // BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2557
2562
}
2558
2563
#endif // BLE_ROLE_OBSERVER
2559
2564
2560
- #if BLE_FEATURE_PRIVACY
2565
+ #if BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2561
2566
#if BLE_ROLE_OBSERVER
2562
2567
void Gap::conclude_signal_advertising_report_after_address_resolution (
2563
2568
AdvertisingReportEvent &event,
@@ -2581,7 +2586,7 @@ void Gap::conclude_signal_advertising_report_after_address_resolution(
2581
2586
_event_handler->onAdvertisingReport (event);
2582
2587
}
2583
2588
#endif // BLE_ROLE_OBSERVER
2584
- #endif // BLE_FEATURE_PRIVACY
2589
+ #endif // BLE_FEATURE_PRIVACY && BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
2585
2590
2586
2591
void Gap::on_periodic_advertising_sync_established (
2587
2592
hci_error_code_t error,
@@ -3179,15 +3184,15 @@ void Gap::on_private_address_generated(bool connectable)
3179
3184
}
3180
3185
}
3181
3186
3182
-
3187
+ #if BLE_FEATURE_PRIVACY
3188
+ #if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
3183
3189
void Gap::on_address_resolution_completed (
3184
3190
const address_t &peer_resolvable_address,
3185
3191
bool resolved,
3186
3192
target_peer_address_type_t identity_address_type,
3187
3193
const address_t &identity_address
3188
3194
)
3189
3195
{
3190
- #if BLE_FEATURE_PRIVACY
3191
3196
if (!_event_handler || !_privacy_enabled) {
3192
3197
return ;
3193
3198
}
@@ -3237,9 +3242,9 @@ void Gap::on_address_resolution_completed(
3237
3242
delete event;
3238
3243
}
3239
3244
#endif // BLE_ROLE_OBSERVER
3240
- #endif // BLE_FEATURE_PRIVACY
3241
3245
}
3242
-
3246
+ #endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
3247
+ #endif // BLE_FEATURE_PRIVACY
3243
3248
3244
3249
bool Gap::is_advertising () const
3245
3250
{
@@ -3297,7 +3302,7 @@ const address_t *Gap::get_random_address(controller_operation_t operation, size_
3297
3302
#if BLE_FEATURE_EXTENDED_ADVERTISING
3298
3303
if (is_extended_advertising_available ()) {
3299
3304
if (operation == controller_operation_t ::advertising) {
3300
- if (_set_is_connectable.get (set_id) == false && peripheral_non_resolvable) {
3305
+ if (! _set_is_connectable.get (set_id) && peripheral_non_resolvable) {
3301
3306
return &non_resolvable_address;
3302
3307
} else {
3303
3308
return &resolvable_address;
0 commit comments