Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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
00001 //CODE BY JAKE LORD 00002 //ALL RIGHTS RESERVED BY VOLCKENS GROUP, FORT COLLINS CO 00003 00004 #ifndef __BLE_UPAS_SERVICE_H__ 00005 #define __BLE_UPAS_SERVICE_H__ 00006 00007 class UPAS_Service { 00008 public: 00009 //All Characteristics shall have a read/write counterpart protocol. This should prevent corruption of data. 00010 const static uint16_t UPAS_SERVICE_UUID = 0xA000; //UUID of Service. 00011 00012 const static uint16_t RTC_CHARACTERISTIC_UUID = 0xA002; //UUID for characteristic to write the RTC to 00013 GattCharacteristic rtcCharacteristic; 00014 00015 const static uint16_t SAMPLETIME_CHARACTERISTIC_UUID = 0xA003; //UUID of variable that app will read from 00016 GattCharacteristic sampleTimeCharacteristic; 00017 00018 const static uint16_t SUBJECTLABEL_CHARACTERISTIC_UUID = 0xA004; //UUID of variable that app will read from 00019 GattCharacteristic subjectLabelCharacteristic; 00020 00021 const static uint16_t RUNREADY_CHARACTERISTIC_UUID = 0xA005; //UUID of variable that app will read from 00022 GattCharacteristic runReadyCharacteristic; 00023 00024 const static uint16_t LOGINTERVAL_CHARACTERISTIC_UUID = 0xA006; //UUID of variable that app will read from 00025 GattCharacteristic logIntevalCharacteristic; 00026 00027 const static uint16_t FLOWRATE_CHARACTERISTIC_UUID = 0xA007; //UUID of variable that app will read from 00028 GattCharacteristic flowRateCharacteristic; 00029 00030 const static uint16_t SERIALNUMBER_CHARACTERISTIC_UUID = 0xA008; //UUID of variable that app will read from 00031 GattCharacteristic serialNumCharacteristic; 00032 00033 00034 00035 00036 00037 UPAS_Service(BLEDevice &_ble, bool placeholder, uint8_t *rtc, uint8_t *sampleTime, uint8_t *subjectLabel, uint8_t *logInterval, uint8_t *flowRate ) : 00038 00039 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 ), 00040 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), 00041 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), 00042 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), 00043 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), 00044 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), 00045 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), 00046 ble(_ble) 00047 { 00048 00049 GattCharacteristic *charTable[] = {&rtcCharacteristic, &sampleTimeCharacteristic, &subjectLabelCharacteristic, &runReadyCharacteristic, &logIntevalCharacteristic, &flowRateCharacteristic, &serialNumCharacteristic}; //Set up characteristics to be broadcasted with the UPAS service 00050 GattService upasService(UPAS_Service::UPAS_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); //Finally, construct the service 00051 ble.addService(upasService); 00052 } 00053 00054 private: 00055 BLEDevice &ble; 00056 00057 }; 00058 00059 #endif /* #ifndef __BLE_UPAS_SERVICE_H__ */
Generated on Wed Jul 13 2022 18:40:57 by
1.7.2
