repo

Dependencies:   mbed BLE_API nRF51822 X_NUCLEO_IDB0XA1

Committer:
orshefi
Date:
Thu Oct 31 18:50:07 2019 +0000
Revision:
81:b26ba1ec7625
Parent:
80:4fbfa09ac26c
init

Who changed what in which revision?

UserRevisionLine numberNew contents of line
orshefi 80:4fbfa09ac26c 1 #include "mbed.h"
orshefi 80:4fbfa09ac26c 2 #include "ble/BLE.h"
orshefi 80:4fbfa09ac26c 3 #include "ble/services/HeartRateService.h"
orshefi 80:4fbfa09ac26c 4 #include <stdbool.h>
orshefi 80:4fbfa09ac26c 5 #include <stdint.h>
orshefi 80:4fbfa09ac26c 6
orshefi 80:4fbfa09ac26c 7 class ModifiedHeartRateService : HeartRateService{
orshefi 80:4fbfa09ac26c 8 public:
orshefi 80:4fbfa09ac26c 9
orshefi 80:4fbfa09ac26c 10 ModifiedHeartRateService(BLE &_ble, uint8_t hrmCounter, uint8_t location) : HeartRateService(_ble,hrmCounter,location){};
orshefi 80:4fbfa09ac26c 11 ~ModifiedHeartRateService(){};
orshefi 80:4fbfa09ac26c 12
orshefi 80:4fbfa09ac26c 13 void onDataWritten(const GattWriteCallbackParams *params) {
orshefi 80:4fbfa09ac26c 14 if (params->handle == controlPoint.getValueAttribute().getHandle()) {
orshefi 80:4fbfa09ac26c 15 ble.readCharacteristicValue(controlPoint.getValueAttribute().getHandle(), trig1, &bytesRead);//read command
orshefi 80:4fbfa09ac26c 16 /* Do something here if the new value is 1; else you can override this method by
orshefi 80:4fbfa09ac26c 17 * extending this class.
orshefi 80:4fbfa09ac26c 18 * @NOTE: If you are extending this class, be sure to also call
orshefi 80:4fbfa09ac26c 19 * ble.onDataWritten(this, &ExtendedHRService::onDataWritten); in
orshefi 80:4fbfa09ac26c 20 * your constructor.
orshefi 80:4fbfa09ac26c 21 */
orshefi 80:4fbfa09ac26c 22 }
orshefi 80:4fbfa09ac26c 23 }
orshefi 80:4fbfa09ac26c 24
orshefi 80:4fbfa09ac26c 25 void updateHeartRate(uint8_t byte){
orshefi 80:4fbfa09ac26c 26 updateHeartRate(byte);
orshefi 80:4fbfa09ac26c 27 }
orshefi 80:4fbfa09ac26c 28
orshefi 80:4fbfa09ac26c 29 uint8_t trig1[2];
orshefi 80:4fbfa09ac26c 30 uint16_t bytesRead;
orshefi 80:4fbfa09ac26c 31 };