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.
Diff: EnvironmentalService.cpp
- Revision:
- 14:c5578b5edabe
- Child:
- 15:aac1b3950a9e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnvironmentalService.cpp Tue Apr 02 09:51:34 2019 +0000 @@ -0,0 +1,32 @@ +#include "EnvironmentalService.h" + +#include "mbed.h" + +EnvironmentalService::EnvironmentalService(BLE& ble, Logger& logger) +: m_ble(ble), + m_serviceAdded(false), + //m_batteryLevelCharacteristic(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, &m_batteryLevel), + m_logger(logger) { +} + +void EnvironmentalService::addServiceToGattServer(void) { + // We should only ever need to add the information service once + if (m_serviceAdded) { + return; + } + + //GattCharacteristic *charTable[] = { &m_batteryLevelCharacteristic }; + + //GattService environmentalService(GattService::UUID_ENVIRONMENTAL_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); + //m_ble.gattServer().addService(environmentalService); + + m_serviceAdded = true; + + m_logger.log("Environmental service added\r\n"); +} + + /*void EnvironmentalService::updateEnvironmentalValues(BatteryLevelType_t newBatteryLevelVal) { + m_batteryLevel = newBatteryLevelVal; + m_ble.gattServer().write(m_batteryLevelCharacteristic.getValueHandle(), (uint8_t *) &m_batteryLevel, sizeof(BatteryLevelType_t)); +} +*/