Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ble conf #9790

Merged
merged 100 commits into from Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
bc098d0
BLE - add static interface helper.
pan- Feb 25, 2019
7e78433
BLE - replace some usages of Gap::Handle_t by ble::connection_handle_t
pan- Feb 25, 2019
333a315
BLE - devirtualize pal::AttClient
pan- Feb 25, 2019
71b8d8a
BLE - devirtualize pal::AttClientToGattClientAdapter
pan- Feb 25, 2019
6514bbd
BLE - Devirtualize pal::ConnectionEventMonitor
pan- Feb 25, 2019
0749100
BLE - Devirtualize pal::Gap
pan- Feb 25, 2019
e1371f8
BLE - Devirtualize pal::GattClient
pan- Feb 25, 2019
50de4c8
BLE - Devirtualize pal::SecurityManager
pan- Feb 25, 2019
2d007ee
BLE - Devirtualize pal::SigningEventMonitor
pan- Feb 25, 2019
1ad7263
BLE - Devirtualization of ::Gap
pan- Feb 25, 2019
43e87fb
BLE - Devirtualize ::ble::Gap
pan- Feb 25, 2019
e56fd68
BLE - Devirtualize ::GattClient
pan- Feb 25, 2019
6d2592a
BLE - Devirtualize ::GattServer.
pan- Feb 25, 2019
7796e73
BLE - Devirtualize ::SecurityManager
pan- Feb 25, 2019
fb39848
BLE - Cleanup deprecation implementation bits in BLE.cpp
pan- Feb 25, 2019
e70fb27
BLE - cleanup includes.
pan- Feb 25, 2019
39e938b
BLE - Devirtualize ble::generic::GenericGap
pan- Feb 25, 2019
b135074
BLE - Devirtualize ble::generic::GattClient
pan- Feb 25, 2019
04d26f7
BLE - Devirtualize ::ble::generic::GenericSecurityManager
pan- Feb 25, 2019
536443b
BLE - Devirtualization of the Cordio port.
pan- Feb 25, 2019
0323d91
BLE - Devirtualization of the Maxim port .
pan- Feb 25, 2019
b86049d
BLE - Devirtualization of the legacy NRF51822 port.
pan- Feb 25, 2019
ddbb177
BLE - Devirtualization of the NRF51 port.
pan- Feb 25, 2019
9ab2849
BLE - Devirtualization of the NRF52 softdevice port.
pan- Feb 25, 2019
c7169b0
BLE - accept tpp extensions for header files.
pan- Feb 25, 2019
73f29e7
BLE - Fix qualification of abort and terminate.
pan- Feb 26, 2019
e898d88
feat(ble): Add configuration options for enabling/disabling BLE roles
Jan 6, 2019
9806f91
feat(ble): Add preprocessor check to determine enabled roles are valid
Jan 6, 2019
6e301ce
feat(ble): Guard out GattClient code when role is disabled
Jan 8, 2019
73f7ffb
feat(ble): Guard out GattServer code when role is disabled
Jan 10, 2019
5d73a03
feat(ble): Guard out SecurityManager code when role is disabled
Jan 12, 2019
72d28d9
feat(ble): Guard out Observer code when role is disabled
Jan 12, 2019
8e36ed4
feat(ble): Guard out the CordioBLE initialisation code
Jan 17, 2019
aefab05
add all the features and rename existing non-roles to features
paul-szczepanek-arm Feb 6, 2019
212e947
require at least one role observer or broadcaster
paul-szczepanek-arm Feb 6, 2019
ab4e476
move config to ble feature
paul-szczepanek-arm Feb 6, 2019
9a22db0
implied features
paul-szczepanek-arm Feb 6, 2019
26cc72f
add more feature toggles in cordio init
paul-szczepanek-arm Feb 6, 2019
b60eaf1
require macros to be defined
paul-szczepanek-arm Feb 6, 2019
bed5678
connectable is a feature not role
paul-szczepanek-arm Feb 6, 2019
5a97706
added #if guards to cordio ble
paul-szczepanek-arm Feb 7, 2019
dc3aba1
fix BLE_CONNECTABLE_FEATURE macro
paul-szczepanek-arm Feb 7, 2019
bc69e15
revert accidental changes
paul-szczepanek-arm Feb 7, 2019
33e8826
whitelist feature
paul-szczepanek-arm Feb 7, 2019
3e03c11
guard class fields with ifs
paul-szczepanek-arm Feb 11, 2019
208eb20
gatt client signing
paul-szczepanek-arm Feb 11, 2019
7974726
fixed conf file (tabs and order)
paul-szczepanek-arm Feb 12, 2019
cb3d79b
update descriptions
paul-szczepanek-arm Feb 18, 2019
9e710d4
git review changes
paul-szczepanek-arm Feb 20, 2019
30ad32a
ifdef out security features
paul-szczepanek-arm Feb 21, 2019
c8d8c4e
merge failure fix
paul-szczepanek-arm Feb 21, 2019
1d5b7d4
ifdef source files based on features
paul-szczepanek-arm Feb 21, 2019
630b2fe
more gap ifdefs
paul-szczepanek-arm Feb 21, 2019
909b78f
complete gap feature ifdef
paul-szczepanek-arm Feb 21, 2019
e44c3ed
fix gap ifdefs
paul-szczepanek-arm Feb 21, 2019
c198603
ble ifdefs
paul-szczepanek-arm Feb 21, 2019
eb16fb6
broadcaster role cordio pass
paul-szczepanek-arm Feb 22, 2019
45eca7c
cordio observer role pass
paul-szczepanek-arm Feb 22, 2019
ec6783e
cordio peripheral role pass
paul-szczepanek-arm Feb 22, 2019
e950da1
extended doesn't depends on phy
paul-szczepanek-arm Feb 22, 2019
c3a7207
cordio extended peripheral pass
paul-szczepanek-arm Feb 22, 2019
a1815e3
correct dependencies for central and peripheral
paul-szczepanek-arm Feb 22, 2019
bc3ff56
partial security pass
paul-szczepanek-arm Feb 22, 2019
aa6342b
cordio security pass
paul-szczepanek-arm Feb 22, 2019
f8c28fc
privacy pass
paul-szczepanek-arm Feb 25, 2019
a034bf8
gatt server pass
paul-szczepanek-arm Feb 25, 2019
cd2501b
tab fix
paul-szczepanek-arm Feb 25, 2019
ba9aa6b
Fix rebase mistakes.
pan- Feb 27, 2019
06b26d4
BLE - remove conditional directive from value types
pan- Feb 28, 2019
3c9e778
BLE - Remove conditionnal directive within services
pan- Feb 28, 2019
bc10a09
BLE - Remove conditional directive removing functions in pal.
pan- Feb 28, 2019
126a7a9
BLE - Cleanup conditional directives in gap/Gap/
pan- Feb 28, 2019
c9d719a
BLE - Cleanup conditional directives in Gap.
pan- Feb 28, 2019
f7df97b
BLE - Remove conditionnal directive within GattClient::WriteOp_t
pan- Feb 28, 2019
593cf2b
BLE - Remove conditional compilation of FileSecurityDb
pan- Feb 28, 2019
07f3ca2
BLE - Cleanup GenericGap conditional directive
pan- Feb 28, 2019
e706b6c
BLE - Cleanup Generic GattClient conditional directives.
pan- Feb 28, 2019
831241d
BLE - Cleanup GenericSecurityManager conditional directives
pan- Feb 28, 2019
dedc204
BLE - Cleanup CordioGattServer conditional directives.
pan- Feb 28, 2019
b0d62a7
BLE - Fix conditional code within CordioPalGenericAccessService.
pan- Feb 28, 2019
a31d101
BLE - Cleanup CordioPalSecurityManager conditional directives.
pan- Feb 28, 2019
9e5e23a
BLE - Remove conditional directive in construction of Cordio objects.
pan- Feb 28, 2019
632851e
BLE - Small reordering to reduce diff.
pan- Feb 28, 2019
eeb14c5
BLE - Conditionally include address rotation at compile time
pan- Feb 28, 2019
ca44ce3
BLE - Conditionally expose SecurityManager::enableSigning
pan- Feb 28, 2019
af09f7b
BLE - Disable peer csrk retrieval if signing disabled.
pan- Feb 28, 2019
020c5b4
BLE - Disabling SecurityManager connection handling when security dis…
pan- Feb 28, 2019
20c4e4c
BLE - Fix call to implementation.
pan- Feb 28, 2019
6a3f3d1
BLE - Conditionnally remove LESC and privacy event processing.
pan- Feb 28, 2019
9566af6
BLE - Fix initialization of extended advertising modules.
pan- Feb 28, 2019
ea9554d
BLE - restrict AttConnRegister to GattServer.
pan- Feb 28, 2019
04891b2
BLE - Conditionally handle gap events.
pan- Feb 28, 2019
24f7f36
BLE - Return supported feature based on compile time features.
pan- Feb 28, 2019
5ae59fc
BLE - Improve FEATURE_PRIVACY conditions.
pan- Feb 28, 2019
3142f26
BLE - Exclude services if GattServer is not available.
pan- Feb 28, 2019
eeca03f
BLE - Fix exclusion of getMaxAdvertisingSetNumber and getMaxAdvertisi…
pan- Feb 28, 2019
74bc677
BLE - Fix conditional directive.
pan- Feb 28, 2019
4e172ba
BLE - Fix conditional directive.
pan- Feb 28, 2019
72e5d3f
BLE - Filter user facing implementation based on configuration
pan- Feb 28, 2019
54a866c
add broadcaster ifdef and pull headers into ifdef
paul-szczepanek-arm Feb 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 35 additions & 3 deletions features/FEATURE_BLE/ble/BLE.h
Expand Up @@ -17,11 +17,13 @@
#ifndef MBED_BLE_H__
#define MBED_BLE_H__

#include "BLERoles.h"

#include "blecommon.h"
#include "ble/Gap.h"
#include "GattServer.h"
#include "GattClient.h"
#include "SecurityManager.h"
#include "ble/GattServer.h"
#include "ble/GattClient.h"
#include "ble/SecurityManager.h"

#include "ble/FunctionPointerWithContext.h"

Expand Down Expand Up @@ -355,6 +357,7 @@ class BLE {
*/
const Gap &gap() const;

#if BLE_FEATURE_GATT_SERVER
/**
* Accessor to GattServer. All GattServer related functionality requires
* going through this accessor.
Expand All @@ -370,7 +373,9 @@ class BLE {
* instance.
*/
const GattServer &gattServer() const;
#endif // BLE_FEATURE_GATT_SERVER

#if BLE_FEATURE_GATT_CLIENT
/**
* Accessors to GattClient. All GattClient related functionality requires
* going through this accessor.
Expand All @@ -386,7 +391,9 @@ class BLE {
* instance.
*/
const GattClient &gattClient() const;
#endif // BLE_FEATURE_GATT_CLIENT

#if BLE_FEATURE_SECURITY
/**
* Accessors to SecurityManager. All SecurityManager-related functionality
* requires going through this accessor.
Expand All @@ -403,6 +410,7 @@ class BLE {
* BLE instance.
*/
const SecurityManager &securityManager() const;
#endif // BLE_FEATURE_SECURITY

/**
* Translate error code into a printable string.
Expand Down Expand Up @@ -489,6 +497,7 @@ class BLE {
return gap().getAddress(typeP, address);
}

#if BLE_ROLE_BROADCASTER
/**
* Set the GAP advertising mode to use for this device.
*
Expand Down Expand Up @@ -834,7 +843,9 @@ class BLE {
*/
MBED_DEPRECATED("Use ble.gap().stopAdvertising(...)")
ble_error_t stopAdvertising(void);
#endif // BLE_ROLE_BROADCASTER

#if BLE_ROLE_OBSERVER
/**
* Set up parameters for GAP scanning (observer mode).
*
Expand Down Expand Up @@ -1032,7 +1043,9 @@ class BLE {
{
return gap().stopScan();
}
#endif // BLE_ROLE_OBSERVER

#if BLE_ROLE_CENTRAL
/**
* Create a connection (GAP Link Establishment).
*
Expand Down Expand Up @@ -1061,7 +1074,9 @@ class BLE {
const Gap::ConnectionParams_t *connectionParams = NULL,
const GapScanningParams *scanParams = NULL
);
#endif // BLE_ROLE_CENTRAL

#if BLE_FEATURE_CONNECTABLE
/**
* This call initiates the disconnection procedure, and its completion is
* communicated to the application with an invocation of the
Expand Down Expand Up @@ -1104,6 +1119,7 @@ class BLE {
*/
MBED_DEPRECATED("Use ble.gap().disconnect(...)")
ble_error_t disconnect(Gap::DisconnectionReason_t reason);
#endif // BLE_FEATURE_CONNECTABLE

/**
* Returns the current Gap state of the device using a bitmask that
Expand All @@ -1119,6 +1135,8 @@ class BLE {
MBED_DEPRECATED("Use ble.gap().getState()")
Gap::GapState_t getGapState(void) const;

#if BLE_FEATURE_CONNECTABLE
#if BLE_FEATURE_GATT_SERVER
/**
* Get the GAP peripheral's preferred connection parameters. These are the
* defaults that the peripheral would like to have in a connection. The
Expand Down Expand Up @@ -1163,6 +1181,7 @@ class BLE {
{
return gap().setPreferredConnectionParams(params);
}
#endif // BLE_FEATURE_GATT_SERVER

/**
* Update connection parameters while in the peripheral role.
Expand All @@ -1185,7 +1204,9 @@ class BLE {
*/
MBED_DEPRECATED("Use ble.gap().updateConnectionParams(...)")
ble_error_t updateConnectionParams(Gap::Handle_t handle, const Gap::ConnectionParams_t *params);
#endif // BLE_FEATURE_CONNECTABLE

#if BLE_FEATURE_GATT_SERVER
/**
* Set the device name characteristic in the Gap service.
*
Expand Down Expand Up @@ -1276,6 +1297,7 @@ class BLE {
{
return gap().getAppearance(appearanceP);
}
#endif // BLE_FEATURE_GATT_SERVER

/**
* Set the radio's transmit power.
Expand Down Expand Up @@ -1309,6 +1331,7 @@ class BLE {
MBED_DEPRECATED("Use ble.gap().getPermittedTxPowerValues(...)")
void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP);

#if BLE_FEATURE_GATT_SERVER
/**
* Add a service declaration to the local server ATT table. Also add the
* characteristics contained within.
Expand Down Expand Up @@ -1467,7 +1490,9 @@ class BLE {
{
return gattServer().write(connectionHandle, attributeHandle, value, size, localOnly);
}
#endif // BLE_FEATURE_GATT_SERVER

#if BLE_FEATURE_SECURITY
/**
* Enable the BLE stack's Security Manager. The Security Manager implements
* the cryptographic algorithms and protocol exchanges that allow two
Expand Down Expand Up @@ -1536,6 +1561,7 @@ class BLE {
{
return securityManager().purgeAllBondingState();
}
#endif // BLE_FEATURE_SECURITY

/**
* Set up a callback for timeout events. Refer to Gap::TimeoutSource_t for
Expand All @@ -1551,6 +1577,7 @@ class BLE {
MBED_DEPRECATED("ble.gap().onTimeout(callback)")
void onTimeout(Gap::TimeoutEventCallback_t timeoutCallback);

#if BLE_FEATURE_CONNECTABLE
/**
* Set up a callback for connection events. Refer to Gap::ConnectionEventCallback_t.
*
Expand Down Expand Up @@ -1595,6 +1622,7 @@ class BLE {
{
gap().onDisconnection(tptr, mptr);
}
#endif // BLE_FEATURE_CONNECTABLE

/**
* Radio Notification is a feature that enables ACTIVE and INACTIVE
Expand All @@ -1620,6 +1648,7 @@ class BLE {
MBED_DEPRECATED("ble.gap().onRadioNotification(...)")
void onRadioNotification(void (*callback)(bool));

#if BLE_FEATURE_GATT_SERVER
/**
* Add a callback for the GATT event DATA_SENT (which is triggered when
* updates are sent out by GATT in the form of notifications).
Expand Down Expand Up @@ -1821,7 +1850,9 @@ class BLE {
{
gattServer().onConfirmationReceived(callback);
}
#endif // BLE_FEATURE_GATT_SERVER

#if BLE_FEATURE_SECURITY
/**
* Set up a callback for when the security setup procedure (key generation
* and exchange) for a link has started. This will be skipped for bonded
Expand Down Expand Up @@ -1918,6 +1949,7 @@ class BLE {
{
return securityManager().onPasskeyDisplay(callback);
}
#endif // BLE_FEATURE_SECURITY

private:
friend class BLEInstanceBase;
Expand Down
15 changes: 11 additions & 4 deletions features/FEATURE_BLE/ble/BLEInstanceBase.h
Expand Up @@ -21,13 +21,13 @@
#ifndef MBED_BLE_DEVICE_INSTANCE_BASE__
#define MBED_BLE_DEVICE_INSTANCE_BASE__

#include "ble/BLE.h"
#include "ble/Gap.h"
#include "ble/SecurityManager.h"
#include "ble/BLE.h"
#include "ble/GattServer.h"
#include "ble/GattClient.h"


/* Forward declarations. */
class GattServer;
class GattClient;

/**
* @addtogroup ble
Expand Down Expand Up @@ -183,6 +183,8 @@ class BLEInstanceBase
*/
virtual const Gap &getGap(void) const = 0;


#if BLE_FEATURE_GATT_SERVER
/**
* Accessor to the vendor implementation of the GattServer interface.
*
Expand All @@ -202,7 +204,9 @@ class BLEInstanceBase
* @see BLE::gattServer() GattServer
*/
virtual const GattServer &getGattServer(void) const = 0;
#endif // BLE_FEATURE_GATT_SERVER

#if BLE_FEATURE_GATT_CLIENT
/**
* Accessor to the vendor implementation of the GattClient interface.
*
Expand All @@ -212,7 +216,9 @@ class BLEInstanceBase
* @see BLE::gattClient() GattClient
*/
virtual GattClient &getGattClient(void) = 0;
#endif

#if BLE_FEATURE_SECURITY
/**
* Accessor to the vendor implementation of the SecurityManager interface.
*
Expand All @@ -232,6 +238,7 @@ class BLEInstanceBase
* @see BLE::securityManager() SecurityManager
*/
virtual const SecurityManager &getSecurityManager(void) const = 0;
#endif // BLE_FEATURE_SECURITY

/**
* Process pending events present in the vendor subsystem; then, put the MCU
Expand Down
76 changes: 76 additions & 0 deletions features/FEATURE_BLE/ble/BLERoles.h
@@ -0,0 +1,76 @@
#ifndef MBED_BLE_ROLES_H__
#define MBED_BLE_ROLES_H__

#if !(BLE_ROLE_OBSERVER) && !(BLE_ROLE_BROADCASTER)
#error "BLE requires at least one role 'BROADCASTER' or 'OBSERVER' to be enabled"
#endif

#if (BLE_ROLE_PERIPHERAL) || (BLE_ROLE_CENTRAL)
#define BLE_FEATURE_CONNECTABLE 1
#endif

#if (BLE_FEATURE_GATT_CLIENT) || (BLE_FEATURE_GATT_SERVER)
#define BLE_FEATURE_ATT 1
#endif

#if BLE_ROLE_PERIPHERAL
#if !(BLE_ROLE_BROADCASTER)
#error "BLE role 'PERIPHERAL' depends on role 'BROADCASTER'"
#endif
#endif // BLE_ROLE_PERIPHERAL

#if BLE_ROLE_CENTRAL
#if !(BLE_ROLE_OBSERVER)
#error "BLE role 'CENTRAL' depends on role 'OBSERVER'"
#endif
#endif // BLE_ROLE_CENTRAL

#if BLE_FEATURE_SECURITY
#if !(BLE_ROLE_PERIPHERAL) && !(BLE_ROLE_CENTRAL)
#error "BLE feature 'SECURITY' requires 'PERIPHERAL' or 'CENTRAL' role"
#endif
#endif // BLE_FEATURE_SECURITY

#if BLE_FEATURE_SECURE_CONNECTIONS
#if !(BLE_FEATURE_SECURITY)
#error "BLE feature 'SECURE CONNECTIONS' requires the 'SECURITY' feature"
#endif
#endif // BLE_FEATURE_SECURE_CONNECTIONS

#if BLE_FEATURE_SIGNING
#if !(BLE_FEATURE_SECURITY)
#error "BLE feature 'SIGNING' requires the 'SECURITY' feature"
#endif
#endif // BLE_FEATURE_SIGNING

#if BLE_FEATURE_WHITELIST
#if !(BLE_FEATURE_SECURITY)
#error "BLE feature 'WHITELIST' requires the 'SECURITY' feature"
#endif
#endif // BLE_FEATURE_WHITELIST

#if BLE_FEATURE_PRIVACY
#if !(BLE_FEATURE_SECURITY)
#error "BLE feature 'PRIVACY' requires the 'SECURITY' feature"
#endif
#endif // BLE_FEATURE_PRIVACY

#if BLE_FEATURE_PERIODIC_ADVERTISING
#if !(BLE_FEATURE_EXTENDED_ADVERTISING)
#error "BLE feature 'PERIODIC ADVERTISING' requires the 'EXTENDED ADVERTISING' feature"
#endif
#endif // BLE_FEATURE_PERIODIC_ADVERTISING

#if BLE_FEATURE_GATT_CLIENT
#if !(BLE_FEATURE_CONNECTABLE)
#error "BLE feature 'GATT CLIENT' requires 'PERIPHERAL' or 'CENTRAL' role"
#endif
#endif // BLE_FEATURE_GATT_CLIENT

#if BLE_FEATURE_GATT_SERVER
#if !(BLE_FEATURE_CONNECTABLE)
#error "BLE feature 'GATT SERVER' requires 'PERIPHERAL' or 'CENTRAL' role"
#endif
#endif // BLE_FEATURE_GATT_SERVER

#endif // MBED_BLE_ROLES_H__
4 changes: 2 additions & 2 deletions features/FEATURE_BLE/ble/DiscoveredCharacteristic.h
Expand Up @@ -537,7 +537,7 @@ class DiscoveredCharacteristic {
* @return Connection handle to the GattServer, which contains this
* characteristic.
*/
Gap::Handle_t getConnectionHandle() const
ble::connection_handle_t getConnectionHandle() const
{
return connHandle;
}
Expand Down Expand Up @@ -625,7 +625,7 @@ class DiscoveredCharacteristic {
/**
* Handle of the connection where the characteristic was discovered.
*/
Gap::Handle_t connHandle;
ble::connection_handle_t connHandle;
};

/**
Expand Down
6 changes: 3 additions & 3 deletions features/FEATURE_BLE/ble/DiscoveredCharacteristicDescriptor.h
Expand Up @@ -73,7 +73,7 @@ class DiscoveredCharacteristicDescriptor {
*/
DiscoveredCharacteristicDescriptor(
GattClient *client,
Gap::Handle_t connectionHandle,
ble::connection_handle_t connectionHandle,
GattAttribute::Handle_t attributeHandle,
const UUID &uuid
) : _client(client),
Expand Down Expand Up @@ -109,7 +109,7 @@ class DiscoveredCharacteristicDescriptor {
* @return the connection handle to the GattServer containing this
* descriptor.
*/
Gap::Handle_t getConnectionHandle() const
ble::connection_handle_t getConnectionHandle() const
{
return _connectionHandle;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ class DiscoveredCharacteristicDescriptor {

private:
GattClient *_client;
Gap::Handle_t _connectionHandle;
ble::connection_handle_t _connectionHandle;
UUID _uuid;
GattAttribute::Handle_t _gattHandle;
};
Expand Down