Demo Glucose Service
Dependencies: BLE_API mbed nRF51822
Fork of BLE_HeartRate by
BLE_Glucose_demo implements the Glucose Service which enables a collector device to connect and interact with.
There is a brief sample code edited with Android Studio for demo this BLE_Glucose_demo example, and it is public on github, everyone can clone it by this URL: https://github.com/Marcomissyou/BluetoothLeGlucose.git. It is convenient for you to development your BLE idea.
There is also provided apk file so you can download and install it directly then demo this code, but make sure your Android phone supports Bluetooth 4.0. /media/uploads/Marcomissyou/bleglucoseservice.apk
Revision 30:3dc9e6f2bc8c, committed 2014-07-04
- Comitter:
- Rohit Grover
- Date:
- Fri Jul 04 15:10:19 2014 +0100
- Parent:
- 29:76d865c718a6
- Child:
- 31:380687727e63
- Child:
- 33:e63df636d3b2
- Commit message:
- remove the battery-level and device-information services
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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) {