Code supports writing to the SD card as well as working with the Volckens group smartphone apps for the mbed HRM1017

Dependencies:   ADS1115 BLE_API BME280 Calibration CronoDot EEPROM LSM303 MCP40D17 NCP5623BMUTBG SDFileSystem SI1145 STC3100 mbed nRF51822

Fork of UPAS_BLE_and_USB by Volckens Group Sensors

Committer:
jelord
Date:
Thu Dec 10 23:32:24 2015 +0000
Revision:
94:c57720890e76
Child:
96:03106adb45c9
Works with new App and can write to the SD card

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jelord 94:c57720890e76 1 //CODE BY JAKE LORD
jelord 94:c57720890e76 2 //ALL RIGHTS RESERVED BY VOLCKENS GROUP, FORT COLLINS CO
jelord 94:c57720890e76 3
jelord 94:c57720890e76 4 #ifndef __BLE_UPAS_SERVICE_H__
jelord 94:c57720890e76 5 #define __BLE_UPAS_SERVICE_H__
jelord 94:c57720890e76 6
jelord 94:c57720890e76 7 class UPAS_Service {
jelord 94:c57720890e76 8 public:
jelord 94:c57720890e76 9 //All Characteristics shall have a read/write counterpart protocol. This should prevent corruption of data.
jelord 94:c57720890e76 10 const static uint16_t UPAS_SERVICE_UUID = 0xA000; //UUID of Service.
jelord 94:c57720890e76 11
jelord 94:c57720890e76 12 const static uint16_t RTC_CHARACTERISTIC_UUID = 0xA002; //UUID for characteristic to write the RTC to
jelord 94:c57720890e76 13 GattCharacteristic rtcCharacteristic;
jelord 94:c57720890e76 14
jelord 94:c57720890e76 15 const static uint16_t SAMPLETIME_CHARACTERISTIC_UUID = 0xA003; //UUID of variable that app will read from
jelord 94:c57720890e76 16 GattCharacteristic sampleTimeCharacteristic;
jelord 94:c57720890e76 17
jelord 94:c57720890e76 18 const static uint16_t SUBJECTLABEL_CHARACTERISTIC_UUID = 0xA004; //UUID of variable that app will read from
jelord 94:c57720890e76 19 GattCharacteristic subjectLabelCharacteristic;
jelord 94:c57720890e76 20
jelord 94:c57720890e76 21 const static uint16_t RUNREADY_CHARACTERISTIC_UUID = 0xA005; //UUID of variable that app will read from
jelord 94:c57720890e76 22 GattCharacteristic runReadyCharacteristic;
jelord 94:c57720890e76 23
jelord 94:c57720890e76 24 const static uint16_t RUNMODE_CHARACTERISTIC_UUID = 0xA006; //UUID of variable that app will read from
jelord 94:c57720890e76 25 GattCharacteristic runModeCharacteristic;
jelord 94:c57720890e76 26
jelord 94:c57720890e76 27
jelord 94:c57720890e76 28 UPAS_Service(BLEDevice &_ble, bool placeholder, uint8_t *rtc, uint8_t *sampleTime, uint8_t *subjectLabel) :
jelord 94:c57720890e76 29
jelord 94:c57720890e76 30 rtcCharacteristic(RTC_CHARACTERISTIC_UUID, rtc,6,20, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY ),
jelord 94:c57720890e76 31 sampleTimeCharacteristic(SAMPLETIME_CHARACTERISTIC_UUID, sampleTime,12,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 94:c57720890e76 32 subjectLabelCharacteristic(SUBJECTLABEL_CHARACTERISTIC_UUID, subjectLabel,15,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 94:c57720890e76 33 runReadyCharacteristic(RUNREADY_CHARACTERISTIC_UUID,0,0,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 94:c57720890e76 34 runModeCharacteristic(RUNMODE_CHARACTERISTIC_UUID,0,0,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 94:c57720890e76 35 ble(_ble)
jelord 94:c57720890e76 36 {
jelord 94:c57720890e76 37
jelord 94:c57720890e76 38 GattCharacteristic *charTable[] = {&rtcCharacteristic, &sampleTimeCharacteristic, &subjectLabelCharacteristic, &runReadyCharacteristic, &runModeCharacteristic}; //Set up characteristics to be broadcasted with the UPAS service
jelord 94:c57720890e76 39 GattService upasService(UPAS_Service::UPAS_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); //Finally, construct the service
jelord 94:c57720890e76 40 ble.addService(upasService);
jelord 94:c57720890e76 41 }
jelord 94:c57720890e76 42
jelord 94:c57720890e76 43 private:
jelord 94:c57720890e76 44 BLEDevice &ble;
jelord 94:c57720890e76 45
jelord 94:c57720890e76 46 // ReadOnlyGattCharacteristic<bool> placeholderState;
jelord 94:c57720890e76 47 };
jelord 94:c57720890e76 48
jelord 94:c57720890e76 49 #endif /* #ifndef __BLE_UPAS_SERVICE_H__ */