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
UPAS_Service.h
- Committer:
- caseyquinn
- Date:
- 2016-03-05
- Revision:
- 124:15466d0f04ab
- Parent:
- 104:c57913399e79
File content as of revision 124:15466d0f04ab:
//CODE BY JAKE LORD //ALL RIGHTS RESERVED BY VOLCKENS GROUP, FORT COLLINS CO #ifndef __BLE_UPAS_SERVICE_H__ #define __BLE_UPAS_SERVICE_H__ class UPAS_Service { public: //All Characteristics shall have a read/write counterpart protocol. This should prevent corruption of data. const static uint16_t UPAS_SERVICE_UUID = 0xA000; //UUID of Service. const static uint16_t RTC_CHARACTERISTIC_UUID = 0xA002; //UUID for characteristic to write the RTC to GattCharacteristic rtcCharacteristic; const static uint16_t SAMPLETIME_CHARACTERISTIC_UUID = 0xA003; //UUID of variable that app will read from GattCharacteristic sampleTimeCharacteristic; const static uint16_t SUBJECTLABEL_CHARACTERISTIC_UUID = 0xA004; //UUID of variable that app will read from GattCharacteristic subjectLabelCharacteristic; const static uint16_t RUNREADY_CHARACTERISTIC_UUID = 0xA005; //UUID of variable that app will read from GattCharacteristic runReadyCharacteristic; const static uint16_t LOGINTERVAL_CHARACTERISTIC_UUID = 0xA006; //UUID of variable that app will read from GattCharacteristic logIntevalCharacteristic; const static uint16_t FLOWRATE_CHARACTERISTIC_UUID = 0xA007; //UUID of variable that app will read from GattCharacteristic flowRateCharacteristic; const static uint16_t SERIALNUMBER_CHARACTERISTIC_UUID = 0xA008; //UUID of variable that app will read from GattCharacteristic serialNumCharacteristic; UPAS_Service(BLEDevice &_ble, bool placeholder, uint8_t *rtc, uint8_t *sampleTime, uint8_t *subjectLabel, uint8_t *logInterval, uint8_t *flowRate ) : 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 ), 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), subjectLabelCharacteristic(SUBJECTLABEL_CHARACTERISTIC_UUID, subjectLabel,8,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), 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), 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), 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), serialNumCharacteristic(SERIALNUMBER_CHARACTERISTIC_UUID,0,0,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), ble(_ble) { GattCharacteristic *charTable[] = {&rtcCharacteristic, &sampleTimeCharacteristic, &subjectLabelCharacteristic, &runReadyCharacteristic, &logIntevalCharacteristic, &flowRateCharacteristic, &serialNumCharacteristic}; //Set up characteristics to be broadcasted with the UPAS service GattService upasService(UPAS_Service::UPAS_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); //Finally, construct the service ble.addService(upasService); } private: BLEDevice &ble; }; #endif /* #ifndef __BLE_UPAS_SERVICE_H__ */