mirror of https://github.com/ARMmbed/mbed-os.git
fix toggling off ble feature signing
parent
d147abc3e5
commit
7ba7f3e667
|
@ -26,7 +26,9 @@
|
||||||
#include "source/pal/PalAttClient.h"
|
#include "source/pal/PalAttClient.h"
|
||||||
#include "source/pal/PalSecurityManager.h"
|
#include "source/pal/PalSecurityManager.h"
|
||||||
#include "source/pal/PalGap.h"
|
#include "source/pal/PalGap.h"
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
#include "source/pal/PalSigningMonitor.h"
|
#include "source/pal/PalSigningMonitor.h"
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
#include "source/pal/PalAttClientToGattClient.h"
|
#include "source/pal/PalAttClientToGattClient.h"
|
||||||
|
|
||||||
#include "source/BLEInstanceBaseImpl.h"
|
#include "source/BLEInstanceBaseImpl.h"
|
||||||
|
@ -283,6 +285,7 @@ PalGattClient &BLEInstanceBase::getPalGattClient()
|
||||||
#if BLE_FEATURE_SECURITY
|
#if BLE_FEATURE_SECURITY
|
||||||
ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl()
|
ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl()
|
||||||
{
|
{
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
// Creation of a proxy monitor to let the security manager register to
|
// Creation of a proxy monitor to let the security manager register to
|
||||||
// the gatt client and gatt server.
|
// the gatt client and gatt server.
|
||||||
static struct : ble::PalSigningMonitor {
|
static struct : ble::PalSigningMonitor {
|
||||||
|
@ -296,11 +299,14 @@ ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl()
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
#endif // BLE_FEATURE_GATT_SERVER
|
||||||
}
|
}
|
||||||
} signing_event_monitor;
|
} signing_event_monitor;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
static ble::impl::SecurityManager m_instance(
|
static ble::impl::SecurityManager m_instance(
|
||||||
ble::impl::PalSecurityManager::get_security_manager(),
|
ble::impl::PalSecurityManager::get_security_manager(),
|
||||||
getGapImpl(),
|
getGapImpl()
|
||||||
signing_event_monitor
|
#if BLE_FEATURE_SIGNING
|
||||||
|
, signing_event_monitor
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
, getPrivateAddressRegistry()
|
, getPrivateAddressRegistry()
|
||||||
#endif //BLE_FEATURE_PRIVACY
|
#endif //BLE_FEATURE_PRIVACY
|
||||||
|
|
|
@ -54,8 +54,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace ble {
|
namespace ble {
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
class PalSigningMonitor;
|
class PalSigningMonitor;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
@ -70,8 +71,9 @@ class BLEInstanceBase final : public ble::BLEInstanceBase {
|
||||||
using Timeout = mbed::Timeout;
|
using Timeout = mbed::Timeout;
|
||||||
using Timer = mbed::Timer;
|
using Timer = mbed::Timer;
|
||||||
#endif
|
#endif
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
friend PalSigningMonitor;
|
friend PalSigningMonitor;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construction with an HCI driver.
|
* Construction with an HCI driver.
|
||||||
|
|
|
@ -1629,7 +1629,9 @@ GattServer::GattServer() :
|
||||||
updatesEnabledCallback(nullptr),
|
updatesEnabledCallback(nullptr),
|
||||||
updatesDisabledCallback(nullptr),
|
updatesDisabledCallback(nullptr),
|
||||||
confirmationReceivedCallback(nullptr),
|
confirmationReceivedCallback(nullptr),
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
_signing_event_handler(nullptr),
|
_signing_event_handler(nullptr),
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
cccds(),
|
cccds(),
|
||||||
cccd_values(),
|
cccd_values(),
|
||||||
cccd_handles(),
|
cccd_handles(),
|
||||||
|
@ -1645,12 +1647,14 @@ GattServer::GattServer() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
void GattServer::set_signing_event_handler(
|
void GattServer::set_signing_event_handler(
|
||||||
PalSigningMonitorEventHandler *signing_event_handler
|
PalSigningMonitorEventHandler *signing_event_handler
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_signing_event_handler = signing_event_handler;
|
_signing_event_handler = signing_event_handler;
|
||||||
}
|
}
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
void GattServer::onDataSent(const DataSentCallback_t &callback)
|
void GattServer::onDataSent(const DataSentCallback_t &callback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
|
|
||||||
#include "source/BLEInstanceBase.h"
|
#include "source/BLEInstanceBase.h"
|
||||||
#include "source/generic/GattServerEvents.h"
|
#include "source/generic/GattServerEvents.h"
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
#include "source/pal/PalSigningMonitor.h"
|
#include "source/pal/PalSigningMonitor.h"
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
namespace ble {
|
namespace ble {
|
||||||
|
|
||||||
|
@ -49,10 +51,16 @@ class PalGenericAccessService;
|
||||||
class BLE;
|
class BLE;
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
class GattServer : public PalSigningMonitor {
|
class GattServer
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
|
: public PalSigningMonitor
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
{
|
||||||
friend ble::BLE;
|
friend ble::BLE;
|
||||||
friend ble::PalAttClient;
|
friend ble::PalAttClient;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
friend PalSigningMonitor;
|
friend PalSigningMonitor;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
friend PalGenericAccessService;
|
friend PalGenericAccessService;
|
||||||
|
|
||||||
using EventHandler = ble::GattServer::EventHandler;
|
using EventHandler = ble::GattServer::EventHandler;
|
||||||
|
@ -214,11 +222,11 @@ public:
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
static uint8_t atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle);
|
static uint8_t atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle);
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
void set_signing_event_handler(
|
void set_signing_event_handler(
|
||||||
PalSigningMonitorEventHandler *signing_event_handler
|
PalSigningMonitorEventHandler *signing_event_handler
|
||||||
) override;
|
) override;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
private:
|
private:
|
||||||
|
|
||||||
GattServer();
|
GattServer();
|
||||||
|
@ -361,8 +369,9 @@ private:
|
||||||
* The registered callback handler for confirmation received events.
|
* The registered callback handler for confirmation received events.
|
||||||
*/
|
*/
|
||||||
EventCallback_t confirmationReceivedCallback;
|
EventCallback_t confirmationReceivedCallback;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
PalSigningMonitorEventHandler *_signing_event_handler;
|
PalSigningMonitorEventHandler *_signing_event_handler;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
attsCccSet_t cccds[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
|
attsCccSet_t cccds[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
|
||||||
uint16_t cccd_values[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
|
uint16_t cccd_values[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT];
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
#include "ble/gatt/CharacteristicDescriptorDiscovery.h"
|
#include "ble/gatt/CharacteristicDescriptorDiscovery.h"
|
||||||
#include "ble/gatt/GattCallbackParamTypes.h"
|
#include "ble/gatt/GattCallbackParamTypes.h"
|
||||||
#include "source/pal/PalGattClient.h"
|
#include "source/pal/PalGattClient.h"
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
#include "source/pal/PalSigningMonitor.h"
|
#include "source/pal/PalSigningMonitor.h"
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
#include "ble/GattClient.h"
|
#include "ble/GattClient.h"
|
||||||
|
|
||||||
namespace ble {
|
namespace ble {
|
||||||
|
@ -40,9 +42,13 @@ class BLEInstanceBase;
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
class GattClient :
|
class GattClient :
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
public PalSigningMonitor,
|
public PalSigningMonitor,
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
public PalGattClientEventHandler {
|
public PalGattClientEventHandler {
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
friend PalSigningMonitor;
|
friend PalSigningMonitor;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
friend BLEInstanceBase;
|
friend BLEInstanceBase;
|
||||||
public:
|
public:
|
||||||
using EventHandler = ble::GattClient::EventHandler;
|
using EventHandler = ble::GattClient::EventHandler;
|
||||||
|
@ -163,11 +169,12 @@ private:
|
||||||
/* private implementation follows */
|
/* private implementation follows */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see ble::PalSigningMonitor::set_signing_event_handler
|
* @see ble::PalSigningMonitor::set_signing_event_handler
|
||||||
*/
|
*/
|
||||||
void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler) override;
|
void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler) override;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see PalGattClient::EventHandler::on_att_mtu_change
|
* @see PalGattClient::EventHandler::on_att_mtu_change
|
||||||
*/
|
*/
|
||||||
|
@ -244,7 +251,9 @@ private:
|
||||||
|
|
||||||
PalGattClient &_pal_client;
|
PalGattClient &_pal_client;
|
||||||
ServiceDiscovery::TerminationCallback_t _termination_callback;
|
ServiceDiscovery::TerminationCallback_t _termination_callback;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
PalSigningMonitorEventHandler *_signing_event_handler;
|
PalSigningMonitorEventHandler *_signing_event_handler;
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
mutable ProcedureControlBlock *control_blocks;
|
mutable ProcedureControlBlock *control_blocks;
|
||||||
bool _is_reseting;
|
bool _is_reseting;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
|
|
||||||
#include "source/pal/GapTypes.h"
|
#include "source/pal/GapTypes.h"
|
||||||
#include "source/pal/PalConnectionMonitor.h"
|
#include "source/pal/PalConnectionMonitor.h"
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
#include "source/pal/PalSigningMonitor.h"
|
#include "source/pal/PalSigningMonitor.h"
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
#include "source/pal/PalSecurityManager.h"
|
#include "source/pal/PalSecurityManager.h"
|
||||||
|
|
||||||
#include "source/generic/SecurityDb.h"
|
#include "source/generic/SecurityDb.h"
|
||||||
|
@ -479,15 +481,19 @@ private:
|
||||||
public:
|
public:
|
||||||
SecurityManager(
|
SecurityManager(
|
||||||
ble::PalSecurityManager &palImpl,
|
ble::PalSecurityManager &palImpl,
|
||||||
ble::PalConnectionMonitor &connMonitorImpl,
|
ble::PalConnectionMonitor &connMonitorImpl
|
||||||
ble::PalSigningMonitor &signingMonitorImpl
|
#if BLE_FEATURE_SIGNING
|
||||||
|
, ble::PalSigningMonitor &signingMonitorImpl
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
, PrivateAddressController &privateAddressController
|
, PrivateAddressController &privateAddressController
|
||||||
#endif // BLE_FEATURE_PRIVACY
|
#endif // BLE_FEATURE_PRIVACY
|
||||||
) : eventHandler(nullptr),
|
) : eventHandler(nullptr),
|
||||||
_pal(palImpl),
|
_pal(palImpl),
|
||||||
_connection_monitor(connMonitorImpl),
|
_connection_monitor(connMonitorImpl),
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
_signing_monitor(signingMonitorImpl),
|
_signing_monitor(signingMonitorImpl),
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
_db(nullptr),
|
_db(nullptr),
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
_private_address_controller(privateAddressController),
|
_private_address_controller(privateAddressController),
|
||||||
|
@ -681,7 +687,9 @@ private:
|
||||||
|
|
||||||
PalSecurityManager &_pal;
|
PalSecurityManager &_pal;
|
||||||
PalConnectionMonitor &_connection_monitor;
|
PalConnectionMonitor &_connection_monitor;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
PalSigningMonitor &_signing_monitor;
|
PalSigningMonitor &_signing_monitor;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
SecurityDb *_db;
|
SecurityDb *_db;
|
||||||
#if BLE_FEATURE_PRIVACY
|
#if BLE_FEATURE_PRIVACY
|
||||||
|
|
|
@ -184,7 +184,7 @@ ble_error_t PalAttClientToGattClient::write_without_response(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
ble_error_t PalAttClientToGattClient::signed_write_without_response(
|
ble_error_t PalAttClientToGattClient::signed_write_without_response(
|
||||||
connection_handle_t connection_handle,
|
connection_handle_t connection_handle,
|
||||||
attribute_handle_t characteristic_value_handle,
|
attribute_handle_t characteristic_value_handle,
|
||||||
|
@ -197,7 +197,7 @@ ble_error_t PalAttClientToGattClient::signed_write_without_response(
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
ble_error_t PalAttClientToGattClient::write_attribute(
|
ble_error_t PalAttClientToGattClient::write_attribute(
|
||||||
connection_handle_t connection_handle,
|
connection_handle_t connection_handle,
|
||||||
|
|
|
@ -140,7 +140,7 @@ public:
|
||||||
attribute_handle_t characteristic_value_handle,
|
attribute_handle_t characteristic_value_handle,
|
||||||
const Span<const uint8_t>& value
|
const Span<const uint8_t>& value
|
||||||
) override;
|
) override;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see ble::PalGattClient::signed_write_without_response
|
* @see ble::PalGattClient::signed_write_without_response
|
||||||
*/
|
*/
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
attribute_handle_t characteristic_value_handle,
|
attribute_handle_t characteristic_value_handle,
|
||||||
const Span<const uint8_t>& value
|
const Span<const uint8_t>& value
|
||||||
) override;
|
) override;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see ble::PalGattClient::write_attribute
|
* @see ble::PalGattClient::write_attribute
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -472,7 +472,7 @@ public:
|
||||||
attribute_handle_t characteristic_value_handle,
|
attribute_handle_t characteristic_value_handle,
|
||||||
const Span<const uint8_t>& value
|
const Span<const uint8_t>& value
|
||||||
) = 0;
|
) = 0;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* Send a Signed Write without Response command to the server.
|
* Send a Signed Write without Response command to the server.
|
||||||
*
|
*
|
||||||
|
@ -494,7 +494,7 @@ public:
|
||||||
attribute_handle_t characteristic_value_handle,
|
attribute_handle_t characteristic_value_handle,
|
||||||
const Span<const uint8_t>& value
|
const Span<const uint8_t>& value
|
||||||
) = 0;
|
) = 0;
|
||||||
|
#endif //BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* Send a write request to the server.
|
* Send a write request to the server.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue