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 numberOriginal file lineDiff line numberDiff line change
@@ -17,6 +17,8 @@
17
#ifndef MBED_BLE_BATTERY_SERVICE_H__
17
#ifndef MBED_BLE_BATTERY_SERVICE_H__
18
#define MBED_BLE_BATTERY_SERVICE_H__
18
#define MBED_BLE_BATTERY_SERVICE_H__
19

19

20+
#if BLE_FEATURE_GATT_SERVER
21+
20
#include "platform/mbed_assert.h"
22
#include "platform/mbed_assert.h"
21
#include "ble/BLE.h"
23
#include "ble/BLE.h"
22

24

@@ -129,4 +131,6 @@ class BatteryService {
129
ReadOnlyGattCharacteristic<uint8_t> batteryLevelCharacteristic;
131
ReadOnlyGattCharacteristic<uint8_t> batteryLevelCharacteristic;
130
};
132
};
131

133

134+
#endif // BLE_FEATURE_GATT_SERVER
135+
132
#endif /* #ifndef MBED_BLE_BATTERY_SERVICE_H__*/
136
#endif /* #ifndef MBED_BLE_BATTERY_SERVICE_H__*/

features/FEATURE_BLE/ble/services/DFUService.h

Lines changed: 4 additions & 0 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -19,6 +19,8 @@
19
#ifndef __BLE_DFU_SERVICE_H__
19
#ifndef __BLE_DFU_SERVICE_H__
20
#define __BLE_DFU_SERVICE_H__
20
#define __BLE_DFU_SERVICE_H__
21

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
#include "ble/BLE.h"
24
#include "ble/BLE.h"
23
#include "ble/UUID.h"
25
#include "ble/UUID.h"
24

26

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

146

147+
#endif // BLE_FEATURE_GATT_SERVER
148+
145
#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
149
#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
146
#endif /* #ifdef TARGET_NRF51822 */
150
#endif /* #ifdef TARGET_NRF51822 */

features/FEATURE_BLE/ble/services/DeviceInformationService.h

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

19

20
#include "ble/BLE.h"
20
#include "ble/BLE.h"
21

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
/**
24
/**
23
* @class DeviceInformationService
25
* @class DeviceInformationService
24
* @brief BLE Device Information Service
26
* @brief BLE Device Information Service
@@ -135,4 +137,6 @@ class DeviceInformationService {
135
GattCharacteristic softwareRevisionStringCharacteristic;
137
GattCharacteristic softwareRevisionStringCharacteristic;
136
};
138
};
137

139

140+
#endif // BLE_FEATURE_GATT_SERVER
141+
138
#endif /* #ifndef __BLE_DEVICE_INFORMATION_SERVICE_H__*/
142
#endif /* #ifndef __BLE_DEVICE_INFORMATION_SERVICE_H__*/

features/FEATURE_BLE/ble/services/EddystoneConfigService.h

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

19

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

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
#include "ble/BLE.h"
24
#include "ble/BLE.h"
23
#include "ble/services/EddystoneService.h"
25
#include "ble/services/EddystoneService.h"
24
#include "Timer.h"
26
#include "Timer.h"
@@ -543,4 +545,6 @@ class EddystoneConfigService
543
WriteOnlyGattCharacteristic<uint8_t> resetChar;
545
WriteOnlyGattCharacteristic<uint8_t> resetChar;
544
};
546
};
545

547

548+
#endif // BLE_FEATURE_GATT_SERVER
549+
546
#endif // SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_
550
#endif // SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_

features/FEATURE_BLE/ble/services/EddystoneService.h

Lines changed: 4 additions & 0 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -25,6 +25,8 @@
25
#include "Ticker.h"
25
#include "Ticker.h"
26
#include "Timeout.h"
26
#include "Timeout.h"
27

27

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

31

30
//Debug is disabled by default
32
//Debug is disabled by default
@@ -654,4 +656,6 @@ class EddystoneService
654
}
656
}
655
};
657
};
656

658

659+
#endif // BLE_FEATURE_GATT_SERVER
660+
657
#endif // SERVICES_EDDYSTONEBEACON_H_
661
#endif // SERVICES_EDDYSTONEBEACON_H_

features/FEATURE_BLE/ble/services/EnvironmentalService.h

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

19

20
#include "ble/BLE.h"
20
#include "ble/BLE.h"
21

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
/**
24
/**
23
* @class EnvironmentalService
25
* @class EnvironmentalService
24
* @brief BLE Environmental Service. This service provides temperature, humidity and pressure measurement.
26
* @brief BLE Environmental Service. This service provides temperature, humidity and pressure measurement.
@@ -100,4 +102,6 @@ class EnvironmentalService {
100
ReadOnlyGattCharacteristic<PressureType_t> pressureCharacteristic;
102
ReadOnlyGattCharacteristic<PressureType_t> pressureCharacteristic;
101
};
103
};
102

104

105+
#endif // BLE_FEATURE_GATT_SERVER
106+
103
#endif /* #ifndef __BLE_ENVIRONMENTAL_SERVICE_H__*/
107
#endif /* #ifndef __BLE_ENVIRONMENTAL_SERVICE_H__*/

features/FEATURE_BLE/ble/services/HealthThermometerService.h

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

19

20
#include "ble/BLE.h"
20
#include "ble/BLE.h"
21

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
/**
24
/**
23
* @class HealthThermometerService
25
* @class HealthThermometerService
24
* @brief BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature.
26
* @brief BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature.
@@ -146,4 +148,6 @@ class HealthThermometerService {
146
ReadOnlyGattCharacteristic<uint8_t> tempLocation;
148
ReadOnlyGattCharacteristic<uint8_t> tempLocation;
147
};
149
};
148

150

151+
#endif // BLE_FEATURE_GATT_SERVER
152+
149
#endif /* #ifndef __BLE_HEALTH_THERMOMETER_SERVICE_H__*/
153
#endif /* #ifndef __BLE_HEALTH_THERMOMETER_SERVICE_H__*/

features/FEATURE_BLE/ble/services/HeartRateService.h

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

19

20
#include "ble/BLE.h"
20
#include "ble/BLE.h"
21

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
/**
24
/**
23
* BLE Heart Rate Service.
25
* BLE Heart Rate Service.
24
*
26
*
@@ -228,4 +230,6 @@ class HeartRateService {
228
ReadOnlyGattCharacteristic<uint8_t> hrmLocation;
230
ReadOnlyGattCharacteristic<uint8_t> hrmLocation;
229
};
231
};
230

232

233+
#endif // BLE_FEATURE_GATT_SERVER
234+
231
#endif /* #ifndef MBED_BLE_HEART_RATE_SERVICE_H__*/
235
#endif /* #ifndef MBED_BLE_HEART_RATE_SERVICE_H__*/

features/FEATURE_BLE/ble/services/LinkLossService.h

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

19

20
#include "ble/Gap.h"
20
#include "ble/Gap.h"
21

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
/**
24
/**
23
* @class LinkLossService
25
* @class LinkLossService
24
* @brief This service defines behavior when a link is lost between two devices.
26
* @brief This service defines behavior when a link is lost between two devices.
@@ -102,4 +104,6 @@ class LinkLossService {
102
ReadWriteGattCharacteristic<uint8_t> alertLevelChar;
104
ReadWriteGattCharacteristic<uint8_t> alertLevelChar;
103
};
105
};
104

106

107+
#endif // BLE_FEATURE_GATT_SERVER
108+
105
#endif /* __BLE_LINK_LOSS_SERVICE_H__ */
109
#endif /* __BLE_LINK_LOSS_SERVICE_H__ */

features/FEATURE_BLE/ble/services/UARTService.h

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

29

30+
#if BLE_FEATURE_GATT_SERVER
31+
30
extern const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID];
32
extern const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID];
31
extern const uint16_t UARTServiceShortUUID;
33
extern const uint16_t UARTServiceShortUUID;
32
extern const uint16_t UARTServiceTXCharacteristicShortUUID;
34
extern const uint16_t UARTServiceTXCharacteristicShortUUID;
@@ -215,4 +217,6 @@ class UARTService {
215
* application. */
217
* application. */
216
};
218
};
217

219

220+
#endif // BLE_FEATURE_GATT_SERVER
221+
218
#endif /* #ifndef __BLE_UART_SERVICE_H__*/
222
#endif /* #ifndef __BLE_UART_SERVICE_H__*/

features/FEATURE_BLE/ble/services/URIBeaconConfigService.h

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

25

26
#endif
26
#endif
27

27

28+
#if BLE_FEATURE_GATT_SERVER
29+
28
extern const uint8_t UUID_URI_BEACON_SERVICE[UUID::LENGTH_OF_LONG_UUID];
30
extern const uint8_t UUID_URI_BEACON_SERVICE[UUID::LENGTH_OF_LONG_UUID];
29
extern const uint8_t UUID_LOCK_STATE_CHAR[UUID::LENGTH_OF_LONG_UUID];
31
extern const uint8_t UUID_LOCK_STATE_CHAR[UUID::LENGTH_OF_LONG_UUID];
30
extern const uint8_t UUID_LOCK_CHAR[UUID::LENGTH_OF_LONG_UUID];
32
extern const uint8_t UUID_LOCK_CHAR[UUID::LENGTH_OF_LONG_UUID];
@@ -480,4 +482,6 @@ class URIBeaconConfigService {
480
}
482
}
481
};
483
};
482

484

485+
#endif // BLE_FEATURE_GATT_SERVER
486+
483
#endif // SERVICES_URIBEACONCONFIGSERVICE_H_
487
#endif // SERVICES_URIBEACONCONFIGSERVICE_H_

features/FEATURE_BLE/ble/services/iBeacon.h

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

21

22+
#if BLE_FEATURE_GATT_SERVER
23+
22
/**
24
/**
23
* iBeacon Service.
25
* iBeacon Service.
24
*
26
*
@@ -251,4 +253,6 @@ class iBeacon {
251
*/
253
*/
252
typedef iBeacon iBeaconService;
254
typedef iBeacon iBeaconService;
253

255

256+
#endif // BLE_FEATURE_GATT_SERVER
257+
254
#endif //MBED_BLE_IBEACON_H__
258
#endif //MBED_BLE_IBEACON_H__

features/FEATURE_BLE/source/services/DFUService.cpp

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

18

19
#include "ble/services/DFUService.h"
19
#include "ble/services/DFUService.h"
20

20

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

43

42
DFUService::ResetPrepare_t DFUService::handoverCallback = NULL;
44
DFUService::ResetPrepare_t DFUService::handoverCallback = NULL;
43

45

46+
#endif // BLE_FEATURE_GATT_SERVER
47+
44
#endif /* #ifdef TARGET_NRF51822 */
48
#endif /* #ifdef TARGET_NRF51822 */

features/FEATURE_BLE/source/services/UARTService.cpp

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

16

17
#include "ble/services/UARTService.h"
17
#include "ble/services/UARTService.h"
18

18

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

features/FEATURE_BLE/source/services/URIBeaconConfigService.cpp

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

16

17
#include "ble/services/URIBeaconConfigService.h"
17
#include "ble/services/URIBeaconConfigService.h"
18

18

19+
#if BLE_FEATURE_GATT_SERVER
20+
19
#define UUID_URI_BEACON(FIRST, SECOND) { \
21
#define UUID_URI_BEACON(FIRST, SECOND) { \
20
0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \
22
0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \
21
0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8, \
23
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
33
const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89);
35
const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89);
34

36

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

0 commit comments

Comments
 (0)