mirror of https://github.com/ARMmbed/mbed-os.git
BLE - Devirtualize ::ble::Gap
The interface definition now lives in ::ble::interface::Gap. The implementation must export the implementation types as ::ble::impl::Gap.pull/9727/head
parent
1ad726322f
commit
43e87fb04d
|
@ -17,7 +17,7 @@
|
|||
#ifndef BLE_GAP_GAP_H
|
||||
#define BLE_GAP_GAP_H
|
||||
|
||||
|
||||
#include "ble/common/StaticInterface.h"
|
||||
#include "ble/BLETypes.h"
|
||||
#include "ble/BLEProtocol.h"
|
||||
#include "ble/gap/AdvertisingDataBuilder.h"
|
||||
|
@ -28,6 +28,9 @@
|
|||
#include "ble/gap/Events.h"
|
||||
|
||||
namespace ble {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
namespace interface {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup ble
|
||||
|
@ -267,7 +270,14 @@ namespace ble {
|
|||
* PHY and of any changes to PHYs which may be triggered autonomously by the
|
||||
* controller or by the peer.
|
||||
*/
|
||||
#if defined(DOXYGEN_ONLY)
|
||||
class Gap {
|
||||
#else
|
||||
template<class Impl>
|
||||
class Gap : public StaticInterface<Impl, Gap> {
|
||||
#endif
|
||||
using StaticInterface<Impl, ::ble::interface::Gap>::impl;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -538,7 +548,7 @@ public:
|
|||
* @param feature Feature to check.
|
||||
* @return True if feature is supported.
|
||||
*/
|
||||
virtual bool isFeatureSupported(controller_supported_features_t feature);
|
||||
bool isFeatureSupported(controller_supported_features_t feature);
|
||||
|
||||
/* advertising */
|
||||
|
||||
|
@ -550,25 +560,25 @@ public:
|
|||
*
|
||||
* @return Number of advertising sets that may be created at the same time.
|
||||
*/
|
||||
virtual uint8_t getMaxAdvertisingSetNumber();
|
||||
uint8_t getMaxAdvertisingSetNumber();
|
||||
|
||||
/** Return maximum advertising data length supported.
|
||||
*
|
||||
* @return Maximum advertising data length supported.
|
||||
*/
|
||||
virtual uint16_t getMaxAdvertisingDataLength();
|
||||
uint16_t getMaxAdvertisingDataLength();
|
||||
|
||||
/** Return maximum advertising data length supported for connectable advertising.
|
||||
*
|
||||
* @return Maximum advertising data length supported for connectable advertising.
|
||||
*/
|
||||
virtual uint16_t getMaxConnectableAdvertisingDataLength();
|
||||
uint16_t getMaxConnectableAdvertisingDataLength();
|
||||
|
||||
/** Return maximum advertising data length you may set if advertising set is active.
|
||||
*
|
||||
* @return Maximum advertising data length you may set if advertising set is active.
|
||||
*/
|
||||
virtual uint16_t getMaxActiveSetAdvertisingDataLength();
|
||||
uint16_t getMaxActiveSetAdvertisingDataLength();
|
||||
|
||||
/** Create an advertising set and apply the passed in parameters. The handle returned
|
||||
* by this function must be used for all other calls that accept an advertising handle.
|
||||
|
@ -582,7 +592,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t createAdvertisingSet(
|
||||
ble_error_t createAdvertisingSet(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
);
|
||||
|
@ -597,7 +607,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t destroyAdvertisingSet(advertising_handle_t handle);
|
||||
ble_error_t destroyAdvertisingSet(advertising_handle_t handle);
|
||||
|
||||
/** Set advertising parameters of an existing set.
|
||||
*
|
||||
|
@ -605,7 +615,7 @@ public:
|
|||
* @param params New advertising parameters.
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingParameters(
|
||||
ble_error_t setAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
);
|
||||
|
@ -623,7 +633,7 @@ public:
|
|||
*
|
||||
* @see ble::AdvertisingDataBuilder to build a payload.
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingPayload(
|
||||
ble_error_t setAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
);
|
||||
|
@ -642,7 +652,7 @@ public:
|
|||
*
|
||||
* @see ble::AdvertisingDataBuilder to build a payload.
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingScanResponse(
|
||||
ble_error_t setAdvertisingScanResponse(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
);
|
||||
|
@ -659,7 +669,7 @@ public:
|
|||
* @see EventHandler::onConnectionComplete when the device gets connected
|
||||
* by a peer.
|
||||
*/
|
||||
virtual ble_error_t startAdvertising(
|
||||
ble_error_t startAdvertising(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration = adv_duration_t::forever(),
|
||||
uint8_t maxEvents = 0
|
||||
|
@ -671,14 +681,14 @@ public:
|
|||
* @param handle Advertising set handle.
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t stopAdvertising(advertising_handle_t handle);
|
||||
ble_error_t stopAdvertising(advertising_handle_t handle);
|
||||
|
||||
/** Check if advertising is active for a given advertising set.
|
||||
*
|
||||
* @param handle Advertising set handle.
|
||||
* @return True if advertising is active on this set.
|
||||
*/
|
||||
virtual bool isAdvertisingActive(advertising_handle_t handle);
|
||||
bool isAdvertisingActive(advertising_handle_t handle);
|
||||
|
||||
/** Set periodic advertising parameters for a given advertising set.
|
||||
*
|
||||
|
@ -690,7 +700,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t setPeriodicAdvertisingParameters(
|
||||
ble_error_t setPeriodicAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
|
@ -712,7 +722,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t setPeriodicAdvertisingPayload(
|
||||
ble_error_t setPeriodicAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
);
|
||||
|
@ -725,7 +735,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t startPeriodicAdvertising(advertising_handle_t handle);
|
||||
ble_error_t startPeriodicAdvertising(advertising_handle_t handle);
|
||||
|
||||
/** Stop periodic advertising for a given set.
|
||||
*
|
||||
|
@ -734,7 +744,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t stopPeriodicAdvertising(advertising_handle_t handle);
|
||||
ble_error_t stopPeriodicAdvertising(advertising_handle_t handle);
|
||||
|
||||
/** Check if periodic advertising is active for a given advertising set.
|
||||
*
|
||||
|
@ -743,7 +753,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual bool isPeriodicAdvertisingActive(advertising_handle_t handle);
|
||||
bool isPeriodicAdvertisingActive(advertising_handle_t handle);
|
||||
|
||||
/* scanning */
|
||||
|
||||
|
@ -752,7 +762,7 @@ public:
|
|||
* @param params Scan parameters, @see GapScanParameters for details.
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t setScanParameters(const ScanParameters ¶ms);
|
||||
ble_error_t setScanParameters(const ScanParameters ¶ms);
|
||||
|
||||
/** Start scanning.
|
||||
*
|
||||
|
@ -770,7 +780,7 @@ public:
|
|||
* @see EventHandler::onAdvertisingReport to collect advertising reports.
|
||||
* @see EventHandler::onScanTimeout when scanning timeout.
|
||||
*/
|
||||
virtual ble_error_t startScan(
|
||||
ble_error_t startScan(
|
||||
scan_duration_t duration = scan_duration_t::forever(),
|
||||
duplicates_filter_t filtering = duplicates_filter_t::DISABLE,
|
||||
scan_period_t period = scan_period_t(0)
|
||||
|
@ -783,7 +793,7 @@ public:
|
|||
*
|
||||
* @retval BLE_ERROR_NONE if successfully stopped scanning procedure.
|
||||
*/
|
||||
virtual ble_error_t stopScan();
|
||||
ble_error_t stopScan();
|
||||
|
||||
/** Synchronize with periodic advertising from an advertiser and begin receiving periodic
|
||||
* advertising packets.
|
||||
|
@ -806,7 +816,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t createSync(
|
||||
ble_error_t createSync(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
uint8_t sid,
|
||||
|
@ -832,7 +842,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t createSync(
|
||||
ble_error_t createSync(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
);
|
||||
|
@ -841,14 +851,14 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t cancelCreateSync();
|
||||
ble_error_t cancelCreateSync();
|
||||
|
||||
/** Stop reception of the periodic advertising identified by the handle.
|
||||
*
|
||||
* @param handle Periodic advertising synchronisation handle.
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t terminateSync(periodic_sync_handle_t handle);
|
||||
ble_error_t terminateSync(periodic_sync_handle_t handle);
|
||||
|
||||
/** Add device to the periodic advertiser list. Cannot be called when sync is ongoing.
|
||||
*
|
||||
|
@ -857,7 +867,7 @@ public:
|
|||
* @param sid Advertiser set identifier.
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t addDeviceToPeriodicAdvertiserList(
|
||||
ble_error_t addDeviceToPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
|
@ -870,7 +880,7 @@ public:
|
|||
* @param sid Advertiser set identifier.
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t removeDeviceFromPeriodicAdvertiserList(
|
||||
ble_error_t removeDeviceFromPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
|
@ -880,12 +890,12 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
virtual ble_error_t clearPeriodicAdvertiserList();
|
||||
ble_error_t clearPeriodicAdvertiserList();
|
||||
|
||||
/** Get number of devices that can be added to the periodic advertiser list.
|
||||
* @return Number of devices that can be added to the periodic advertiser list.
|
||||
*/
|
||||
virtual uint8_t getMaxPeriodicAdvertiserListSize();
|
||||
uint8_t getMaxPeriodicAdvertiserListSize();
|
||||
|
||||
/**
|
||||
* Initiate a connection to a peer.
|
||||
|
@ -906,7 +916,7 @@ public:
|
|||
* @see EventHandler::onDisconnectionComplete is called when the connection
|
||||
* ends.
|
||||
*/
|
||||
virtual ble_error_t connect(
|
||||
ble_error_t connect(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
|
@ -918,7 +928,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE if the connection attempt has been requested to be cancelled.
|
||||
*/
|
||||
virtual ble_error_t cancelConnect();
|
||||
ble_error_t cancelConnect();
|
||||
|
||||
/**
|
||||
* Update connection parameters of an existing connection.
|
||||
|
@ -946,7 +956,7 @@ public:
|
|||
* @version 4.0+ for central
|
||||
* @version 4.1+ for peripheral
|
||||
*/
|
||||
virtual ble_error_t updateConnectionParameters(
|
||||
ble_error_t updateConnectionParameters(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
|
@ -976,7 +986,7 @@ public:
|
|||
* @see acceptConnectionParametersUpdate to accept the request.
|
||||
* @see rejectConnectionParametersUpdate to reject the request.
|
||||
*/
|
||||
virtual ble_error_t manageConnectionParametersUpdateRequest(
|
||||
ble_error_t manageConnectionParametersUpdateRequest(
|
||||
bool userManageConnectionUpdateRequest
|
||||
);
|
||||
|
||||
|
@ -1009,7 +1019,7 @@ public:
|
|||
* @see EventHandler::onConnectionParametersUpdateComplete Called when the
|
||||
* new connection parameters are effective.
|
||||
*/
|
||||
virtual ble_error_t acceptConnectionParametersUpdate(
|
||||
ble_error_t acceptConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
|
@ -1035,7 +1045,7 @@ public:
|
|||
* @see EventHandler::onUpdateConnectionParametersRequest Called when a
|
||||
* request to update the connection parameters is received.
|
||||
*/
|
||||
virtual ble_error_t rejectConnectionParametersUpdate(
|
||||
ble_error_t rejectConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle
|
||||
);
|
||||
|
||||
|
@ -1055,7 +1065,7 @@ public:
|
|||
* @see EventHandler::onDisconnectionComplete when the disconnection is
|
||||
* effective.
|
||||
*/
|
||||
virtual ble_error_t disconnect(
|
||||
ble_error_t disconnect(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
);
|
||||
|
@ -1076,7 +1086,7 @@ public:
|
|||
*
|
||||
* @see EventHandler::onReadPhy is called when the phy has been read.
|
||||
*/
|
||||
virtual ble_error_t readPhy(connection_handle_t connection);
|
||||
ble_error_t readPhy(connection_handle_t connection);
|
||||
|
||||
/**
|
||||
* Set the preferred PHYs to use in a connection.
|
||||
|
@ -1092,7 +1102,7 @@ public:
|
|||
*
|
||||
* @version 5+
|
||||
*/
|
||||
virtual ble_error_t setPreferredPhys(
|
||||
ble_error_t setPreferredPhys(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
);
|
||||
|
@ -1122,7 +1132,7 @@ public:
|
|||
* @see EventHandler::onPhyUpdateComplete is called when the phy used by the
|
||||
* connection has been updated.
|
||||
*/
|
||||
virtual ble_error_t setPhy(
|
||||
ble_error_t setPhy(
|
||||
connection_handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
|
@ -1174,7 +1184,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE in case of success or an appropriate error code.
|
||||
*/
|
||||
virtual ble_error_t enablePrivacy(bool enable);
|
||||
ble_error_t enablePrivacy(bool enable);
|
||||
|
||||
/**
|
||||
* Set the privacy configuration used by the peripheral role.
|
||||
|
@ -1183,7 +1193,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE in case of success or an appropriate error code.
|
||||
*/
|
||||
virtual ble_error_t setPeripheralPrivacyConfiguration(
|
||||
ble_error_t setPeripheralPrivacyConfiguration(
|
||||
const peripheral_privacy_configuration_t *configuration
|
||||
);
|
||||
|
||||
|
@ -1195,7 +1205,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE in case of success or an appropriate error code.
|
||||
*/
|
||||
virtual ble_error_t getPeripheralPrivacyConfiguration(
|
||||
ble_error_t getPeripheralPrivacyConfiguration(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
);
|
||||
|
||||
|
@ -1206,7 +1216,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE in case of success or an appropriate error code.
|
||||
*/
|
||||
virtual ble_error_t setCentralPrivacyConfiguration(
|
||||
ble_error_t setCentralPrivacyConfiguration(
|
||||
const central_privay_configuration_t *configuration
|
||||
);
|
||||
|
||||
|
@ -1218,7 +1228,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE in case of success or an appropriate error code.
|
||||
*/
|
||||
virtual ble_error_t getCentralPrivacyConfiguration(
|
||||
ble_error_t getCentralPrivacyConfiguration(
|
||||
central_privay_configuration_t *configuration
|
||||
);
|
||||
|
||||
|
@ -1232,16 +1242,12 @@ protected:
|
|||
/** Can only be called if use_non_deprecated_scan_api() hasn't been called.
|
||||
* This guards against mixed use of deprecated and nondeprecated API.
|
||||
*/
|
||||
virtual void useVersionOneAPI() const
|
||||
{
|
||||
}
|
||||
void useVersionOneAPI() const;
|
||||
|
||||
/** Can only be called if use_deprecated_scan_api() hasn't been called.
|
||||
* This guards against mixed use of deprecated and nondeprecated API.
|
||||
*/
|
||||
virtual void useVersionTwoAPI() const
|
||||
{
|
||||
}
|
||||
void useVersionTwoAPI() const;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1252,9 +1258,144 @@ protected:
|
|||
/**
|
||||
* Construct a Gap instance.
|
||||
*/
|
||||
Gap() : _eventHandler(NULL)
|
||||
{
|
||||
}
|
||||
Gap();
|
||||
|
||||
/* ----------------- API to override in derived class -------------- */
|
||||
|
||||
bool isFeatureSupported_(controller_supported_features_t feature);
|
||||
uint8_t getMaxAdvertisingSetNumber_();
|
||||
uint16_t getMaxAdvertisingDataLength_();
|
||||
uint16_t getMaxConnectableAdvertisingDataLength_();
|
||||
uint16_t getMaxActiveSetAdvertisingDataLength_();
|
||||
ble_error_t createAdvertisingSet_(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
);
|
||||
ble_error_t destroyAdvertisingSet_(advertising_handle_t handle);
|
||||
ble_error_t setAdvertisingParameters_(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
);
|
||||
ble_error_t setAdvertisingPayload_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
);
|
||||
ble_error_t setAdvertisingScanResponse_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
);
|
||||
ble_error_t startAdvertising_(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
);
|
||||
ble_error_t stopAdvertising_(advertising_handle_t handle);
|
||||
bool isAdvertisingActive_(advertising_handle_t handle);
|
||||
ble_error_t setPeriodicAdvertisingParameters_(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
bool advertiseTxPower
|
||||
);
|
||||
ble_error_t setPeriodicAdvertisingPayload_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
);
|
||||
ble_error_t startPeriodicAdvertising_(advertising_handle_t handle);
|
||||
ble_error_t stopPeriodicAdvertising_(advertising_handle_t handle);
|
||||
bool isPeriodicAdvertisingActive_(advertising_handle_t handle);
|
||||
ble_error_t setScanParameters_(const ScanParameters ¶ms);
|
||||
ble_error_t startScan_(
|
||||
scan_duration_t duration,
|
||||
duplicates_filter_t filtering,
|
||||
scan_period_t period
|
||||
);
|
||||
ble_error_t stopScan_();
|
||||
ble_error_t createSync_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
uint8_t sid,
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
);
|
||||
ble_error_t createSync_(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
);
|
||||
ble_error_t cancelCreateSync_();
|
||||
ble_error_t terminateSync_(periodic_sync_handle_t handle);
|
||||
ble_error_t addDeviceToPeriodicAdvertiserList_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
);
|
||||
ble_error_t removeDeviceFromPeriodicAdvertiserList_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
);
|
||||
ble_error_t clearPeriodicAdvertiserList_();
|
||||
uint8_t getMaxPeriodicAdvertiserListSize_();
|
||||
ble_error_t connect_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
);
|
||||
ble_error_t cancelConnect_();
|
||||
ble_error_t updateConnectionParameters_(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
);
|
||||
ble_error_t manageConnectionParametersUpdateRequest_(
|
||||
bool userManageConnectionUpdateRequest
|
||||
);
|
||||
ble_error_t acceptConnectionParametersUpdate_(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
);
|
||||
ble_error_t rejectConnectionParametersUpdate_(
|
||||
connection_handle_t connectionHandle
|
||||
);
|
||||
ble_error_t disconnect_(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
);
|
||||
ble_error_t readPhy_(connection_handle_t connection);
|
||||
ble_error_t setPreferredPhys_(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
);
|
||||
ble_error_t setPhy_(
|
||||
connection_handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
coded_symbol_per_bit_t codedSymbol
|
||||
);
|
||||
ble_error_t enablePrivacy_(bool enable);
|
||||
ble_error_t setPeripheralPrivacyConfiguration_(
|
||||
const peripheral_privacy_configuration_t *configuration
|
||||
);
|
||||
ble_error_t getPeripheralPrivacyConfiguration_(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
);
|
||||
ble_error_t setCentralPrivacyConfiguration_(
|
||||
const central_privay_configuration_t *configuration
|
||||
);
|
||||
ble_error_t getCentralPrivacyConfiguration_(
|
||||
central_privay_configuration_t *configuration
|
||||
);
|
||||
void useVersionOneAPI_() const;
|
||||
void useVersionTwoAPI_() const;
|
||||
|
||||
/**
|
||||
* Event handler provided by the application.
|
||||
|
@ -1269,6 +1410,9 @@ protected:
|
|||
* @}
|
||||
*/
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
} // namespace interface
|
||||
#endif
|
||||
} // namespace ble
|
||||
|
||||
#endif //BLE_GAP_GAP_H
|
||||
|
|
|
@ -1,377 +0,0 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ble/gap/Gap.h"
|
||||
|
||||
namespace ble {
|
||||
|
||||
bool Gap::isFeatureSupported(controller_supported_features_t feature)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t Gap::getMaxAdvertisingSetNumber()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
// There is at least one advertising set available: the legacy advertising set
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t Gap::getMaxAdvertisingDataLength()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return LEGACY_ADVERTISING_MAX_SIZE;
|
||||
}
|
||||
|
||||
uint16_t Gap::getMaxConnectableAdvertisingDataLength()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return LEGACY_ADVERTISING_MAX_SIZE;
|
||||
}
|
||||
|
||||
uint16_t Gap::getMaxActiveSetAdvertisingDataLength()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return LEGACY_ADVERTISING_MAX_SIZE;
|
||||
}
|
||||
|
||||
ble_error_t Gap::createAdvertisingSet(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::destroyAdvertisingSet(advertising_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setAdvertisingScanResponse(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::startAdvertising(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::stopAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool Gap::isAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setPeriodicAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
bool advertiseTxPower
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setPeriodicAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::startPeriodicAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::stopPeriodicAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool Gap::isPeriodicAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return false;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setScanParameters(const ScanParameters ¶ms)
|
||||
{
|
||||
useVersionTwoAPI();
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
};
|
||||
|
||||
ble_error_t Gap::startScan(
|
||||
scan_duration_t duration,
|
||||
duplicates_filter_t filtering,
|
||||
scan_period_t period
|
||||
)
|
||||
{
|
||||
useVersionTwoAPI();
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
};
|
||||
|
||||
ble_error_t Gap::stopScan()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::createSync(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
uint8_t sid,
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::createSync(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::cancelCreateSync()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::terminateSync(periodic_sync_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::addDeviceToPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::removeDeviceFromPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::clearPeriodicAdvertiserList()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
uint8_t Gap::getMaxPeriodicAdvertiserListSize()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
ble_error_t Gap::connect(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::cancelConnect()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::updateConnectionParameters(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::manageConnectionParametersUpdateRequest(
|
||||
bool userManageConnectionUpdateRequest
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::acceptConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::rejectConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::disconnect(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
)
|
||||
{
|
||||
// Forward to the old implementation for now.
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::readPhy(connection_handle_t connection)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setPreferredPhys(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setPhy(
|
||||
connection_handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
coded_symbol_per_bit_t codedSymbol
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* -------------------- Future deprecation ------------------------- */
|
||||
|
||||
const peripheral_privacy_configuration_t Gap::default_peripheral_privacy_configuration = {
|
||||
/* use_non_resolvable_random_address */ false,
|
||||
/* resolution_strategy */ peripheral_privacy_configuration_t::PERFORM_PAIRING_PROCEDURE
|
||||
};
|
||||
|
||||
const central_privay_configuration_t Gap::default_central_privacy_configuration = {
|
||||
/* use_non_resolvable_random_address */ false,
|
||||
/* resolution_strategy */ central_privay_configuration_t::RESOLVE_AND_FORWARD
|
||||
};
|
||||
|
||||
ble_error_t Gap::enablePrivacy(bool enable)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setPeripheralPrivacyConfiguration(
|
||||
const peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::getPeripheralPrivacyConfiguration(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setCentralPrivacyConfiguration(
|
||||
const central_privay_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::getCentralPrivacyConfiguration(
|
||||
central_privay_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
} // namespace ble
|
||||
|
|
@ -0,0 +1,818 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ble/gap/Gap.h"
|
||||
|
||||
namespace ble {
|
||||
namespace interface {
|
||||
|
||||
template<class Impl>
|
||||
bool Gap<Impl>::isFeatureSupported(controller_supported_features_t feature)
|
||||
{
|
||||
return impl()->isFeatureSupported_(feature);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint8_t Gap<Impl>::getMaxAdvertisingSetNumber()
|
||||
{
|
||||
return impl()->getMaxAdvertisingSetNumber_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint16_t Gap<Impl>::getMaxAdvertisingDataLength()
|
||||
{
|
||||
return impl()->getMaxAdvertisingDataLength_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint16_t Gap<Impl>::getMaxConnectableAdvertisingDataLength()
|
||||
{
|
||||
return impl()->getMaxConnectableAdvertisingDataLength_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint16_t Gap<Impl>::getMaxActiveSetAdvertisingDataLength()
|
||||
{
|
||||
return impl()->getMaxActiveSetAdvertisingDataLength_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::createAdvertisingSet(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
)
|
||||
{
|
||||
return impl()->createAdvertisingSet_(handle, parameters);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::destroyAdvertisingSet(advertising_handle_t handle)
|
||||
{
|
||||
return impl()->destroyAdvertisingSet_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
)
|
||||
{
|
||||
return impl()->setAdvertisingParameters_(handle, params);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
return impl()->setAdvertisingPayload_(handle, payload);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setAdvertisingScanResponse(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
)
|
||||
{
|
||||
return impl()->setAdvertisingScanResponse_(handle, response);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::startAdvertising(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
)
|
||||
{
|
||||
return impl()->startAdvertising_(handle, maxDuration, maxEvents);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::stopAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
return impl()->stopAdvertising_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
bool Gap<Impl>::isAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
return impl()->isAdvertisingActive_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPeriodicAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
bool advertiseTxPower
|
||||
)
|
||||
{
|
||||
return impl()->setPeriodicAdvertisingParameters_(
|
||||
handle,
|
||||
periodicAdvertisingIntervalMin,
|
||||
periodicAdvertisingIntervalMax,
|
||||
advertiseTxPower
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPeriodicAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
return impl()->setPeriodicAdvertisingPayload_(handle, payload);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::startPeriodicAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
return impl()->startPeriodicAdvertising_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::stopPeriodicAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
return impl()->stopPeriodicAdvertising_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
bool Gap<Impl>::isPeriodicAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
return impl()->isPeriodicAdvertisingActive_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setScanParameters(const ScanParameters ¶ms)
|
||||
{
|
||||
return impl()->setScanParameters_(params);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::startScan(
|
||||
scan_duration_t duration,
|
||||
duplicates_filter_t filtering,
|
||||
scan_period_t period
|
||||
)
|
||||
{
|
||||
return impl()->startScan_(duration, filtering, period);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::stopScan()
|
||||
{
|
||||
return impl()->stopScan_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::createSync(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
uint8_t sid,
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
return impl()->createSync_(
|
||||
peerAddressType,
|
||||
peerAddress,
|
||||
sid,
|
||||
maxPacketSkip,
|
||||
timeout
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::createSync(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
return impl()->createSync_(maxPacketSkip, timeout);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::cancelCreateSync()
|
||||
{
|
||||
return impl()->cancelCreateSync_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::terminateSync(periodic_sync_handle_t handle)
|
||||
{
|
||||
return impl()->terminateSync_(handle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::addDeviceToPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
return impl()->addDeviceToPeriodicAdvertiserList_(
|
||||
peerAddressType,
|
||||
peerAddress,
|
||||
sid
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::removeDeviceFromPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
return impl()->removeDeviceFromPeriodicAdvertiserList_(
|
||||
peerAddressType,
|
||||
peerAddress,
|
||||
sid
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::clearPeriodicAdvertiserList()
|
||||
{
|
||||
return impl()->clearPeriodicAdvertiserList_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint8_t Gap<Impl>::getMaxPeriodicAdvertiserListSize()
|
||||
{
|
||||
return impl()->getMaxPeriodicAdvertiserListSize_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::connect(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
)
|
||||
{
|
||||
return impl()->connect_(
|
||||
peerAddressType,
|
||||
peerAddress,
|
||||
connectionParams
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::cancelConnect()
|
||||
{
|
||||
return impl()->cancelConnect_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::updateConnectionParameters(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
)
|
||||
{
|
||||
return impl()->updateConnectionParameters_(
|
||||
connectionHandle,
|
||||
minConnectionInterval,
|
||||
maxConnectionInterval,
|
||||
slaveLatency,
|
||||
supervision_timeout,
|
||||
minConnectionEventLength,
|
||||
maxConnectionEventLength
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::manageConnectionParametersUpdateRequest(
|
||||
bool userManageConnectionUpdateRequest
|
||||
)
|
||||
{
|
||||
return impl()->manageConnectionParametersUpdateRequest_(userManageConnectionUpdateRequest);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::acceptConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
)
|
||||
{
|
||||
return impl()->acceptConnectionParametersUpdate_(
|
||||
connectionHandle,
|
||||
minConnectionInterval,
|
||||
maxConnectionInterval,
|
||||
slaveLatency,
|
||||
supervision_timeout,
|
||||
minConnectionEventLength,
|
||||
maxConnectionEventLength
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::rejectConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle
|
||||
)
|
||||
{
|
||||
return impl()->rejectConnectionParametersUpdate_(connectionHandle);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::disconnect(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
)
|
||||
{
|
||||
return impl()->disconnect_(connectionHandle, reason);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::readPhy(connection_handle_t connection)
|
||||
{
|
||||
return impl()->readPhy_(connection);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPreferredPhys(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
)
|
||||
{
|
||||
return impl()->setPreferredPhys_(txPhys, rxPhys);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPhy(
|
||||
connection_handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
coded_symbol_per_bit_t codedSymbol
|
||||
)
|
||||
{
|
||||
return impl()->setPhy_(
|
||||
connection,
|
||||
txPhys,
|
||||
rxPhys,
|
||||
codedSymbol
|
||||
);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
void Gap<Impl>::useVersionOneAPI() const
|
||||
{
|
||||
return impl()->useVersionOneAPI_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
void Gap<Impl>::useVersionTwoAPI() const
|
||||
{
|
||||
return impl()->useVersionTwoAPI_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
Gap<Impl>::Gap() : _eventHandler(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
/* -------------------- Future deprecation ------------------------- */
|
||||
|
||||
template<class Impl>
|
||||
const peripheral_privacy_configuration_t Gap<Impl>::default_peripheral_privacy_configuration = {
|
||||
/* use_non_resolvable_random_address */ false,
|
||||
/* resolution_strategy */ peripheral_privacy_configuration_t::PERFORM_PAIRING_PROCEDURE
|
||||
};
|
||||
|
||||
template<class Impl>
|
||||
const central_privay_configuration_t Gap<Impl>::default_central_privacy_configuration = {
|
||||
/* use_non_resolvable_random_address */ false,
|
||||
/* resolution_strategy */ central_privay_configuration_t::RESOLVE_AND_FORWARD
|
||||
};
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::enablePrivacy(bool enable)
|
||||
{
|
||||
return impl()->enablePrivacy_(enable);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPeripheralPrivacyConfiguration(
|
||||
const peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl()->setPeripheralPrivacyConfiguration_(configuration);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::getPeripheralPrivacyConfiguration(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl()->getPeripheralPrivacyConfiguration_(configuration);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setCentralPrivacyConfiguration(
|
||||
const central_privay_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl()->setCentralPrivacyConfiguration_(configuration);
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::getCentralPrivacyConfiguration(
|
||||
central_privay_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl()->getCentralPrivacyConfiguration_(configuration);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/* ------------------------- Default implementations ------------------------ */
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
template<class Impl>
|
||||
bool Gap<Impl>::isFeatureSupported_(controller_supported_features_t feature)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint8_t Gap<Impl>::getMaxAdvertisingSetNumber_()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint16_t Gap<Impl>::getMaxAdvertisingDataLength_()
|
||||
{
|
||||
return LEGACY_ADVERTISING_MAX_SIZE;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint16_t Gap<Impl>::getMaxConnectableAdvertisingDataLength_()
|
||||
{
|
||||
return LEGACY_ADVERTISING_MAX_SIZE;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint16_t Gap<Impl>::getMaxActiveSetAdvertisingDataLength_()
|
||||
{
|
||||
return LEGACY_ADVERTISING_MAX_SIZE;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::createAdvertisingSet_(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::destroyAdvertisingSet_(advertising_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setAdvertisingParameters_(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setAdvertisingPayload_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setAdvertisingScanResponse_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::startAdvertising_(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::stopAdvertising_(advertising_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
bool Gap<Impl>::isAdvertisingActive_(advertising_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPeriodicAdvertisingParameters_(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
bool advertiseTxPower
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPeriodicAdvertisingPayload_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::startPeriodicAdvertising_(advertising_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::stopPeriodicAdvertising_(advertising_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
bool Gap<Impl>::isPeriodicAdvertisingActive_(advertising_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setScanParameters_(const ScanParameters ¶ms)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::startScan_(
|
||||
scan_duration_t duration,
|
||||
duplicates_filter_t filtering,
|
||||
scan_period_t period
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::stopScan_()
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::createSync_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
uint8_t sid,
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::createSync_(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::cancelCreateSync_()
|
||||
{
|
||||
return impl()->cancelCreateSync_();
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::terminateSync_(periodic_sync_handle_t handle)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::addDeviceToPeriodicAdvertiserList_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::removeDeviceFromPeriodicAdvertiserList_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::clearPeriodicAdvertiserList_()
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
uint8_t Gap<Impl>::getMaxPeriodicAdvertiserListSize_()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::connect_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::cancelConnect_()
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::updateConnectionParameters_(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::manageConnectionParametersUpdateRequest_(
|
||||
bool userManageConnectionUpdateRequest
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::acceptConnectionParametersUpdate_(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
slave_latency_t slaveLatency,
|
||||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::rejectConnectionParametersUpdate_(
|
||||
connection_handle_t connectionHandle
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::disconnect_(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::readPhy_(connection_handle_t connection)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPreferredPhys_(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPhy_(
|
||||
connection_handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
coded_symbol_per_bit_t codedSymbol
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
void Gap<Impl>::useVersionOneAPI_() const
|
||||
{
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
void Gap<Impl>::useVersionTwoAPI_() const
|
||||
{
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::enablePrivacy_(bool enable)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setPeripheralPrivacyConfiguration_(
|
||||
const peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::getPeripheralPrivacyConfiguration_(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::setCentralPrivacyConfiguration_(
|
||||
const central_privay_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t Gap<Impl>::getCentralPrivacyConfiguration_(
|
||||
central_privay_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
} // namespace interface
|
||||
} // namespace ble
|
||||
|
Loading…
Reference in New Issue