Graduation Thesis, use Nucleo and X-Nucleo BLE
Dependencies: PulseSensor GSM Thermometer KalmanFilter
Diff: application/ble_healthcare_service.h
- Revision:
- 1:9eadd2dc4b6e
- Parent:
- 0:64ca984b3efd
- Child:
- 2:16f6cfcd7505
--- a/application/ble_healthcare_service.h Tue Feb 13 18:53:45 2018 +0000 +++ b/application/ble_healthcare_service.h Wed Feb 14 01:29:53 2018 +0000 @@ -48,27 +48,27 @@ float initialTemp, uint8_t _tempLocation, // ) : -// uint16_t hrmCounter, + uint8_t hrmCounter, uint8_t _hrmLocation) : ble(_ble), temperatureValueByte(initialTemp), -// hrmValueByte(hrmCounter), + hrmValueByte(hrmCounter), tempMeasurement(GattCharacteristic::UUID_TEMPERATURE_MEASUREMENT_CHAR, (TemperatureValueBytes *)temperatureValueByte.getPointer(), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), tempLocation(GattCharacteristic::UUID_TEMPERATURE_TYPE_CHAR, &_tempLocation), -// hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, -// (HeartRateValueBytes *)hrmValueByte.getPointer(), + hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, + (HeartRateValueBytes *)hrmValueByte.getPointer(), // hrmValueByte.getNumValueBytes(), // HeartRateValueBytes::MAX_VALUE_BYTES, -// GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), hrmLocation( GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR, reinterpret_cast<uint8_t*>(&_hrmLocation)) { - GattCharacteristic *HealthCareChars[] = {&tempMeasurement, &tempLocation, &hrmLocation}; + GattCharacteristic *HealthCareChars[] = {&tempMeasurement, &tempLocation, &hrmRate,&hrmLocation}; GattService HealthCareService(GattService::UUID_HEART_RATE_SERVICE , HealthCareChars, sizeof(HealthCareChars) / sizeof(GattCharacteristic *)); ble.addService(HealthCareService); @@ -104,12 +104,12 @@ * @attention This function must be called in the execution context of the BLE stack. */ void updateHeartRate(uint16_t hrmCounter) { -// hrmValueByte.updateHeartRate(hrmCounter); -// ble.gattServer().write( -// hrmRate.getValueHandle(), -// hrmValueByte.getPointer(), -// hrmValueByte.getNumValueBytes() -// ); + hrmValueByte.updateHeartRate(hrmCounter); + ble.gattServer().write( + hrmRate.getValueHandle(), + hrmValueByte.getPointer(), + hrmValueByte.getNumValueBytes() + ); } private: @@ -218,12 +218,12 @@ protected: BLE &ble; TemperatureValueBytes temperatureValueByte; -// HeartRateValueBytes hrmValueByte; + HeartRateValueBytes hrmValueByte; ReadOnlyGattCharacteristic<TemperatureValueBytes> tempMeasurement; ReadOnlyGattCharacteristic<uint8_t> tempLocation; -// ReadOnlyGattCharacteristic<HeartRateValueBytes> hrmRate; + ReadOnlyGattCharacteristic<HeartRateValueBytes> hrmRate; ReadOnlyGattCharacteristic<uint8_t> hrmLocation; };