mirror of https://github.com/ARMmbed/mbed-os.git
BLE - Cleanup conditional directives in gap/Gap/
- Remove directives from event handler type - Expose privacy default configuration unconditionally - Fix conditional test for connect and cancelConnect.pull/9790/head
parent
bc10a09c4e
commit
126a7a966e
|
@ -285,7 +285,6 @@ public:
|
||||||
* Definition of the general handler of Gap related events.
|
* Definition of the general handler of Gap related events.
|
||||||
*/
|
*/
|
||||||
struct EventHandler {
|
struct EventHandler {
|
||||||
#if BLE_ROLE_BROADCASTER
|
|
||||||
/**
|
/**
|
||||||
* Called when an advertising device receive a scan response.
|
* Called when an advertising device receive a scan response.
|
||||||
*
|
*
|
||||||
|
@ -314,8 +313,7 @@ public:
|
||||||
virtual void onAdvertisingEnd(const AdvertisingEndEvent &event)
|
virtual void onAdvertisingEnd(const AdvertisingEndEvent &event)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // BLE_ROLE_BROADCASTER
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
/**
|
/**
|
||||||
* Called when a scanner receives an advertising or a scan response packet.
|
* Called when a scanner receives an advertising or a scan response packet.
|
||||||
*
|
*
|
||||||
|
@ -337,10 +335,7 @@ public:
|
||||||
virtual void onScanTimeout(const ScanTimeoutEvent &event)
|
virtual void onScanTimeout(const ScanTimeoutEvent &event)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
#if BLE_FEATURE_PERIODIC_ADVERTISING
|
|
||||||
/**
|
/**
|
||||||
* Called when first advertising packet in periodic advertising is received.
|
* Called when first advertising packet in periodic advertising is received.
|
||||||
*
|
*
|
||||||
|
@ -385,10 +380,7 @@ public:
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
|
||||||
|
|
||||||
#if BLE_FEATURE_CONNECTABLE
|
|
||||||
/**
|
/**
|
||||||
* Called when connection attempt ends or an advertising device has been
|
* Called when connection attempt ends or an advertising device has been
|
||||||
* connected.
|
* connected.
|
||||||
|
@ -449,8 +441,7 @@ public:
|
||||||
virtual void onDisconnectionComplete(const DisconnectionCompleteEvent &event)
|
virtual void onDisconnectionComplete(const DisconnectionCompleteEvent &event)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // BLE_FEATURE_CONNECTABLE
|
|
||||||
#if BLE_FEATURE_PHY_MANAGEMENT
|
|
||||||
/**
|
/**
|
||||||
* Function invoked when the current transmitter and receiver PHY have
|
* Function invoked when the current transmitter and receiver PHY have
|
||||||
* been read for a given connection.
|
* been read for a given connection.
|
||||||
|
@ -511,7 +502,6 @@ public:
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function invoked when the connections changes the maximum number of octets
|
* Function invoked when the connections changes the maximum number of octets
|
||||||
|
@ -919,7 +909,6 @@ public:
|
||||||
#endif // BLE_ROLE_OBSERVER
|
#endif // BLE_ROLE_OBSERVER
|
||||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||||
|
|
||||||
#if BLE_FEATURE_CONNECTABLE
|
|
||||||
#if BLE_ROLE_CENTRAL
|
#if BLE_ROLE_CENTRAL
|
||||||
/**
|
/**
|
||||||
* Initiate a connection to a peer.
|
* Initiate a connection to a peer.
|
||||||
|
@ -955,6 +944,7 @@ public:
|
||||||
ble_error_t cancelConnect();
|
ble_error_t cancelConnect();
|
||||||
#endif // BLE_ROLE_CENTRAL
|
#endif // BLE_ROLE_CENTRAL
|
||||||
|
|
||||||
|
#if BLE_FEATURE_CONNECTABLE
|
||||||
/**
|
/**
|
||||||
* Update connection parameters of an existing connection.
|
* Update connection parameters of an existing connection.
|
||||||
*
|
*
|
||||||
|
@ -1166,6 +1156,19 @@ public:
|
||||||
);
|
);
|
||||||
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default peripheral privacy configuration.
|
||||||
|
*/
|
||||||
|
static const peripheral_privacy_configuration_t
|
||||||
|
default_peripheral_privacy_configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default peripheral privacy configuration.
|
||||||
|
*/
|
||||||
|
static const central_privay_configuration_t
|
||||||
|
default_central_privacy_configuration;
|
||||||
|
|
||||||
|
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
/**
|
/**
|
||||||
* Enable or disable privacy mode of the local device.
|
* Enable or disable privacy mode of the local device.
|
||||||
|
@ -1203,12 +1206,6 @@ public:
|
||||||
ble_error_t enablePrivacy(bool enable);
|
ble_error_t enablePrivacy(bool enable);
|
||||||
|
|
||||||
#if BLE_ROLE_BROADCASTER
|
#if BLE_ROLE_BROADCASTER
|
||||||
/**
|
|
||||||
* Default peripheral privacy configuration.
|
|
||||||
*/
|
|
||||||
static const peripheral_privacy_configuration_t
|
|
||||||
default_peripheral_privacy_configuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the privacy configuration used by the peripheral role.
|
* Set the privacy configuration used by the peripheral role.
|
||||||
*
|
*
|
||||||
|
@ -1234,12 +1231,6 @@ public:
|
||||||
#endif // BLE_ROLE_BROADCASTER
|
#endif // BLE_ROLE_BROADCASTER
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
#if BLE_ROLE_OBSERVER
|
||||||
/**
|
|
||||||
* Default peripheral privacy configuration.
|
|
||||||
*/
|
|
||||||
static const central_privay_configuration_t
|
|
||||||
default_central_privacy_configuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the privacy configuration used by the central role.
|
* Set the privacy configuration used by the central role.
|
||||||
*
|
*
|
||||||
|
@ -1418,13 +1409,14 @@ protected:
|
||||||
);
|
);
|
||||||
void useVersionOneAPI_() const;
|
void useVersionOneAPI_() const;
|
||||||
void useVersionTwoAPI_() const;
|
void useVersionTwoAPI_() const;
|
||||||
#endif // !defined(DOXYGEN_ONLY)
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Event handler provided by the application.
|
* Event handler provided by the application.
|
||||||
*/
|
*/
|
||||||
EventHandler *_eventHandler;
|
EventHandler *_eventHandler;
|
||||||
|
|
||||||
|
#endif // !defined(DOXYGEN_ONLY)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -266,7 +266,7 @@ uint8_t Gap<Impl>::getMaxPeriodicAdvertiserListSize()
|
||||||
}
|
}
|
||||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||||
|
|
||||||
#if BLE_FEATURE_CONNECTABLE
|
#if BLE_ROLE_CENTRAL
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
ble_error_t Gap<Impl>::connect(
|
ble_error_t Gap<Impl>::connect(
|
||||||
peer_address_type_t peerAddressType,
|
peer_address_type_t peerAddressType,
|
||||||
|
@ -286,7 +286,9 @@ ble_error_t Gap<Impl>::cancelConnect()
|
||||||
{
|
{
|
||||||
return impl()->cancelConnect_();
|
return impl()->cancelConnect_();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BLE_FEATURE_CONNECTABLE
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
ble_error_t Gap<Impl>::updateConnectionParameters(
|
ble_error_t Gap<Impl>::updateConnectionParameters(
|
||||||
connection_handle_t connectionHandle,
|
connection_handle_t connectionHandle,
|
||||||
|
@ -388,6 +390,7 @@ ble_error_t Gap<Impl>::setPhy(
|
||||||
codedSymbol
|
codedSymbol
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
void Gap<Impl>::useVersionOneAPI() const
|
void Gap<Impl>::useVersionOneAPI() const
|
||||||
|
@ -405,26 +408,21 @@ template<class Impl>
|
||||||
Gap<Impl>::Gap() : _eventHandler(NULL)
|
Gap<Impl>::Gap() : _eventHandler(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
|
||||||
|
|
||||||
/* -------------------- Future deprecation ------------------------- */
|
/* -------------------- Future deprecation ------------------------- */
|
||||||
|
|
||||||
#if BLE_FEATURE_PRIVACY
|
|
||||||
#if BLE_ROLE_BROADCASTER
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
const peripheral_privacy_configuration_t Gap<Impl>::default_peripheral_privacy_configuration = {
|
const peripheral_privacy_configuration_t Gap<Impl>::default_peripheral_privacy_configuration = {
|
||||||
/* use_non_resolvable_random_address */ false,
|
/* use_non_resolvable_random_address */ false,
|
||||||
/* resolution_strategy */ peripheral_privacy_configuration_t::PERFORM_PAIRING_PROCEDURE
|
/* resolution_strategy */ peripheral_privacy_configuration_t::PERFORM_PAIRING_PROCEDURE
|
||||||
};
|
};
|
||||||
#endif // BLE_ROLE_BROADCASTER
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
const central_privay_configuration_t Gap<Impl>::default_central_privacy_configuration = {
|
const central_privay_configuration_t Gap<Impl>::default_central_privacy_configuration = {
|
||||||
/* use_non_resolvable_random_address */ false,
|
/* use_non_resolvable_random_address */ false,
|
||||||
/* resolution_strategy */ central_privay_configuration_t::RESOLVE_AND_FORWARD
|
/* resolution_strategy */ central_privay_configuration_t::RESOLVE_AND_FORWARD
|
||||||
};
|
};
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
#endif // BLE_FEATURE_PRIVACY
|
|
||||||
|
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
|
|
Loading…
Reference in New Issue