![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
This is a basic program that provides the necessary BLE service to allow communications with the UPAS
Dependencies: BLE_API mbed nRF51822 CronoDot EEPROM NCP5623BMUTBG ADS1115 BME280 Calibration_one MCP40D17 SDFileSystem LSM303 SI1145 STC3100
Fork of BLE_Button by
UPAS_Service.h
- Committer:
- jelord
- Date:
- 2015-10-23
- Revision:
- 11:1058647c66e8
- Parent:
- 10:66549fa08986
- Child:
- 12:27273e6a50b3
File content as of revision 11:1058647c66e8:
//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: const static uint16_t UPAS_SERVICE_UUID = 0xA000; //UUID of Service. Following two are read/write characteristics of the service const static uint16_t WRITE_STATE_CHARACTERISTIC_UUID = 0xA002; //UUID for variable that app will write to const static uint16_t READ_STATE_CHARACTERISTIC_UUID = 0xA003; //UUID of variable that app will read from GattCharacteristic readChar; GattCharacteristic writeChar; UPAS_Service(BLE &_ble, bool placeholder, uint8_t *tempArray) : ble(_ble), readChar(READ_STATE_CHARACTERISTIC_UUID, tempArray,18,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), writeChar(WRITE_STATE_CHARACTERISTIC_UUID, tempArray,18,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) { GattCharacteristic *charTable[] = {&writeChar, &readChar}; //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.gattServer().addService(upasService); } private: BLE &ble; // ReadOnlyGattCharacteristic<bool> placeholderState; }; #endif /* #ifndef __BLE_UPAS_SERVICE_H__ */