1717#ifndef MBED_BLE_H__
1818#define MBED_BLE_H__
1919
20+ #include " BLERoles.h"
21+
2022#include " blecommon.h"
2123#include " ble/Gap.h"
2224#include " ble/GattServer.h"
@@ -355,6 +357,7 @@ class BLE {
355357 */
356358 const Gap &gap () const ;
357359
360+ #if BLE_FEATURE_GATT_SERVER
358361 /* *
359362 * Accessor to GattServer. All GattServer related functionality requires
360363 * going through this accessor.
@@ -370,7 +373,9 @@ class BLE {
370373 * instance.
371374 */
372375 const GattServer &gattServer () const ;
376+ #endif // BLE_FEATURE_GATT_SERVER
373377
378+ #if BLE_FEATURE_GATT_CLIENT
374379 /* *
375380 * Accessors to GattClient. All GattClient related functionality requires
376381 * going through this accessor.
@@ -386,7 +391,9 @@ class BLE {
386391 * instance.
387392 */
388393 const GattClient &gattClient () const ;
394+ #endif // BLE_FEATURE_GATT_CLIENT
389395
396+ #if BLE_FEATURE_SECURITY
390397 /* *
391398 * Accessors to SecurityManager. All SecurityManager-related functionality
392399 * requires going through this accessor.
@@ -403,6 +410,7 @@ class BLE {
403410 * BLE instance.
404411 */
405412 const SecurityManager &securityManager () const ;
413+ #endif // BLE_FEATURE_SECURITY
406414
407415 /* *
408416 * Translate error code into a printable string.
@@ -489,6 +497,7 @@ class BLE {
489497 return gap ().getAddress (typeP, address);
490498 }
491499
500+ #if BLE_ROLE_BROADCASTER
492501 /* *
493502 * Set the GAP advertising mode to use for this device.
494503 *
@@ -834,7 +843,9 @@ class BLE {
834843 */
835844 MBED_DEPRECATED (" Use ble.gap().stopAdvertising(...)" )
836845 ble_error_t stopAdvertising(void );
846+ #endif // BLE_ROLE_BROADCASTER
837847
848+ #if BLE_ROLE_OBSERVER
838849 /* *
839850 * Set up parameters for GAP scanning (observer mode).
840851 *
@@ -1032,7 +1043,9 @@ class BLE {
10321043 {
10331044 return gap ().stopScan ();
10341045 }
1046+ #endif // BLE_ROLE_OBSERVER
10351047
1048+ #if BLE_ROLE_CENTRAL
10361049 /* *
10371050 * Create a connection (GAP Link Establishment).
10381051 *
@@ -1061,7 +1074,9 @@ class BLE {
10611074 const Gap::ConnectionParams_t *connectionParams = NULL ,
10621075 const GapScanningParams *scanParams = NULL
10631076 );
1077+ #endif // BLE_ROLE_CENTRAL
10641078
1079+ #if BLE_FEATURE_CONNECTABLE
10651080 /* *
10661081 * This call initiates the disconnection procedure, and its completion is
10671082 * communicated to the application with an invocation of the
@@ -1104,6 +1119,7 @@ class BLE {
11041119 */
11051120 MBED_DEPRECATED (" Use ble.gap().disconnect(...)" )
11061121 ble_error_t disconnect(Gap::DisconnectionReason_t reason);
1122+ #endif // BLE_FEATURE_CONNECTABLE
11071123
11081124 /* *
11091125 * Returns the current Gap state of the device using a bitmask that
@@ -1119,6 +1135,8 @@ class BLE {
11191135 MBED_DEPRECATED (" Use ble.gap().getState()" )
11201136 Gap::GapState_t getGapState (void ) const ;
11211137
1138+ #if BLE_FEATURE_CONNECTABLE
1139+ #if BLE_FEATURE_GATT_SERVER
11221140 /* *
11231141 * Get the GAP peripheral's preferred connection parameters. These are the
11241142 * defaults that the peripheral would like to have in a connection. The
@@ -1163,6 +1181,7 @@ class BLE {
11631181 {
11641182 return gap ().setPreferredConnectionParams (params);
11651183 }
1184+ #endif // BLE_FEATURE_GATT_SERVER
11661185
11671186 /* *
11681187 * Update connection parameters while in the peripheral role.
@@ -1185,7 +1204,9 @@ class BLE {
11851204 */
11861205 MBED_DEPRECATED (" Use ble.gap().updateConnectionParams(...)" )
11871206 ble_error_t updateConnectionParams(Gap::Handle_t handle, const Gap::ConnectionParams_t *params);
1207+ #endif // BLE_FEATURE_CONNECTABLE
11881208
1209+ #if BLE_FEATURE_GATT_SERVER
11891210 /* *
11901211 * Set the device name characteristic in the Gap service.
11911212 *
@@ -1276,6 +1297,7 @@ class BLE {
12761297 {
12771298 return gap ().getAppearance (appearanceP);
12781299 }
1300+ #endif // BLE_FEATURE_GATT_SERVER
12791301
12801302 /* *
12811303 * Set the radio's transmit power.
@@ -1309,6 +1331,7 @@ class BLE {
13091331 MBED_DEPRECATED (" Use ble.gap().getPermittedTxPowerValues(...)" )
13101332 void getPermittedTxPowerValues (const int8_t **valueArrayPP, size_t *countP);
13111333
1334+ #if BLE_FEATURE_GATT_SERVER
13121335 /* *
13131336 * Add a service declaration to the local server ATT table. Also add the
13141337 * characteristics contained within.
@@ -1467,7 +1490,9 @@ class BLE {
14671490 {
14681491 return gattServer ().write (connectionHandle, attributeHandle, value, size, localOnly);
14691492 }
1493+ #endif // BLE_FEATURE_GATT_SERVER
14701494
1495+ #if BLE_FEATURE_SECURITY
14711496 /* *
14721497 * Enable the BLE stack's Security Manager. The Security Manager implements
14731498 * the cryptographic algorithms and protocol exchanges that allow two
@@ -1536,6 +1561,7 @@ class BLE {
15361561 {
15371562 return securityManager ().purgeAllBondingState ();
15381563 }
1564+ #endif // BLE_FEATURE_SECURITY
15391565
15401566 /* *
15411567 * Set up a callback for timeout events. Refer to Gap::TimeoutSource_t for
@@ -1551,6 +1577,7 @@ class BLE {
15511577 MBED_DEPRECATED (" ble.gap().onTimeout(callback)" )
15521578 void onTimeout (Gap::TimeoutEventCallback_t timeoutCallback);
15531579
1580+ #if BLE_FEATURE_CONNECTABLE
15541581 /* *
15551582 * Set up a callback for connection events. Refer to Gap::ConnectionEventCallback_t.
15561583 *
@@ -1595,6 +1622,7 @@ class BLE {
15951622 {
15961623 gap ().onDisconnection (tptr, mptr);
15971624 }
1625+ #endif // BLE_FEATURE_CONNECTABLE
15981626
15991627 /* *
16001628 * Radio Notification is a feature that enables ACTIVE and INACTIVE
@@ -1620,6 +1648,7 @@ class BLE {
16201648 MBED_DEPRECATED (" ble.gap().onRadioNotification(...)" )
16211649 void onRadioNotification (void (*callback)(bool ));
16221650
1651+ #if BLE_FEATURE_GATT_SERVER
16231652 /* *
16241653 * Add a callback for the GATT event DATA_SENT (which is triggered when
16251654 * updates are sent out by GATT in the form of notifications).
@@ -1821,7 +1850,9 @@ class BLE {
18211850 {
18221851 gattServer ().onConfirmationReceived (callback);
18231852 }
1853+ #endif // BLE_FEATURE_GATT_SERVER
18241854
1855+ #if BLE_FEATURE_SECURITY
18251856 /* *
18261857 * Set up a callback for when the security setup procedure (key generation
18271858 * and exchange) for a link has started. This will be skipped for bonded
@@ -1918,6 +1949,7 @@ class BLE {
19181949 {
19191950 return securityManager ().onPasskeyDisplay (callback);
19201951 }
1952+ #endif // BLE_FEATURE_SECURITY
19211953
19221954private:
19231955 friend class BLEInstanceBase ;
0 commit comments