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.
Dependencies: PulseSensor GSM Thermometer KalmanFilter
Diff: Application/main.cpp
- Revision:
- 10:4e0f5173269e
- Parent:
- 9:be09a9bf2e2e
- Child:
- 11:5a4313edf10d
--- a/Application/main.cpp Fri Mar 09 04:16:33 2018 +0000 +++ b/Application/main.cpp Fri Mar 09 04:21:39 2018 +0000 @@ -10,6 +10,7 @@ * version 0.9.6 02-21-2018 Some modification for LM35 * version 0.9.8 03-04-2018 Data receiving from client device added * version 1.0 03-09-2018 Some minor bugs fixed + * version 1.0.5 03-09-2018 Some minor bugs fixed /* ======================== INCLUDES ========================= */ #include <events/mbed_events.h> @@ -75,12 +76,18 @@ void updatePayload(void) { // Update the count in the SERVICE_DATA field of the advertising payload cnt++; - uint8_t service_data[5]; + uint8_t service_data[8]; + /* first 2 bytes are for service UUID */ service_data[0] = HealthCareService::USER_DATA_SERVICE_UUID & 0xFF; service_data[1] = HealthCareService::USER_DATA_SERVICE_UUID >> 8; - service_data[2] = 76; - service_data[3] = 69; - service_data[4] = cnt; + /* next 4 bytes are for client ID */ + service_data[2] = 0x07; + service_data[3] = 0x09; + service_data[4] = 0x9A; + service_data[5] = 0xAC; + /* last 2 bytes are sensor data */ + service_data[6] = cnt; + service_data[7] = cnt; ble_error_t err = BLE::Instance().gap().updateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, (uint8_t *)service_data, sizeof(service_data)); } @@ -166,15 +173,18 @@ /* No need to display the device name */ // ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME , (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); - uint8_t service_data[5]; + uint8_t service_data[8]; /* first 2 bytes are for service UUID */ service_data[0] = HealthCareService::USER_DATA_SERVICE_UUID & 0xFF; service_data[1] = HealthCareService::USER_DATA_SERVICE_UUID >> 8; - /* next 1 byte are for client ID */ - service_data[2] = 0x9B; + /* next 4 bytes are for client ID */ + service_data[2] = 0x07; + service_data[3] = 0x09; + service_data[4] = 0x9A; + service_data[5] = 0xAC; /* last 2 bytes are sensor data */ - service_data[3] = 0xA9; - service_data[4] = cnt; + service_data[6] = cnt; + service_data[7] = cnt; ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA , (uint8_t *)service_data, sizeof(service_data));