Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 663:73177d7c6e75, committed 2015-06-19
- Comitter:
- rgrover1
- Date:
- Fri Jun 19 15:53:00 2015 +0100
- Parent:
- 662:25a8bce7f2e5
- Child:
- 664:1624b24837d0
- Commit message:
- Synchronized with git rev 1298a1dd
Author: Rohit Grover
certain services like the batteryService and heartRateService don't need to be singletons.
Changed in this revision
| services/BatteryService.h | Show annotated file Show diff for this revision Revisions of this file |
| services/HeartRateService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/services/BatteryService.h Fri Jun 19 15:53:00 2015 +0100
+++ b/services/BatteryService.h Fri Jun 19 15:53:00 2015 +0100
@@ -38,16 +38,10 @@
batteryLevel(level),
batteryLevelCharacteristic(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, &batteryLevel, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) {
- static bool serviceAdded = false; /* We should only ever need to add the heart rate service once. */
- if (serviceAdded) {
- return;
- }
-
GattCharacteristic *charTable[] = {&batteryLevelCharacteristic};
GattService batteryService(GattService::UUID_BATTERY_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.addService(batteryService);
- serviceAdded = true;
}
/**
--- a/services/HeartRateService.h Fri Jun 19 15:53:00 2015 +0100
+++ b/services/HeartRateService.h Fri Jun 19 15:53:00 2015 +0100
@@ -127,17 +127,10 @@
private:
void setupService(void) {
- static bool serviceAdded = false; /* We should only ever need to add the heart rate service once. */
- if (serviceAdded) {
- return;
- }
-
GattCharacteristic *charTable[] = {&hrmRate, &hrmLocation, &controlPoint};
GattService hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.addService(hrmService);
- serviceAdded = true;
-
ble.onDataWritten(this, &HeartRateService::onDataWritten);
}
