Odometry Pedometer using nRF51822 and ADXL345
Dependencies: ADXL345 BLE_API mbed nRF51822
Fork of BLE_CycleSpeedCadence by
CyclingSpeedAndCadenceService.h@73:bae88c99c2ae, 2015-08-23 (annotated)
- Committer:
- tenfoot
- Date:
- Sun Aug 23 14:00:28 2015 +0000
- Revision:
- 73:bae88c99c2ae
- Parent:
- 72:a15b8451829f
- Child:
- 74:98dee483c173
Use struct/union to pack reports
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tenfoot | 71:7b6a488af957 | 1 | /* |
tenfoot | 71:7b6a488af957 | 2 | * Copyright (c) 2015 Robert Walker |
tenfoot | 71:7b6a488af957 | 3 | * |
tenfoot | 71:7b6a488af957 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
tenfoot | 71:7b6a488af957 | 5 | * you may not use this file except in compliance with the License. |
tenfoot | 71:7b6a488af957 | 6 | * You may obtain a copy of the License at |
tenfoot | 71:7b6a488af957 | 7 | * |
tenfoot | 71:7b6a488af957 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
tenfoot | 71:7b6a488af957 | 9 | * |
tenfoot | 71:7b6a488af957 | 10 | * Unless required by applicable law or agreed to in writing, software |
tenfoot | 71:7b6a488af957 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
tenfoot | 71:7b6a488af957 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
tenfoot | 71:7b6a488af957 | 13 | * See the License for the specific language governing permissions and |
tenfoot | 71:7b6a488af957 | 14 | * limitations under the License. |
tenfoot | 71:7b6a488af957 | 15 | */ |
tenfoot | 71:7b6a488af957 | 16 | |
tenfoot | 71:7b6a488af957 | 17 | #ifndef __BLE_CYCLING_SPEED_AND_CADENCE_SERVICE_H__ |
tenfoot | 71:7b6a488af957 | 18 | #define __BLE_CYCLING_SPEED_AND_CADENCE_SERVICE_H__ |
tenfoot | 71:7b6a488af957 | 19 | |
tenfoot | 71:7b6a488af957 | 20 | #include "ble/BLE.h" |
tenfoot | 71:7b6a488af957 | 21 | |
tenfoot | 71:7b6a488af957 | 22 | /** |
tenfoot | 71:7b6a488af957 | 23 | * @class CyclingSpeedAndCadenceService |
tenfoot | 71:7b6a488af957 | 24 | * @brief BLE Service for Cycling Speed and Cadence. This BLE Service contains the location of the sensor, the total wheel revolutions, total crank revolutiosn. <br> |
tenfoot | 71:7b6a488af957 | 25 | * Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.cycling_speed_and_cadence.xml <br> |
tenfoot | 71:7b6a488af957 | 26 | * CSC Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.csc_measurement.xml <br> |
tenfoot | 71:7b6a488af957 | 27 | * Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.sensor_location.xml |
tenfoot | 71:7b6a488af957 | 28 | */ |
tenfoot | 71:7b6a488af957 | 29 | class CyclingSpeedAndCadenceService { |
tenfoot | 71:7b6a488af957 | 30 | public: |
tenfoot | 73:bae88c99c2ae | 31 | enum Mode { |
tenfoot | 73:bae88c99c2ae | 32 | MODE_SPEED, |
tenfoot | 73:bae88c99c2ae | 33 | MODE_CADENCE, |
tenfoot | 73:bae88c99c2ae | 34 | MODE_SPEED_CADENCE |
tenfoot | 73:bae88c99c2ae | 35 | }; |
tenfoot | 73:bae88c99c2ae | 36 | |
tenfoot | 71:7b6a488af957 | 37 | /** |
tenfoot | 71:7b6a488af957 | 38 | * @enum SensorLocation |
tenfoot | 71:7b6a488af957 | 39 | * @brief Location of sensor on bike. |
tenfoot | 71:7b6a488af957 | 40 | */ |
tenfoot | 71:7b6a488af957 | 41 | enum { |
tenfoot | 71:7b6a488af957 | 42 | LOCATION_OTHER, /*!< Other */ |
tenfoot | 71:7b6a488af957 | 43 | LOCATION_TOP_OF_SHOE, /*!< Top of shoe */ |
tenfoot | 71:7b6a488af957 | 44 | LOCATION_IN_SHOE, /*!< In shoe */ |
tenfoot | 71:7b6a488af957 | 45 | LOCATION_HIP, /*!< Hip */ |
tenfoot | 71:7b6a488af957 | 46 | LOCATION_FRONT_WHEEL, /*!< Front Wheel */ |
tenfoot | 71:7b6a488af957 | 47 | LOCATION_LEFT_CRANK, /*!< Left Crank */ |
tenfoot | 71:7b6a488af957 | 48 | LOCATION_RIGHT_CRANK, /*!< Right Crank */ |
tenfoot | 71:7b6a488af957 | 49 | LOCATION_LEFT_PEDAL, /*!< Left Pedal */ |
tenfoot | 71:7b6a488af957 | 50 | LOCATION_RIGHT_PEDAL, /*!< Right Pedal */ |
tenfoot | 71:7b6a488af957 | 51 | LOCATION_FRONT_HUB, /*!< Front Hub */ |
tenfoot | 71:7b6a488af957 | 52 | LOCATION_REAR_DROPOUT, /*!< Rear Dropout */ |
tenfoot | 71:7b6a488af957 | 53 | LOCATION_CHAINSTAY, /*!< Chainstay */ |
tenfoot | 71:7b6a488af957 | 54 | LOCATION_REAR_WHEEL, /*!< Rear Wheel */ |
tenfoot | 71:7b6a488af957 | 55 | LOCATION_REAR_HUB, /*!< Rear Hub */ |
tenfoot | 71:7b6a488af957 | 56 | LOCATION_CHEST, /*!< Chest */ |
tenfoot | 71:7b6a488af957 | 57 | }; |
tenfoot | 71:7b6a488af957 | 58 | |
tenfoot | 71:7b6a488af957 | 59 | enum { |
tenfoot | 71:7b6a488af957 | 60 | UUID_SENSOR_LOCATION_CHAR = 0x2A5D, |
tenfoot | 71:7b6a488af957 | 61 | UUID_SC_CONTROL_POINT_CHAR = 0x2A55 |
tenfoot | 71:7b6a488af957 | 62 | }; |
tenfoot | 71:7b6a488af957 | 63 | |
tenfoot | 71:7b6a488af957 | 64 | public: |
tenfoot | 71:7b6a488af957 | 65 | /** |
tenfoot | 71:7b6a488af957 | 66 | * @brief Constructor with initial counter values. |
tenfoot | 71:7b6a488af957 | 67 | * |
tenfoot | 71:7b6a488af957 | 68 | * @param[ref] _ble |
tenfoot | 71:7b6a488af957 | 69 | * Reference to the underlying BLE. |
tenfoot | 71:7b6a488af957 | 70 | * @param[in] wheelCounter (32-bit) |
tenfoot | 71:7b6a488af957 | 71 | * initial value for the wheel counter. |
tenfoot | 71:7b6a488af957 | 72 | * @param[in] crankCounter (32-bit) |
tenfoot | 71:7b6a488af957 | 73 | * initial value for the crank counter. |
tenfoot | 71:7b6a488af957 | 74 | * @param[in] location |
tenfoot | 71:7b6a488af957 | 75 | * Sensor's location. |
tenfoot | 71:7b6a488af957 | 76 | */ |
tenfoot | 73:bae88c99c2ae | 77 | CyclingSpeedAndCadenceService(BLE &_ble, Mode _mode, uint8_t location) : |
tenfoot | 71:7b6a488af957 | 78 | ble(_ble), |
tenfoot | 73:bae88c99c2ae | 79 | value(_mode), |
tenfoot | 73:bae88c99c2ae | 80 | mode(_mode), |
tenfoot | 73:bae88c99c2ae | 81 | csc(GattCharacteristic::UUID_CSC_MEASUREMENT_CHAR, |
tenfoot | 73:bae88c99c2ae | 82 | value.bytes, |
tenfoot | 73:bae88c99c2ae | 83 | value.getSize(), value.getSize(), |
tenfoot | 71:7b6a488af957 | 84 | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), |
tenfoot | 73:bae88c99c2ae | 85 | cscFeat(GattCharacteristic::UUID_CSC_FEATURE_CHAR, (uint8_t*)&mode, |
tenfoot | 72:a15b8451829f | 86 | 2, 2, |
tenfoot | 72:a15b8451829f | 87 | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), |
tenfoot | 71:7b6a488af957 | 88 | scLocation(UUID_SENSOR_LOCATION_CHAR, &location), |
tenfoot | 71:7b6a488af957 | 89 | controlPoint(UUID_SC_CONTROL_POINT_CHAR, &controlPointValue) { |
tenfoot | 71:7b6a488af957 | 90 | setupService(); |
tenfoot | 71:7b6a488af957 | 91 | } |
tenfoot | 71:7b6a488af957 | 92 | |
tenfoot | 71:7b6a488af957 | 93 | /** |
tenfoot | 71:7b6a488af957 | 94 | * @brief Set a new value for wheel revolutions. |
tenfoot | 71:7b6a488af957 | 95 | * |
tenfoot | 71:7b6a488af957 | 96 | * @param[in] wheelCounter |
tenfoot | 71:7b6a488af957 | 97 | * Total wheel revolutions. |
tenfoot | 71:7b6a488af957 | 98 | * @param[in] eventTime |
tenfoot | 71:7b6a488af957 | 99 | * Time of event. |
tenfoot | 71:7b6a488af957 | 100 | */ |
tenfoot | 73:bae88c99c2ae | 101 | void updateWheelCounter(uint32_t wheelCounter, uint16_t eventTime) |
tenfoot | 73:bae88c99c2ae | 102 | { |
tenfoot | 73:bae88c99c2ae | 103 | value.updateWheelCounter(wheelCounter, eventTime); |
tenfoot | 73:bae88c99c2ae | 104 | sendUpdate(); |
tenfoot | 71:7b6a488af957 | 105 | } |
tenfoot | 71:7b6a488af957 | 106 | |
tenfoot | 71:7b6a488af957 | 107 | /** |
tenfoot | 71:7b6a488af957 | 108 | * @brief Set a new value for crank revolutions. |
tenfoot | 71:7b6a488af957 | 109 | * |
tenfoot | 71:7b6a488af957 | 110 | * @param[in] crankCounter |
tenfoot | 71:7b6a488af957 | 111 | * Total crank revolutions. |
tenfoot | 71:7b6a488af957 | 112 | * @param[in] eventTime |
tenfoot | 71:7b6a488af957 | 113 | * Time of event. |
tenfoot | 71:7b6a488af957 | 114 | */ |
tenfoot | 73:bae88c99c2ae | 115 | void updateCrankCounter(uint16_t crankCounter, uint16_t eventTime) |
tenfoot | 73:bae88c99c2ae | 116 | { |
tenfoot | 73:bae88c99c2ae | 117 | value.updateCrankCounter(crankCounter, eventTime); |
tenfoot | 73:bae88c99c2ae | 118 | sendUpdate(); |
tenfoot | 71:7b6a488af957 | 119 | } |
tenfoot | 71:7b6a488af957 | 120 | |
tenfoot | 73:bae88c99c2ae | 121 | void updateCounters(uint32_t wheelCounter, uint16_t crankCounter, uint16_t eventTime) |
tenfoot | 73:bae88c99c2ae | 122 | { |
tenfoot | 73:bae88c99c2ae | 123 | value.updateCounters(wheelCounter, crankCounter, eventTime); |
tenfoot | 73:bae88c99c2ae | 124 | sendUpdate(); |
tenfoot | 71:7b6a488af957 | 125 | } |
tenfoot | 71:7b6a488af957 | 126 | |
tenfoot | 71:7b6a488af957 | 127 | /** |
tenfoot | 71:7b6a488af957 | 128 | * This callback allows the CyclingSpeedAndCadenceService to receive updates to the |
tenfoot | 71:7b6a488af957 | 129 | * controlPoint Characteristic. |
tenfoot | 71:7b6a488af957 | 130 | * |
tenfoot | 71:7b6a488af957 | 131 | * @param[in] params |
tenfoot | 71:7b6a488af957 | 132 | * Information about the characterisitc being updated. |
tenfoot | 71:7b6a488af957 | 133 | */ |
tenfoot | 71:7b6a488af957 | 134 | virtual void onDataWritten(const GattWriteCallbackParams *params) { |
tenfoot | 71:7b6a488af957 | 135 | if (params->handle == controlPoint.getValueAttribute().getHandle()) { |
tenfoot | 71:7b6a488af957 | 136 | /* Do something here if the new value is 1; else you can override this method by |
tenfoot | 71:7b6a488af957 | 137 | * extending this class. |
tenfoot | 71:7b6a488af957 | 138 | * @NOTE: if you are extending this class, be sure to also call |
tenfoot | 71:7b6a488af957 | 139 | * ble.onDataWritten(this, &ExtendedHRService::onDataWritten); in |
tenfoot | 71:7b6a488af957 | 140 | * your constructor. |
tenfoot | 71:7b6a488af957 | 141 | */ |
tenfoot | 71:7b6a488af957 | 142 | } |
tenfoot | 71:7b6a488af957 | 143 | } |
tenfoot | 71:7b6a488af957 | 144 | |
tenfoot | 71:7b6a488af957 | 145 | protected: |
tenfoot | 71:7b6a488af957 | 146 | void setupService(void) { |
tenfoot | 72:a15b8451829f | 147 | GattCharacteristic *charTable[] = {&csc, &cscFeat, &scLocation, &controlPoint}; |
tenfoot | 71:7b6a488af957 | 148 | GattService cscService(GattService::UUID_CYCLING_SPEED_AND_CADENCE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); |
tenfoot | 71:7b6a488af957 | 149 | |
tenfoot | 71:7b6a488af957 | 150 | ble.addService(cscService); |
tenfoot | 71:7b6a488af957 | 151 | ble.onDataWritten(this, &CyclingSpeedAndCadenceService::onDataWritten); |
tenfoot | 71:7b6a488af957 | 152 | } |
tenfoot | 71:7b6a488af957 | 153 | |
tenfoot | 71:7b6a488af957 | 154 | |
tenfoot | 73:bae88c99c2ae | 155 | void sendUpdate() |
tenfoot | 73:bae88c99c2ae | 156 | { |
tenfoot | 73:bae88c99c2ae | 157 | ble.gattServer().write(csc.getValueHandle(), value.bytes, value.getSize()); |
tenfoot | 73:bae88c99c2ae | 158 | } |
tenfoot | 71:7b6a488af957 | 159 | |
tenfoot | 73:bae88c99c2ae | 160 | protected: |
tenfoot | 73:bae88c99c2ae | 161 | static const uint8_t FLAG_WHEEL_PRESENT = (1 << 0); |
tenfoot | 73:bae88c99c2ae | 162 | static const uint8_t FLAG_CRANK_PRESENT = (1 << 1); |
tenfoot | 73:bae88c99c2ae | 163 | static const uint16_t MAX_BYTES = (1 + 4 + 2 + 2 + 2); |
tenfoot | 73:bae88c99c2ae | 164 | union SpeedCadenceValue |
tenfoot | 73:bae88c99c2ae | 165 | { |
tenfoot | 73:bae88c99c2ae | 166 | SpeedCadenceValue(uint16_t mode) |
tenfoot | 71:7b6a488af957 | 167 | { |
tenfoot | 73:bae88c99c2ae | 168 | switch (mode) |
tenfoot | 71:7b6a488af957 | 169 | { |
tenfoot | 73:bae88c99c2ae | 170 | case MODE_SPEED: |
tenfoot | 73:bae88c99c2ae | 171 | v.flags = FLAG_WHEEL_PRESENT; |
tenfoot | 73:bae88c99c2ae | 172 | break; |
tenfoot | 73:bae88c99c2ae | 173 | case MODE_CADENCE: |
tenfoot | 73:bae88c99c2ae | 174 | v.flags = FLAG_CRANK_PRESENT; |
tenfoot | 73:bae88c99c2ae | 175 | break; |
tenfoot | 73:bae88c99c2ae | 176 | case MODE_SPEED_CADENCE: |
tenfoot | 73:bae88c99c2ae | 177 | v.flags = FLAG_WHEEL_PRESENT | FLAG_CRANK_PRESENT; |
tenfoot | 73:bae88c99c2ae | 178 | break; |
tenfoot | 73:bae88c99c2ae | 179 | default: |
tenfoot | 73:bae88c99c2ae | 180 | v.flags = 0; |
tenfoot | 73:bae88c99c2ae | 181 | break; |
tenfoot | 71:7b6a488af957 | 182 | } |
tenfoot | 71:7b6a488af957 | 183 | } |
tenfoot | 71:7b6a488af957 | 184 | |
tenfoot | 73:bae88c99c2ae | 185 | void updateWheelCounter(uint32_t wheelCounter, uint16_t eventTime) |
tenfoot | 73:bae88c99c2ae | 186 | { |
tenfoot | 73:bae88c99c2ae | 187 | switch(v.flags) |
tenfoot | 73:bae88c99c2ae | 188 | { |
tenfoot | 73:bae88c99c2ae | 189 | case FLAG_WHEEL_PRESENT: |
tenfoot | 73:bae88c99c2ae | 190 | v.v.speed.wheelCounter = wheelCounter; |
tenfoot | 73:bae88c99c2ae | 191 | v.v.speed.lastWheelEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 192 | break; |
tenfoot | 73:bae88c99c2ae | 193 | case FLAG_WHEEL_PRESENT | FLAG_CRANK_PRESENT: |
tenfoot | 73:bae88c99c2ae | 194 | v.v.speedCadence.wheelCounter = wheelCounter; |
tenfoot | 73:bae88c99c2ae | 195 | v.v.speedCadence.lastWheelEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 196 | break; |
tenfoot | 73:bae88c99c2ae | 197 | default: |
tenfoot | 73:bae88c99c2ae | 198 | break; |
tenfoot | 73:bae88c99c2ae | 199 | } |
tenfoot | 73:bae88c99c2ae | 200 | } |
tenfoot | 73:bae88c99c2ae | 201 | |
tenfoot | 73:bae88c99c2ae | 202 | void updateCrankCounter(uint16_t crankCounter, uint16_t eventTime) |
tenfoot | 73:bae88c99c2ae | 203 | { |
tenfoot | 73:bae88c99c2ae | 204 | switch(v.flags) |
tenfoot | 73:bae88c99c2ae | 205 | { |
tenfoot | 73:bae88c99c2ae | 206 | case FLAG_CRANK_PRESENT: |
tenfoot | 73:bae88c99c2ae | 207 | v.v.cadence.crankCounter = crankCounter; |
tenfoot | 73:bae88c99c2ae | 208 | v.v.cadence.lastCrankEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 209 | break; |
tenfoot | 73:bae88c99c2ae | 210 | case FLAG_WHEEL_PRESENT | FLAG_CRANK_PRESENT: |
tenfoot | 73:bae88c99c2ae | 211 | v.v.speedCadence.crankCounter = crankCounter; |
tenfoot | 73:bae88c99c2ae | 212 | v.v.speedCadence.lastCrankEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 213 | break; |
tenfoot | 73:bae88c99c2ae | 214 | default: |
tenfoot | 73:bae88c99c2ae | 215 | break; |
tenfoot | 73:bae88c99c2ae | 216 | } |
tenfoot | 73:bae88c99c2ae | 217 | } |
tenfoot | 73:bae88c99c2ae | 218 | |
tenfoot | 73:bae88c99c2ae | 219 | void updateCounters(uint32_t wheelCounter, uint16_t crankCounter, uint16_t eventTime) |
tenfoot | 73:bae88c99c2ae | 220 | { |
tenfoot | 73:bae88c99c2ae | 221 | switch(v.flags) |
tenfoot | 73:bae88c99c2ae | 222 | { |
tenfoot | 73:bae88c99c2ae | 223 | case FLAG_WHEEL_PRESENT: |
tenfoot | 73:bae88c99c2ae | 224 | v.v.speed.wheelCounter = wheelCounter; |
tenfoot | 73:bae88c99c2ae | 225 | v.v.speed.lastWheelEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 226 | break; |
tenfoot | 73:bae88c99c2ae | 227 | case FLAG_CRANK_PRESENT: |
tenfoot | 73:bae88c99c2ae | 228 | v.v.cadence.crankCounter = crankCounter; |
tenfoot | 73:bae88c99c2ae | 229 | v.v.cadence.lastCrankEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 230 | break; |
tenfoot | 73:bae88c99c2ae | 231 | case FLAG_WHEEL_PRESENT | FLAG_CRANK_PRESENT: |
tenfoot | 73:bae88c99c2ae | 232 | v.v.speedCadence.wheelCounter = wheelCounter; |
tenfoot | 73:bae88c99c2ae | 233 | v.v.speedCadence.lastWheelEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 234 | v.v.speedCadence.crankCounter = crankCounter; |
tenfoot | 73:bae88c99c2ae | 235 | v.v.speedCadence.lastCrankEvent = eventTime; |
tenfoot | 73:bae88c99c2ae | 236 | break; |
tenfoot | 73:bae88c99c2ae | 237 | default: |
tenfoot | 73:bae88c99c2ae | 238 | break; |
tenfoot | 73:bae88c99c2ae | 239 | } |
tenfoot | 73:bae88c99c2ae | 240 | } |
tenfoot | 73:bae88c99c2ae | 241 | |
tenfoot | 73:bae88c99c2ae | 242 | uint16_t getSize() |
tenfoot | 73:bae88c99c2ae | 243 | { |
tenfoot | 73:bae88c99c2ae | 244 | return 1 + |
tenfoot | 73:bae88c99c2ae | 245 | ((v.flags & FLAG_WHEEL_PRESENT) ? (4+2) : 0) + |
tenfoot | 73:bae88c99c2ae | 246 | ((v.flags & FLAG_CRANK_PRESENT) ? (2+2) : 0); |
tenfoot | 73:bae88c99c2ae | 247 | } |
tenfoot | 73:bae88c99c2ae | 248 | |
tenfoot | 73:bae88c99c2ae | 249 | __packed struct Value |
tenfoot | 73:bae88c99c2ae | 250 | { |
tenfoot | 73:bae88c99c2ae | 251 | uint8_t flags; |
tenfoot | 73:bae88c99c2ae | 252 | __packed union |
tenfoot | 73:bae88c99c2ae | 253 | { |
tenfoot | 73:bae88c99c2ae | 254 | __packed struct Speed |
tenfoot | 73:bae88c99c2ae | 255 | { |
tenfoot | 73:bae88c99c2ae | 256 | uint32_t wheelCounter; |
tenfoot | 73:bae88c99c2ae | 257 | uint16_t lastWheelEvent; |
tenfoot | 73:bae88c99c2ae | 258 | } speed; |
tenfoot | 73:bae88c99c2ae | 259 | __packed struct Cadence |
tenfoot | 73:bae88c99c2ae | 260 | { |
tenfoot | 73:bae88c99c2ae | 261 | uint16_t crankCounter; |
tenfoot | 73:bae88c99c2ae | 262 | uint16_t lastCrankEvent; |
tenfoot | 73:bae88c99c2ae | 263 | } cadence; |
tenfoot | 73:bae88c99c2ae | 264 | __packed struct SpeedCadence |
tenfoot | 73:bae88c99c2ae | 265 | { |
tenfoot | 73:bae88c99c2ae | 266 | uint32_t wheelCounter; |
tenfoot | 73:bae88c99c2ae | 267 | uint16_t lastWheelEvent; |
tenfoot | 73:bae88c99c2ae | 268 | uint16_t crankCounter; |
tenfoot | 73:bae88c99c2ae | 269 | uint16_t lastCrankEvent; |
tenfoot | 73:bae88c99c2ae | 270 | } speedCadence; |
tenfoot | 73:bae88c99c2ae | 271 | } v; |
tenfoot | 73:bae88c99c2ae | 272 | } v; |
tenfoot | 73:bae88c99c2ae | 273 | uint8_t bytes[1+4+2+2+2]; |
tenfoot | 71:7b6a488af957 | 274 | }; |
tenfoot | 71:7b6a488af957 | 275 | |
tenfoot | 71:7b6a488af957 | 276 | protected: |
tenfoot | 71:7b6a488af957 | 277 | BLE &ble; |
tenfoot | 71:7b6a488af957 | 278 | |
tenfoot | 73:bae88c99c2ae | 279 | SpeedCadenceValue value; |
tenfoot | 73:bae88c99c2ae | 280 | uint16_t mode; |
tenfoot | 71:7b6a488af957 | 281 | uint8_t controlPointValue; |
tenfoot | 71:7b6a488af957 | 282 | |
tenfoot | 71:7b6a488af957 | 283 | GattCharacteristic csc; |
tenfoot | 72:a15b8451829f | 284 | GattCharacteristic cscFeat; |
tenfoot | 71:7b6a488af957 | 285 | ReadOnlyGattCharacteristic<uint8_t> scLocation; |
tenfoot | 71:7b6a488af957 | 286 | WriteOnlyGattCharacteristic<uint8_t> controlPoint; |
tenfoot | 71:7b6a488af957 | 287 | }; |
tenfoot | 71:7b6a488af957 | 288 | |
tenfoot | 71:7b6a488af957 | 289 | #endif /* #ifndef __BLE_CYCLING_SPEED_AND_CADENCE_SERVICE_H__*/ |