DV \E
Dependencies: BLE_API EthernetInterface mbed nRF51822
Fork of BLE_HeartRate by
Diff: main.cpp
- Revision:
- 20:58bff62d0f7a
- Parent:
- 19:1713b11694ea
- Child:
- 22:299658c5fa3c
--- a/main.cpp Wed Jun 11 14:45:05 2014 +0100 +++ b/main.cpp Wed Jun 11 14:52:56 2014 +0100 @@ -47,7 +47,8 @@ /* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */ static uint8_t hrmCounter = 100; static uint8_t bpm[2] = {0x00, hrmCounter}; -GattCharacteristic hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, bpm, sizeof(bpm), sizeof(bpm), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY); +GattCharacteristic hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, bpm, sizeof(bpm), sizeof(bpm), + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY); static const uint8_t location = 0x03; /* Finger */ GattCharacteristic hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, (uint8_t *)&location, sizeof(location), sizeof(location), @@ -74,18 +75,6 @@ GattService::UUID_HEART_RATE_SERVICE }; -void timeoutCallback(void) -{ - DEBUG("Advertising Timeout!\n\r"); - // Restart the advertising process with a much slower interval, - // only start advertising again after a button press, etc. -} - -void connectionCallback(void) -{ - DEBUG("Connected!\n\r"); -} - void disconnectionCallback(void) { DEBUG("Disconnected!\n\r"); @@ -93,20 +82,6 @@ ble.startAdvertising(); } -void updatesEnabledCallback(uint16_t charHandle) -{ - if (charHandle == hrmRate.getHandle()) { - DEBUG("Heart rate notify enabled\n\r"); - } -} - -void updatesDisabledCallback(uint16_t charHandle) -{ - if (charHandle == hrmRate.getHandle()) { - DEBUG("Heart rate notify disabled\n\r"); - } -} - /** * Runs once a second in interrupt context triggered by the 'ticker'; updates * battery level and hrmCounter if there is a connection. @@ -145,11 +120,7 @@ ble.init(); /* Setup the local GAP/GATT event handlers */ - ble.onTimeout(timeoutCallback); - ble.onConnection(connectionCallback); ble.onDisconnection(disconnectionCallback); - ble.onUpdatesEnabled(updatesEnabledCallback); - ble.onUpdatesDisabled(updatesDisabledCallback); /* setup advertising */ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);