![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test
Dependencies: BLE_API mbed nRF51822
Fork of BLE_SecureHeartRate by
Diff: HeartRateSecService.h
- Revision:
- 6:715150f7f293
- Parent:
- 5:ed2cb43f3589
--- a/HeartRateSecService.h Fri Jun 19 23:57:59 2015 +0000 +++ b/HeartRateSecService.h Sat Jun 20 23:44:08 2015 +0000 @@ -53,7 +53,7 @@ * @param[in] location * Sensor's location. */ - HeartRateSecService(BLEDevice &_ble, uint8_t hrmCounter, uint8_t location) : + HeartRateSecService(BLE &_ble, uint8_t hrmCounter, uint8_t location) : ble(_ble), valueBytes(hrmCounter), hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, valueBytes.getPointer(), @@ -74,7 +74,7 @@ * @param[in] location * Sensor's location. */ - HeartRateSecService(BLEDevice &_ble, uint16_t hrmCounter, uint8_t location) : + HeartRateSecService(BLE &_ble, uint16_t hrmCounter, uint8_t location) : ble(_ble), valueBytes(hrmCounter), hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, valueBytes.getPointer(), @@ -93,7 +93,7 @@ */ void updateHeartRate(uint8_t hrmCounter) { valueBytes.updateHeartRate(hrmCounter); - ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); + ble.gattServer().write(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); } /** @@ -104,7 +104,7 @@ */ void updateHeartRate(uint16_t hrmCounter) { valueBytes.updateHeartRate(hrmCounter); - ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); + ble.gattServer().write(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); } /** @@ -137,10 +137,10 @@ GattCharacteristic *charTable[] = {&hrmRate, &hrmLocation, &controlPoint}; GattService hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); - ble.addService(hrmService); + ble.gattServer().addService(hrmService); serviceAdded = true; - ble.onDataWritten(this, &HeartRateSecService::onDataWritten); + ble.gattServer().onDataWritten(this, &HeartRateSecService::onDataWritten); } private: @@ -190,7 +190,7 @@ }; private: - BLEDevice &ble; + BLE &ble; HeartRateValueBytes valueBytes; uint8_t controlPointValue;