BLE Library with custom services for the tortuga bike
Fork of BLE_API by
Diff: ble/services/BikeService.h
- Revision:
- 1207:da7745688342
- Parent:
- 1206:8afbec0520f5
--- a/ble/services/BikeService.h Fri Jul 15 12:49:23 2016 +0000 +++ b/ble/services/BikeService.h Mon Jul 18 09:25:32 2016 +0000 @@ -157,59 +157,70 @@ if (tmp != tripDistance){ tripDistance = tmp; ble.gattServer().write(tripDistanceChar.getValueHandle(),(uint8_t *)&tripDistance,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = ((bd->getDataSet(BikeData::TRIP))->getAverage()) * 100; if (tmp != tripAverage){ tripAverage = tmp; ble.gattServer().write(tripAverageChar.getValueHandle(),(uint8_t *)&tripAverage,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = ((bd->getDataSet(BikeData::TRIP))->getTime()); if (tmp != tripTime){ tripTime = tmp; ble.gattServer().write(tripTimeChar.getValueHandle(),(uint8_t *)&tripTime,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } //OverallData tmp = (bd->getDataSet(BikeData::OVERALL))->getDistance()*100; if (tmp != overallDistance){ overallDistance = tmp; ble.gattServer().write(overallDistanceChar.getValueHandle(),(uint8_t *)&overallDistance,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = (bd->getDataSet(BikeData::OVERALL))->getAverage()*100; if (tmp != overallAverage){ overallAverage = tmp; ble.gattServer().write(overallAverageChar.getValueHandle(),(uint8_t *)&overallAverage,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = (bd->getDataSet(BikeData::OVERALL))->getTime(); if (tmp != overallTime){ overallTime = tmp; ble.gattServer().write(overallTimeChar.getValueHandle(),(uint8_t *)&overallTime,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } //Since Battery Change tmp = (bd->getDataSet(BikeData::BATCHANGE))->getDistance() *100; if (tmp != batChangeDistance){ batChangeDistance = tmp; ble.gattServer().write(batChangeDistanceChar.getValueHandle(),(uint8_t *)&batChangeDistance,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = (bd->getDataSet(BikeData::BATCHANGE))->getAverage() *100; if (tmp != batChangeAverage){ batChangeAverage = tmp; ble.gattServer().write(batChangeAverageChar.getValueHandle(),(uint8_t *)&batChangeAverage,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = (bd->getDataSet(BikeData::BATCHANGE))->getTime(); if (tmp != batChangeTime){ batChangeTime = tmp; ble.gattServer().write(batChangeTimeChar.getValueHandle(),(uint8_t *)&batChangeTime,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } // Continious Data tmp = bd->getLastCount(); if (tmp != pulse){ pulse = tmp; ble.gattServer().write(pulseChar.getValueHandle(),&pulse,sizeof(uint8_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = bd->getSpeed()*100; if (tmp != speed){ speed = tmp; ble.gattServer().write(speedChar.getValueHandle(),(uint8_t *)&speed,sizeof(uint32_t)); + for (uint64_t i = 0; i<0x2760; i++); } tmp = bd->isLogging()*'5'; if (tmp != control){