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.
EnvironmentalService.h
- Committer:
- loicguibert
- Date:
- 2019-04-16
- Revision:
- 15:aac1b3950a9e
- Parent:
- 14:c5578b5edabe
- Child:
- 16:eed9a9ba319c
File content as of revision 15:aac1b3950a9e:
#pragma once
#include "ble/BLE.h"
// for logging
#include "Logger.h"
class EnvironmentalService {
public:
typedef uint32_t PressureType_t;
typedef int16_t TemperatureType_t;
typedef uint16_t HumidityType_t;
/**
* @brief BatteryService constructor.
* @param ble Reference to BLE device.
*/
EnvironmentalService(BLE& ble, Logger& logger);
/**
* Called after initialization of the BLE module for adding the service
* to the GATT server
*/
void addServiceToGattServer(void);
/**
* @brief Update battery level characteristic.
* @param newBatteryLevelVal New battery level measurement.
*/
void updateEnvironmentalService(PressureType_t newPressure, TemperatureType_t newTemperature, HumidityType_t newHumidity);
private:
// data members
BLE& m_ble;
bool m_serviceAdded;
PressureType_t m_pressure;
TemperatureType_t m_temperature;
HumidityType_t m_humidity;
// characteristics belonging to the service
ReadOnlyGattCharacteristic<PressureType_t> m_pressureCharacteristic;
ReadOnlyGattCharacteristic<TemperatureType_t> m_temperatureCharacteristic;
ReadOnlyGattCharacteristic<HumidityType_t> m_humidityCharacteristic;
// logger instance
Logger& m_logger;
};