Cycle speed and cadence example for the BLE API using nRF51822 native mode drivers
Dependencies: BLE_API mbed nRF51822
Fork of BLE_HeartRate by
Diff: main.cpp
- Revision:
- 30:3dc9e6f2bc8c
- Parent:
- 29:76d865c718a6
- Child:
- 33:e63df636d3b2
--- a/main.cpp Fri Jul 04 15:06:51 2014 +0100 +++ b/main.cpp Fri Jul 04 15:10:19 2014 +0100 @@ -30,20 +30,7 @@ #define DEBUG(...) /* nothing */ #endif /* #if NEED_CONSOLE_OUTPUT */ -/* Battery Level Service */ -static const uint8_t batt = 72; /* Battery level */ -GattCharacteristic battLevel(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, (uint8_t *)&batt, sizeof(uint8_t), sizeof(uint8_t), - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ); -GattCharacteristic *battLevelChars[] = {&battLevel}; -GattService battService(GattService::UUID_BATTERY_SERVICE, battLevelChars, sizeof(battLevelChars) / sizeof(GattCharacteristic *)); - -/* Device Information service */ const static char DEVICE_NAME[] = "Nordic_HRM"; -GattCharacteristic deviceManufacturer(GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME), sizeof(DEVICE_NAME), - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ); -GattCharacteristic *deviceInformationChars[] = {&deviceManufacturer}; -GattService deviceInformationService(GattService::UUID_DEVICE_INFORMATION_SERVICE, deviceInformationChars, - sizeof(deviceInformationChars) / sizeof(GattCharacteristic *)); /* Heart Rate Service */ /* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.heart_rate.xml */ @@ -60,7 +47,7 @@ GattCharacteristic *hrmChars[] = {&hrmRate, &hrmLocation, }; GattService hrmService(GattService::UUID_HEART_RATE_SERVICE, hrmChars, sizeof(hrmChars) / sizeof(GattCharacteristic *)); -static const uint16_t uuid16_list[] = {GattService::UUID_BATTERY_SERVICE, GattService::UUID_DEVICE_INFORMATION_SERVICE, GattService::UUID_HEART_RATE_SERVICE}; +static const uint16_t uuid16_list[] = {GattService::UUID_HEART_RATE_SERVICE}; void disconnectionCallback(void) { @@ -108,8 +95,6 @@ ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ ble.startAdvertising(); - ble.addService(battService); - ble.addService(deviceInformationService); ble.addService(hrmService); while (true) {