|
23 | 23 | #include "ble/BLEProtocol.h"
|
24 | 24 | #include "ble/Gap.h"
|
25 | 25 | #include "ble/pal/PalGap.h"
|
| 26 | +#include "ble/pal/PalSecurityManager.h" |
26 | 27 | #include "ble/pal/GapEvents.h"
|
27 | 28 | #include "ble/pal/GapTypes.h"
|
28 | 29 | #include "ble/BLETypes.h"
|
@@ -55,11 +56,15 @@ class GenericGap : public ::Gap,
|
55 | 56 | *
|
56 | 57 | * @param generic_access_service Platform abstraction instance managing
|
57 | 58 | * the GATT generic access service.
|
| 59 | + * |
| 60 | + * @param pal_sm Security Manager Platform abstraction instance containing the base |
| 61 | + * Security Manager primitives. |
58 | 62 | */
|
59 | 63 | GenericGap(
|
60 | 64 | pal::EventQueue &event_queue,
|
61 | 65 | pal::Gap &pal_gap,
|
62 |
| - pal::GenericAccessService &generic_access_service |
| 66 | + pal::GenericAccessService &generic_access_service, |
| 67 | + pal::SecurityManager &pal_sm |
63 | 68 | );
|
64 | 69 |
|
65 | 70 | /**
|
@@ -233,6 +238,39 @@ class GenericGap : public ::Gap,
|
233 | 238 | */
|
234 | 239 | virtual ble_error_t initRadioNotification(void);
|
235 | 240 |
|
| 241 | + /** |
| 242 | + * @see Gap::enablePrivacy |
| 243 | + */ |
| 244 | + virtual ble_error_t enablePrivacy(bool enable); |
| 245 | + |
| 246 | + /** |
| 247 | + * @see Gap::setPeripheralPrivacyConfiguration |
| 248 | + */ |
| 249 | + virtual ble_error_t setPeripheralPrivacyConfiguration( |
| 250 | + const PeripheralPrivacyConfiguration_t *configuration |
| 251 | + ); |
| 252 | + |
| 253 | + /** |
| 254 | + * @see Gap::getPeripheralPrivacyConfiguration |
| 255 | + */ |
| 256 | + virtual ble_error_t getPeripheralPrivacyConfiguration( |
| 257 | + PeripheralPrivacyConfiguration_t *configuration |
| 258 | + ); |
| 259 | + |
| 260 | + /** |
| 261 | + * @see Gap::setCentralPrivacyConfiguration |
| 262 | + */ |
| 263 | + virtual ble_error_t setCentralPrivacyConfiguration( |
| 264 | + const CentralPrivacyConfiguration_t *configuration |
| 265 | + ); |
| 266 | + |
| 267 | + /** |
| 268 | + * @see Gap::getCentralPrivacyConfiguration |
| 269 | + */ |
| 270 | + virtual ble_error_t getCentralPrivacyConfiguration( |
| 271 | + CentralPrivacyConfiguration_t *configuration |
| 272 | + ); |
| 273 | + |
236 | 274 | /**
|
237 | 275 | * @see Gap::setAdvertisingData
|
238 | 276 | */
|
@@ -302,21 +340,45 @@ class GenericGap : public ::Gap,
|
302 | 340 |
|
303 | 341 | void on_unexpected_error(const pal::GapUnexpectedErrorEvent &e);
|
304 | 342 |
|
305 |
| - pal::own_address_type_t get_own_address_type(); |
| 343 | + enum AddressUseType_t { |
| 344 | + CENTRAL_CONNECTION, |
| 345 | + CENTRAL_SCAN, |
| 346 | + PERIPHERAL_CONNECTABLE, |
| 347 | + PERIPHERAL_NON_CONNECTABLE |
| 348 | + }; |
| 349 | + |
| 350 | + pal::own_address_type_t get_own_address_type(AddressUseType_t address_use_type); |
306 | 351 |
|
307 | 352 | bool initialize_whitelist() const;
|
308 | 353 |
|
| 354 | + ble_error_t update_address_resolution_setting(); |
| 355 | + |
| 356 | + void set_random_address_rotation(bool enable); |
| 357 | + |
| 358 | + void update_random_address(); |
| 359 | + |
| 360 | + void on_address_rotation_timeout(); |
| 361 | + |
309 | 362 | pal::EventQueue& _event_queue;
|
310 | 363 | pal::Gap &_pal_gap;
|
311 | 364 | pal::GenericAccessService &_gap_service;
|
| 365 | + pal::SecurityManager &_pal_sm; |
312 | 366 | BLEProtocol::AddressType_t _address_type;
|
313 | 367 | ble::address_t _address;
|
314 | 368 | pal::initiator_policy_t _initiator_policy_mode;
|
315 | 369 | pal::scanning_filter_policy_t _scanning_filter_policy;
|
316 | 370 | pal::advertising_filter_policy_t _advertising_filter_policy;
|
317 | 371 | mutable Whitelist_t _whitelist;
|
| 372 | + |
| 373 | + bool _privacy_enabled; |
| 374 | + PeripheralPrivacyConfiguration_t _peripheral_privacy_configuration; |
| 375 | + CentralPrivacyConfiguration_t _central_privacy_configuration; |
| 376 | + ble::address_t _random_static_identity_address; |
| 377 | + bool _random_address_rotating; |
| 378 | + |
318 | 379 | mbed::Timeout _advertising_timeout;
|
319 | 380 | mbed::Timeout _scan_timeout;
|
| 381 | + mbed::Ticker _address_rotation_ticker; |
320 | 382 | pal::ConnectionEventMonitor::EventHandler *_connection_event_handler;
|
321 | 383 | };
|
322 | 384 |
|
|
0 commit comments