Skip to content

Commit 3142f26

Browse files
committed
BLE - Exclude services if GattServer is not available.
1 parent 5ae59fc commit 3142f26

15 files changed

+60
-0
lines changed

features/FEATURE_BLE/ble/services/BatteryService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef MBED_BLE_BATTERY_SERVICE_H__
1818
#define MBED_BLE_BATTERY_SERVICE_H__
1919

20+
#if BLE_FEATURE_GATT_SERVER
21+
2022
#include "platform/mbed_assert.h"
2123
#include "ble/BLE.h"
2224

@@ -129,4 +131,6 @@ class BatteryService {
129131
ReadOnlyGattCharacteristic<uint8_t> batteryLevelCharacteristic;
130132
};
131133

134+
#endif // BLE_FEATURE_GATT_SERVER
135+
132136
#endif /* #ifndef MBED_BLE_BATTERY_SERVICE_H__*/

features/FEATURE_BLE/ble/services/DFUService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef __BLE_DFU_SERVICE_H__
2020
#define __BLE_DFU_SERVICE_H__
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
#include "ble/BLE.h"
2325
#include "ble/UUID.h"
2426

@@ -142,5 +144,7 @@ class DFUService {
142144
static ResetPrepare_t handoverCallback; /**< Application-specific handover callback. */
143145
};
144146

147+
#endif // BLE_FEATURE_GATT_SERVER
148+
145149
#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
146150
#endif /* #ifdef TARGET_NRF51822 */

features/FEATURE_BLE/ble/services/DeviceInformationService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "ble/BLE.h"
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
/**
2325
* @class DeviceInformationService
2426
* @brief BLE Device Information Service
@@ -135,4 +137,6 @@ class DeviceInformationService {
135137
GattCharacteristic softwareRevisionStringCharacteristic;
136138
};
137139

140+
#endif // BLE_FEATURE_GATT_SERVER
141+
138142
#endif /* #ifndef __BLE_DEVICE_INFORMATION_SERVICE_H__*/

features/FEATURE_BLE/ble/services/EddystoneConfigService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#warning ble/services/EddystoneConfigService.h is deprecated. Please use the example in 'github.com/ARMmbed/ble-examples/tree/master/BLE_EddystoneService'.
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
#include "ble/BLE.h"
2325
#include "ble/services/EddystoneService.h"
2426
#include "Timer.h"
@@ -543,4 +545,6 @@ class EddystoneConfigService
543545
WriteOnlyGattCharacteristic<uint8_t> resetChar;
544546
};
545547

548+
#endif // BLE_FEATURE_GATT_SERVER
549+
546550
#endif // SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_

features/FEATURE_BLE/ble/services/EddystoneService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "Ticker.h"
2626
#include "Timeout.h"
2727

28+
#if BLE_FEATURE_GATT_SERVER
29+
2830
static const uint8_t BEACON_EDDYSTONE[] = {0xAA, 0xFE};
2931

3032
//Debug is disabled by default
@@ -654,4 +656,6 @@ class EddystoneService
654656
}
655657
};
656658

659+
#endif // BLE_FEATURE_GATT_SERVER
660+
657661
#endif // SERVICES_EDDYSTONEBEACON_H_

features/FEATURE_BLE/ble/services/EnvironmentalService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "ble/BLE.h"
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
/**
2325
* @class EnvironmentalService
2426
* @brief BLE Environmental Service. This service provides temperature, humidity and pressure measurement.
@@ -100,4 +102,6 @@ class EnvironmentalService {
100102
ReadOnlyGattCharacteristic<PressureType_t> pressureCharacteristic;
101103
};
102104

105+
#endif // BLE_FEATURE_GATT_SERVER
106+
103107
#endif /* #ifndef __BLE_ENVIRONMENTAL_SERVICE_H__*/

features/FEATURE_BLE/ble/services/HealthThermometerService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "ble/BLE.h"
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
/**
2325
* @class HealthThermometerService
2426
* @brief BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature.
@@ -146,4 +148,6 @@ class HealthThermometerService {
146148
ReadOnlyGattCharacteristic<uint8_t> tempLocation;
147149
};
148150

151+
#endif // BLE_FEATURE_GATT_SERVER
152+
149153
#endif /* #ifndef __BLE_HEALTH_THERMOMETER_SERVICE_H__*/

features/FEATURE_BLE/ble/services/HeartRateService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "ble/BLE.h"
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
/**
2325
* BLE Heart Rate Service.
2426
*
@@ -228,4 +230,6 @@ class HeartRateService {
228230
ReadOnlyGattCharacteristic<uint8_t> hrmLocation;
229231
};
230232

233+
#endif // BLE_FEATURE_GATT_SERVER
234+
231235
#endif /* #ifndef MBED_BLE_HEART_RATE_SERVICE_H__*/

features/FEATURE_BLE/ble/services/LinkLossService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "ble/Gap.h"
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
/**
2325
* @class LinkLossService
2426
* @brief This service defines behavior when a link is lost between two devices.
@@ -102,4 +104,6 @@ class LinkLossService {
102104
ReadWriteGattCharacteristic<uint8_t> alertLevelChar;
103105
};
104106

107+
#endif // BLE_FEATURE_GATT_SERVER
108+
105109
#endif /* __BLE_LINK_LOSS_SERVICE_H__ */

features/FEATURE_BLE/ble/services/UARTService.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "ble/UUID.h"
2828
#include "ble/BLE.h"
2929

30+
#if BLE_FEATURE_GATT_SERVER
31+
3032
extern const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID];
3133
extern const uint16_t UARTServiceShortUUID;
3234
extern const uint16_t UARTServiceTXCharacteristicShortUUID;
@@ -215,4 +217,6 @@ class UARTService {
215217
* application. */
216218
};
217219

220+
#endif // BLE_FEATURE_GATT_SERVER
221+
218222
#endif /* #ifndef __BLE_UART_SERVICE_H__*/

0 commit comments

Comments
 (0)