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__*/

features/FEATURE_BLE/ble/services/URIBeaconConfigService.h

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

2626
#endif
2727

28+
#if BLE_FEATURE_GATT_SERVER
29+
2830
extern const uint8_t UUID_URI_BEACON_SERVICE[UUID::LENGTH_OF_LONG_UUID];
2931
extern const uint8_t UUID_LOCK_STATE_CHAR[UUID::LENGTH_OF_LONG_UUID];
3032
extern const uint8_t UUID_LOCK_CHAR[UUID::LENGTH_OF_LONG_UUID];
@@ -480,4 +482,6 @@ class URIBeaconConfigService {
480482
}
481483
};
482484

485+
#endif // BLE_FEATURE_GATT_SERVER
486+
483487
#endif // SERVICES_URIBEACONCONFIGSERVICE_H_

features/FEATURE_BLE/ble/services/iBeacon.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "cmsis_compiler.h"
2020
#include "ble/BLE.h"
2121

22+
#if BLE_FEATURE_GATT_SERVER
23+
2224
/**
2325
* iBeacon Service.
2426
*
@@ -251,4 +253,6 @@ class iBeacon {
251253
*/
252254
typedef iBeacon iBeaconService;
253255

256+
#endif // BLE_FEATURE_GATT_SERVER
257+
254258
#endif //MBED_BLE_IBEACON_H__

features/FEATURE_BLE/source/services/DFUService.cpp

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

1919
#include "ble/services/DFUService.h"
2020

21+
#if BLE_FEATURE_GATT_SERVER
22+
2123
const uint8_t DFUServiceBaseUUID[] = {
2224
0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0xEF, 0xDE,
2325
0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23,
@@ -41,4 +43,6 @@ const uint8_t DFUServicePacketCharacteristicUUID[] = {
4143

4244
DFUService::ResetPrepare_t DFUService::handoverCallback = NULL;
4345

46+
#endif // BLE_FEATURE_GATT_SERVER
47+
4448
#endif /* #ifdef TARGET_NRF51822 */

features/FEATURE_BLE/source/services/UARTService.cpp

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

1717
#include "ble/services/UARTService.h"
1818

19+
#if BLE_FEATURE_GATT_SERVER
20+
1921
const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = {
2022
0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93,
2123
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
@@ -39,3 +41,5 @@ const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = {
3941
0x6E, 0x40, (uint8_t)(UARTServiceRXCharacteristicShortUUID >> 8), (uint8_t)(UARTServiceRXCharacteristicShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93,
4042
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
4143
};
44+
45+
#endif // BLE_FEATURE_GATT_SERVER

features/FEATURE_BLE/source/services/URIBeaconConfigService.cpp

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

1717
#include "ble/services/URIBeaconConfigService.h"
1818

19+
#if BLE_FEATURE_GATT_SERVER
20+
1921
#define UUID_URI_BEACON(FIRST, SECOND) { \
2022
0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \
2123
0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8, \
@@ -33,3 +35,5 @@ const uint8_t UUID_BEACON_PERIOD_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_B
3335
const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89);
3436

3537
const uint8_t BEACON_UUID[sizeof(UUID::ShortUUIDBytes_t)] = {0xD8, 0xFE};
38+
39+
#endif // BLE_FEATURE_GATT_SERVER

0 commit comments

Comments
 (0)