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 17 01:05:31 2015 +0000
Revision:
96:03106adb45c9
Parent:
94:c57720890e76
Child:
99:229435dd4cfb
Changes to Readability of BLE characterisitics

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 96:03106adb45c9 24 const static uint16_t LOGINTERVAL_CHARACTERISTIC_UUID = 0xA006; //UUID of variable that app will read from
jelord 96:03106adb45c9 25 GattCharacteristic logIntevalCharacteristic;
jelord 96:03106adb45c9 26
jelord 96:03106adb45c9 27 const static uint16_t FLOWRATE_CHARACTERISTIC_UUID = 0xA007; //UUID of variable that app will read from
jelord 96:03106adb45c9 28 GattCharacteristic flowRateCharacteristic;
jelord 94:c57720890e76 29
jelord 94:c57720890e76 30
jelord 96:03106adb45c9 31 UPAS_Service(BLEDevice &_ble, bool placeholder, uint8_t *rtc, uint8_t *sampleTime, uint8_t *subjectLabel, uint8_t *logInterval, uint8_t *flowRate) :
jelord 94:c57720890e76 32
jelord 94:c57720890e76 33 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 34 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 35 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 96:03106adb45c9 36 runReadyCharacteristic(RUNREADY_CHARACTERISTIC_UUID,0,0,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 96:03106adb45c9 37 logIntevalCharacteristic(LOGINTERVAL_CHARACTERISTIC_UUID,logInterval,1,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 96:03106adb45c9 38 flowRateCharacteristic(FLOWRATE_CHARACTERISTIC_UUID,flowRate,4,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 94:c57720890e76 39 ble(_ble)
jelord 94:c57720890e76 40 {
jelord 94:c57720890e76 41
jelord 96:03106adb45c9 42 GattCharacteristic *charTable[] = {&rtcCharacteristic, &sampleTimeCharacteristic, &subjectLabelCharacteristic, &runReadyCharacteristic, &logIntevalCharacteristic, &flowRateCharacteristic}; //Set up characteristics to be broadcasted with the UPAS service
jelord 94:c57720890e76 43 GattService upasService(UPAS_Service::UPAS_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); //Finally, construct the service
jelord 94:c57720890e76 44 ble.addService(upasService);
jelord 94:c57720890e76 45 }
jelord 94:c57720890e76 46
jelord 94:c57720890e76 47 private:
jelord 94:c57720890e76 48 BLEDevice &ble;
jelord 94:c57720890e76 49
jelord 94:c57720890e76 50 };
jelord 94:c57720890e76 51
jelord 94:c57720890e76 52 #endif /* #ifndef __BLE_UPAS_SERVICE_H__ */