mirror of https://github.com/ARMmbed/mbed-os.git
PIMPL for ble::Gap
parent
a32168c819
commit
909676d159
|
|
@ -281,7 +281,9 @@ class PalGenericAccessService;
|
|||
* controller or by the peer.
|
||||
*/
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
namespace interface {
|
||||
namespace impl {
|
||||
class Gap;
|
||||
}
|
||||
#endif // !defined(DOXYGEN_ONLY)
|
||||
class Gap {
|
||||
public:
|
||||
|
|
@ -1421,7 +1423,9 @@ public:
|
|||
* @param[in] memberPtr Shutdown event handler to register.
|
||||
*/
|
||||
template<typename T>
|
||||
void onShutdown(T *objPtr, void (T::*memberPtr)(const Gap *));
|
||||
void onShutdown(T *objPtr, void (T::*memberPtr)(const Gap *)) {
|
||||
onShutdown(GapShutdownCallback_t(objPtr, memberPtr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Access the callchain of shutdown event handler.
|
||||
|
|
@ -1442,6 +1446,9 @@ public:
|
|||
*/
|
||||
ble_error_t setRandomStaticAddress(const ble::address_t& address);
|
||||
#endif // !defined(DOXYGEN_ONLY)
|
||||
|
||||
private:
|
||||
impl::Gap* impl;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1449,14 +1456,11 @@ public:
|
|||
* @}
|
||||
*/
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
} // namespace interface
|
||||
#endif // !defined(DOXYGEN_ONLY)
|
||||
} // namespace ble
|
||||
|
||||
/* This includes the concrete class implementation, to provide a an alternative API implementation
|
||||
* disable ble-api-implementation and place your header in a path with the same structure */
|
||||
#include "ble/internal/GapImpl.h"
|
||||
//#include "ble/internal/GapImpl.h"
|
||||
|
||||
/** @deprecated Use the namespaced ble::Gap instead of the global Gap. */
|
||||
using ble::Gap;
|
||||
|
|
|
|||
|
|
@ -48,20 +48,29 @@
|
|||
namespace ble {
|
||||
|
||||
class PalGenericAccessService;
|
||||
|
||||
class PalSecurityManager;
|
||||
|
||||
class PalGap;
|
||||
|
||||
class BLEInstanceBase;
|
||||
|
||||
namespace impl {
|
||||
|
||||
class Gap :
|
||||
public ble::interface::Gap,
|
||||
public PalConnectionMonitor,
|
||||
public PalGapEventHandler
|
||||
{
|
||||
public PalGapEventHandler {
|
||||
friend PalConnectionMonitor;
|
||||
friend PalGapEventHandler;
|
||||
friend PalGap;
|
||||
friend BLEInstanceBase;
|
||||
|
||||
using EventHandler = ::ble::Gap::EventHandler;
|
||||
using GapShutdownCallback_t = ::ble::Gap::GapShutdownCallback_t;
|
||||
using GapShutdownCallbackChain_t = ::ble::Gap::GapShutdownCallbackChain_t ;
|
||||
public:
|
||||
using PreferredConnectionParams_t = ::ble::Gap::PreferredConnectionParams_t ;
|
||||
|
||||
/**
|
||||
* Default peripheral privacy configuration.
|
||||
*/
|
||||
|
|
@ -98,6 +107,7 @@ public:
|
|||
);
|
||||
|
||||
ble_error_t destroyAdvertisingSet(advertising_handle_t handle);
|
||||
|
||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
|
||||
ble_error_t setAdvertisingParameters(
|
||||
|
|
@ -124,6 +134,7 @@ public:
|
|||
ble_error_t stopAdvertising(advertising_handle_t handle);
|
||||
|
||||
bool isAdvertisingActive(advertising_handle_t handle);
|
||||
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
|
|
@ -146,6 +157,7 @@ public:
|
|||
ble_error_t stopPeriodicAdvertising(advertising_handle_t handle);
|
||||
|
||||
bool isPeriodicAdvertisingActive(advertising_handle_t handle);
|
||||
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
|
|
@ -161,6 +173,7 @@ public:
|
|||
);
|
||||
|
||||
ble_error_t stopScan();
|
||||
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
|
@ -198,6 +211,7 @@ public:
|
|||
ble_error_t clearPeriodicAdvertiserList();
|
||||
|
||||
uint8_t getMaxPeriodicAdvertiserListSize();
|
||||
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
|
|
@ -210,6 +224,7 @@ public:
|
|||
);
|
||||
|
||||
ble_error_t cancelConnect();
|
||||
|
||||
#endif // BLE_ROLE_CENTRAL
|
||||
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
|
|
@ -246,6 +261,7 @@ public:
|
|||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
);
|
||||
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
#if BLE_FEATURE_PHY_MANAGEMENT
|
||||
|
||||
|
|
@ -262,6 +278,7 @@ public:
|
|||
const phy_set_t *rxPhys,
|
||||
coded_symbol_per_bit_t codedSymbol
|
||||
);
|
||||
|
||||
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
||||
|
||||
#if BLE_FEATURE_PRIVACY
|
||||
|
|
@ -277,6 +294,7 @@ public:
|
|||
ble_error_t getPeripheralPrivacyConfiguration(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
);
|
||||
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
|
@ -288,6 +306,7 @@ public:
|
|||
ble_error_t getCentralPrivacyConfiguration(
|
||||
central_privacy_configuration_t *configuration
|
||||
);
|
||||
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#endif // BLE_FEATURE_PRIVACY
|
||||
|
||||
|
|
@ -321,12 +340,14 @@ public:
|
|||
GapShutdownCallbackChain_t &onShutdown();
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/*
|
||||
* API reserved for the controller driver to set the random static address.
|
||||
* Setting a new random static address while the controller is operating is
|
||||
* forbidden by the Bluetooth specification.
|
||||
*/
|
||||
ble_error_t setRandomStaticAddress(const ble::address_t& address);
|
||||
ble_error_t setRandomStaticAddress(const ble::address_t &address);
|
||||
|
||||
#endif // !defined(DOXYGEN_ONLY)
|
||||
|
||||
/* ===================================================================== */
|
||||
|
|
@ -335,7 +356,8 @@ public:
|
|||
private:
|
||||
/* Disallow copy and assignment. */
|
||||
Gap(const Gap &);
|
||||
Gap& operator=(const Gap &);
|
||||
|
||||
Gap &operator=(const Gap &);
|
||||
|
||||
Gap(
|
||||
PalEventQueue &event_queue,
|
||||
|
|
@ -507,6 +529,7 @@ private:
|
|||
);
|
||||
|
||||
void on_scan_timeout();
|
||||
|
||||
void process_legacy_scan_timeout();
|
||||
|
||||
private:
|
||||
|
|
@ -598,6 +621,7 @@ private:
|
|||
bool _user_manage_connection_parameter_requests : 1;
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
} // namespace ble
|
||||
|
||||
#endif //IMPL_GAP_GAP_H
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <algorithm>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ble/internal/GapImpl.h"
|
||||
#include "ble/Gap.h"
|
||||
#include "ble/internal/BLEInstanceBase.h"
|
||||
#include "ble/Gap.h"
|
||||
|
|
@ -38,6 +39,7 @@ MBED_STATIC_ASSERT(BLE_GAP_MAX_ADVERTISING_SETS < 0xFF, "BLE_GAP_MAX_ADVERTISING
|
|||
MBED_STATIC_ASSERT(BLE_GAP_MAX_ADVERTISING_SETS > 0, "BLE_GAP_MAX_ADVERTISING_SETS must be a positive number");
|
||||
|
||||
namespace ble {
|
||||
namespace impl {
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -104,7 +106,10 @@ static bool is_preferred_connection_params_valid(const Gap::PreferredConnectionP
|
|||
return true;
|
||||
}
|
||||
|
||||
if ((is_in_range(params->connectionSupervisionTimeout, supervision_timeout_min, supervision_timeout_max) == false)) {
|
||||
if ((
|
||||
is_in_range(params->connectionSupervisionTimeout, supervision_timeout_min, supervision_timeout_max) ==
|
||||
false
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -282,8 +287,10 @@ static whitelist_address_type_t to_whitelist_address_type(
|
|||
peer_address_type_t address_type
|
||||
)
|
||||
{
|
||||
return (address_type == peer_address_type_t::PUBLIC
|
||||
|| address_type == peer_address_type_t::PUBLIC_IDENTITY) ?
|
||||
return (
|
||||
address_type == peer_address_type_t::PUBLIC
|
||||
|| address_type == peer_address_type_t::PUBLIC_IDENTITY
|
||||
) ?
|
||||
whitelist_address_type_t::PUBLIC_DEVICE_ADDRESS :
|
||||
whitelist_address_type_t::RANDOM_DEVICE_ADDRESS;
|
||||
}
|
||||
|
|
@ -385,7 +392,7 @@ bool Gap::isFeatureSupported(controller_supported_features_t feature)
|
|||
|
||||
|
||||
ble_error_t Gap::setRandomStaticAddress(
|
||||
const ble::address_t& address
|
||||
const ble::address_t &address
|
||||
)
|
||||
{
|
||||
if (is_random_static_address(address.data()) == false) {
|
||||
|
|
@ -423,7 +430,7 @@ ble_error_t Gap::getAddress(
|
|||
|
||||
ble_error_t Gap::getRandomAddressType(
|
||||
const address_t address,
|
||||
ble::random_address_type_t* type
|
||||
ble::random_address_type_t *type
|
||||
)
|
||||
{
|
||||
// see section Device address in Bluetooth Link Layer specification
|
||||
|
|
@ -496,7 +503,7 @@ ble_error_t Gap::connect(
|
|||
conn_interval_t(connectionParams.getMaxConnectionIntervalArray()[i]),
|
||||
slave_latency_t(connectionParams.getSlaveLatencyArray()[i])
|
||||
)
|
||||
) {
|
||||
) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
}
|
||||
|
|
@ -534,7 +541,7 @@ ble_error_t Gap::connect(
|
|||
|
||||
if (peerAddressType == peer_address_type_t::RANDOM ||
|
||||
peerAddressType == peer_address_type_t::RANDOM_STATIC_IDENTITY
|
||||
) {
|
||||
) {
|
||||
adjusted_address_type = peer_address_type_t::RANDOM;
|
||||
}
|
||||
|
||||
|
|
@ -903,7 +910,7 @@ ble_error_t Gap::getCentralPrivacyConfiguration(
|
|||
ble_error_t Gap::reset(void)
|
||||
{
|
||||
/* Notify that the instance is about to shut down */
|
||||
shutdownCallChain.call(this);
|
||||
// shutdownCallChain.call(this);
|
||||
shutdownCallChain.clear();
|
||||
|
||||
_event_handler = nullptr;
|
||||
|
|
@ -923,7 +930,7 @@ ble_error_t Gap::reset(void)
|
|||
_pal_gap.extended_advertising_enable(
|
||||
/* enable */ false,
|
||||
/* number of advertising sets */ 1,
|
||||
(advertising_handle_t*)&i,
|
||||
(advertising_handle_t *) &i,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
|
|
@ -932,7 +939,7 @@ ble_error_t Gap::reset(void)
|
|||
if (_active_periodic_sets.get(i)) {
|
||||
_pal_gap.periodic_advertising_enable(
|
||||
/* enable */ false,
|
||||
(advertising_handle_t)i
|
||||
(advertising_handle_t) i
|
||||
);
|
||||
}
|
||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
|
@ -948,7 +955,7 @@ ble_error_t Gap::reset(void)
|
|||
_pal_gap.extended_advertising_enable(
|
||||
/* enable */ false,
|
||||
/* number of advertising sets */ 1,
|
||||
(advertising_handle_t*)&LEGACY_ADVERTISING_HANDLE,
|
||||
(advertising_handle_t *) &LEGACY_ADVERTISING_HANDLE,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
|
|
@ -1120,7 +1127,7 @@ void Gap::on_advertising_report(const GapAdvertisingReportEvent &e)
|
|||
advertising.rssi,
|
||||
/* NO PERIODIC ADVERTISING */ 0,
|
||||
peer_address_type_t::ANONYMOUS,
|
||||
ble::address_t (),
|
||||
ble::address_t(),
|
||||
Span<const uint8_t>(advertising.data.data(), advertising.data.size())
|
||||
)
|
||||
);
|
||||
|
|
@ -1161,7 +1168,7 @@ void Gap::on_connection_complete(const GapConnectionCompleteEvent &e)
|
|||
if (_privacy_enabled &&
|
||||
e.role.value() == e.role.PERIPHERAL &&
|
||||
e.peer_address_type == peer_address_type_t::RANDOM
|
||||
) {
|
||||
) {
|
||||
// Apply privacy policy if in peripheral mode for non-resolved addresses
|
||||
ble::random_address_type_t random_address_type(ble::random_address_type_t::RESOLVABLE_PRIVATE);
|
||||
ble_error_t err = getRandomAddressType(e.peer_address.data(), &random_address_type);
|
||||
|
|
@ -1409,7 +1416,8 @@ ble_error_t Gap::update_address_resolution_setting()
|
|||
|
||||
if (_privacy_enabled) {
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
if (_peripheral_privacy_configuration.resolution_strategy != peripheral_privacy_configuration_t::DO_NOT_RESOLVE) {
|
||||
if (_peripheral_privacy_configuration.resolution_strategy !=
|
||||
peripheral_privacy_configuration_t::DO_NOT_RESOLVE) {
|
||||
enable = true;
|
||||
}
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
|
|
@ -1544,7 +1552,7 @@ uint8_t Gap::getMaxAdvertisingSetNumber()
|
|||
#if BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
if (is_extended_advertising_available()) {
|
||||
uint8_t set_number = _pal_gap.get_max_number_of_advertising_sets();
|
||||
return std::min((uint8_t)BLE_GAP_MAX_ADVERTISING_SETS, set_number);
|
||||
return std::min((uint8_t) BLE_GAP_MAX_ADVERTISING_SETS, set_number);
|
||||
} else
|
||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
{
|
||||
|
|
@ -1706,8 +1714,10 @@ ble_error_t Gap::setExtendedAdvertisingParameters(
|
|||
}
|
||||
|
||||
/* check for illegal parameter combination */
|
||||
if ((params.getType() == advertising_type_t::CONNECTABLE_UNDIRECTED ||
|
||||
params.getType() == advertising_type_t::CONNECTABLE_DIRECTED) &&
|
||||
if ((
|
||||
params.getType() == advertising_type_t::CONNECTABLE_UNDIRECTED ||
|
||||
params.getType() == advertising_type_t::CONNECTABLE_DIRECTED
|
||||
) &&
|
||||
params.getUseLegacyPDU() == false) {
|
||||
/* these types can only be used with legacy PDUs */
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
|
|
@ -1852,7 +1862,7 @@ ble_error_t Gap::setAdvertisingData(
|
|||
|
||||
if (!_active_sets.get(handle) && payload.size() > this->getMaxActiveSetAdvertisingDataLength()) {
|
||||
MBED_WARNING(MBED_ERROR_INVALID_SIZE, "Payload size for active sets needs to fit in a single operation"
|
||||
" - not greater than getMaxActiveSetAdvertisingDataLength().");
|
||||
" - not greater than getMaxActiveSetAdvertisingDataLength().");
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
|
|
@ -1860,7 +1870,7 @@ ble_error_t Gap::setAdvertisingData(
|
|||
if (payload.size() > this->getMaxConnectableAdvertisingDataLength()) {
|
||||
if (_active_sets.get(handle) && _set_is_connectable.get(handle)) {
|
||||
MBED_WARNING(MBED_ERROR_INVALID_SIZE, "Payload size for connectable advertising"
|
||||
" exceeds getMaxAdvertisingDataLength().");
|
||||
" exceeds getMaxAdvertisingDataLength().");
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
} else {
|
||||
_connectable_payload_size_exceeded.set(handle);
|
||||
|
|
@ -2125,7 +2135,8 @@ ble_error_t Gap::setPeriodicAdvertisingPayload(
|
|||
}
|
||||
|
||||
i += hci_length;
|
||||
} while (i < end);
|
||||
}
|
||||
while (i < end);
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -2260,7 +2271,7 @@ void Gap::on_extended_advertising_report(
|
|||
address_type != nullptr &&
|
||||
*address_type == connection_peer_address_type_t::RANDOM_ADDRESS &&
|
||||
is_random_private_resolvable_address(address.data())
|
||||
) {
|
||||
) {
|
||||
return;
|
||||
}
|
||||
#endif // BLE_FEATURE_PRIVACY
|
||||
|
|
@ -2436,11 +2447,12 @@ void Gap::on_remote_connection_parameter(
|
|||
if (_user_manage_connection_parameter_requests) {
|
||||
if (_event_handler) {
|
||||
_event_handler->onUpdateConnectionParametersRequest(
|
||||
UpdateConnectionParametersRequestEvent(connection_handle,
|
||||
conn_interval_t(connection_interval_min),
|
||||
conn_interval_t(connection_interval_max),
|
||||
connection_latency,
|
||||
supervision_timeout_t(supervision_timeout))
|
||||
UpdateConnectionParametersRequestEvent(
|
||||
connection_handle,
|
||||
conn_interval_t(connection_interval_min),
|
||||
conn_interval_t(connection_interval_max),
|
||||
connection_latency,
|
||||
supervision_timeout_t(supervision_timeout))
|
||||
);
|
||||
} else {
|
||||
MBED_ERROR(illegal_state_error, "Event handler required if connection params are user handled");
|
||||
|
|
@ -2735,4 +2747,5 @@ void Gap::setEventHandler(Gap::EventHandler *handler)
|
|||
_event_handler = handler;
|
||||
}
|
||||
|
||||
} // impl
|
||||
} // ble
|
||||
|
|
|
|||
|
|
@ -0,0 +1,512 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2020 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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.h"
|
||||
#include "ble/internal/GapImpl.h"
|
||||
|
||||
namespace ble {
|
||||
|
||||
void Gap::setEventHandler(EventHandler *handler)
|
||||
{
|
||||
impl->setEventHandler(handler);
|
||||
}
|
||||
|
||||
|
||||
bool Gap::isFeatureSupported(controller_supported_features_t feature)
|
||||
{
|
||||
return impl->isFeatureSupported(feature);
|
||||
}
|
||||
|
||||
/* advertising */
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
|
||||
uint8_t Gap::getMaxAdvertisingSetNumber()
|
||||
{
|
||||
return impl->getMaxAdvertisingSetNumber();
|
||||
}
|
||||
|
||||
|
||||
uint16_t Gap::getMaxAdvertisingDataLength()
|
||||
{
|
||||
return impl->getMaxAdvertisingDataLength();
|
||||
}
|
||||
|
||||
|
||||
uint16_t Gap::getMaxConnectableAdvertisingDataLength()
|
||||
{
|
||||
return impl->getMaxConnectableAdvertisingDataLength();
|
||||
}
|
||||
|
||||
|
||||
uint16_t Gap::getMaxActiveSetAdvertisingDataLength()
|
||||
{
|
||||
return impl->getMaxActiveSetAdvertisingDataLength();
|
||||
}
|
||||
|
||||
#if BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
|
||||
ble_error_t Gap::createAdvertisingSet(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
)
|
||||
{
|
||||
return impl->createAdvertisingSet(handle, parameters);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::destroyAdvertisingSet(advertising_handle_t handle)
|
||||
{
|
||||
return impl->destroyAdvertisingSet(handle);
|
||||
}
|
||||
|
||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
|
||||
|
||||
|
||||
ble_error_t Gap::setAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
)
|
||||
{
|
||||
return impl->setAdvertisingParameters(handle, params);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::setAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
return impl->setAdvertisingPayload(handle, payload);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::setAdvertisingScanResponse(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
)
|
||||
{
|
||||
return impl->setAdvertisingScanResponse(handle, response);
|
||||
}
|
||||
|
||||
ble_error_t Gap::startAdvertising(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
)
|
||||
{
|
||||
return impl->startAdvertising(handle, maxDuration, maxEvents);
|
||||
}
|
||||
|
||||
ble_error_t Gap::stopAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
return impl->stopAdvertising(handle);
|
||||
}
|
||||
|
||||
|
||||
bool Gap::isAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
return impl->isAdvertisingActive(handle);
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
#if BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
ble_error_t Gap::setPeriodicAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
bool advertiseTxPower
|
||||
)
|
||||
{
|
||||
return impl->setPeriodicAdvertisingParameters(
|
||||
handle,
|
||||
periodicAdvertisingIntervalMin,
|
||||
periodicAdvertisingIntervalMax,
|
||||
advertiseTxPower
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::setPeriodicAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
)
|
||||
{
|
||||
return impl->setPeriodicAdvertisingPayload(handle, payload);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::startPeriodicAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
return impl->startPeriodicAdvertising(handle);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::stopPeriodicAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
return impl->stopAdvertising(handle);
|
||||
}
|
||||
|
||||
|
||||
bool Gap::isPeriodicAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
return impl->isPeriodicAdvertisingActive(handle);
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
/* scanning */
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
||||
ble_error_t Gap::setScanParameters(const ScanParameters ¶ms)
|
||||
{
|
||||
return impl->setScanParameters(params);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::startScan(
|
||||
scan_duration_t duration,
|
||||
duplicates_filter_t filtering,
|
||||
scan_period_t period
|
||||
)
|
||||
{
|
||||
return impl->startScan(duration, filtering, period);
|
||||
}
|
||||
|
||||
ble_error_t Gap::stopScan()
|
||||
{
|
||||
return impl->stopScan();
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
#if BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
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
|
||||
)
|
||||
{
|
||||
return impl->createSync(peerAddressType, peerAddress, sid, maxPacketSkip, timeout);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::createSync(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
)
|
||||
{
|
||||
return impl->createSync(maxPacketSkip, timeout);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::cancelCreateSync()
|
||||
{
|
||||
return impl->cancelCreateSync();
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::terminateSync(periodic_sync_handle_t handle)
|
||||
{
|
||||
return impl->terminateSync(handle);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::addDeviceToPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
return impl->addDeviceToPeriodicAdvertiserList(peerAddressType, peerAddress, sid);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::removeDeviceFromPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
return impl->removeDeviceFromPeriodicAdvertiserList(peerAddressType, peerAddress, sid);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::clearPeriodicAdvertiserList()
|
||||
{
|
||||
return impl->clearPeriodicAdvertiserList();
|
||||
}
|
||||
|
||||
|
||||
uint8_t Gap::getMaxPeriodicAdvertiserListSize()
|
||||
{
|
||||
return impl->getMaxPeriodicAdvertiserListSize();
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
#if BLE_ROLE_CENTRAL
|
||||
|
||||
ble_error_t Gap::connect(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
)
|
||||
{
|
||||
return impl->connect(peerAddressType, peerAddress, connectionParams);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::cancelConnect()
|
||||
{
|
||||
return impl->cancelConnect();
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::cancelConnect(
|
||||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress
|
||||
)
|
||||
{
|
||||
return impl->cancelConnect(peerAddressType, peerAddress);
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_CENTRAL
|
||||
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
|
||||
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 impl->updateConnectionParameters(
|
||||
connectionHandle,
|
||||
minConnectionInterval,
|
||||
maxConnectionInterval,
|
||||
slaveLatency,
|
||||
supervision_timeout,
|
||||
minConnectionEventLength,
|
||||
maxConnectionEventLength
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::manageConnectionParametersUpdateRequest(
|
||||
bool userManageConnectionUpdateRequest
|
||||
)
|
||||
{
|
||||
return impl->manageConnectionParametersUpdateRequest(userManageConnectionUpdateRequest);
|
||||
}
|
||||
|
||||
|
||||
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 impl->acceptConnectionParametersUpdate(
|
||||
connectionHandle,
|
||||
minConnectionInterval,
|
||||
maxConnectionInterval,
|
||||
slaveLatency,
|
||||
supervision_timeout,
|
||||
minConnectionEventLength,
|
||||
maxConnectionEventLength
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::rejectConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle
|
||||
)
|
||||
{
|
||||
return impl->rejectConnectionParametersUpdate(connectionHandle);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::disconnect(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
)
|
||||
{
|
||||
return impl->disconnect(connectionHandle, reason);
|
||||
}
|
||||
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
#if BLE_FEATURE_PHY_MANAGEMENT
|
||||
|
||||
ble_error_t Gap::readPhy(connection_handle_t connection)
|
||||
{
|
||||
return impl->readPhy(connection);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::setPreferredPhys(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
)
|
||||
{
|
||||
return impl->setPreferredPhys(txPhys, rxPhys);
|
||||
}
|
||||
|
||||
|
||||
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 impl->setPhy(
|
||||
connection,
|
||||
txPhys,
|
||||
rxPhys,
|
||||
codedSymbol
|
||||
);
|
||||
}
|
||||
|
||||
#endif // BLE_FEATURE_PHY_MANAGEMENT
|
||||
|
||||
#if BLE_FEATURE_PRIVACY
|
||||
|
||||
ble_error_t Gap::enablePrivacy(bool enable)
|
||||
{
|
||||
return impl->enablePrivacy(enable);
|
||||
}
|
||||
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
|
||||
ble_error_t Gap::setPeripheralPrivacyConfiguration(
|
||||
const peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl->setPeripheralPrivacyConfiguration(configuration);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::getPeripheralPrivacyConfiguration(
|
||||
peripheral_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl->getPeripheralPrivacyConfiguration(configuration);
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
||||
ble_error_t Gap::setCentralPrivacyConfiguration(
|
||||
const central_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl->setCentralPrivacyConfiguration(configuration);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::getCentralPrivacyConfiguration(
|
||||
central_privacy_configuration_t *configuration
|
||||
)
|
||||
{
|
||||
return impl->getCentralPrivacyConfiguration(configuration);
|
||||
}
|
||||
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#endif // BLE_FEATURE_PRIVACY
|
||||
|
||||
#if BLE_FEATURE_WHITELIST
|
||||
|
||||
uint8_t Gap::getMaxWhitelistSize() const
|
||||
{
|
||||
return impl->getMaxWhitelistSize();
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::getWhitelist(whitelist_t &whitelist) const
|
||||
{
|
||||
return impl->getWhitelist(whitelist);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::setWhitelist(const whitelist_t &whitelist)
|
||||
{
|
||||
return impl->setWhitelist(whitelist);
|
||||
}
|
||||
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
|
||||
|
||||
ble_error_t Gap::getAddress(
|
||||
own_address_type_t &typeP,
|
||||
address_t &address
|
||||
)
|
||||
{
|
||||
return impl->getAddress(typeP, address);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::getRandomAddressType(
|
||||
const ble::address_t address,
|
||||
ble::random_address_type_t *addressType
|
||||
)
|
||||
{
|
||||
return impl::Gap::getRandomAddressType(address, addressType);
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::reset()
|
||||
{
|
||||
return impl->reset();
|
||||
}
|
||||
|
||||
|
||||
void Gap::onShutdown(const GapShutdownCallback_t &callback)
|
||||
{
|
||||
return impl->onShutdown(callback);
|
||||
}
|
||||
|
||||
|
||||
Gap::GapShutdownCallbackChain_t &Gap::onShutdown()
|
||||
{
|
||||
return impl->onShutdown();
|
||||
}
|
||||
|
||||
|
||||
ble_error_t Gap::setRandomStaticAddress(const ble::address_t &address)
|
||||
{
|
||||
return impl->setRandomStaticAddress(address);
|
||||
}
|
||||
|
||||
} // namespace ble
|
||||
Loading…
Reference in New Issue