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 26:e6ad33b227c6, committed 2014-07-03
- Comitter:
- Rohit Grover
- Date:
- Thu Jul 03 11:44:59 2014 +0100
- Parent:
- 25:b3e91851d9e2
- Child:
- 27:97adf2b76b9c
- Commit message:
- add deviceInformationService to the basic HRM demo
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jun 26 14:11:57 2014 +0000 +++ b/main.cpp Thu Jul 03 11:44:59 2014 +0100 @@ -30,6 +30,14 @@ #define DEBUG(...) /* nothing */ #endif /* #if NEED_CONSOLE_OUTPUT */ +/* Device Information service */ +const char deviceName[] = { 'm', 'b', 'e', 'd' }; +GattCharacteristic deviceManufacturer(GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR, (uint8_t *)deviceName, sizeof(deviceName), sizeof(deviceName), + 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 */ /* HRM Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */ @@ -89,6 +97,7 @@ ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ ble.startAdvertising(); + ble.addService(deviceInformationService); ble.addService(hrmService); while (true) {