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.
WeatherStation.h
- Committer:
- loicguibert
- Date:
- 2019-03-25
- Revision:
- 12:856286ad4cdc
- Parent:
- 11:dbc310addbf6
- Child:
- 14:c5578b5edabe
File content as of revision 12:856286ad4cdc:
#pragma once
#include "Logger.h"
#include "IDevKit.h"
#include "LPS25HBDevice.h"
#include "HDC1000Device.h"
#include "MeasurementHistory.h"
#include "ble/BLE.h"
#include "GAPPeripheral.h"
#include <ctime>
class WeatherStation : public GAPPeripheral {
public:
// constructor
WeatherStation(IDevKit& iDevKit, Logger& logger, BLE& ble);
// called for starting the weather station
// it will start getting measurements and advertise with data measurements
void start();
// called by timer
void performMeasurements(void);
// Called at the end of performMeasurements(void): encode and send values to the GAP Peripheral
void setupAdvertisementPayload(double pressure, double temp, double humidity);
private:
// data members
// event queue for handling all events (including timers)
events::EventQueue m_eventQueue;
// measurement interval
static const int m_measurementInterval;
// blink interval
static const int m_blinkInterval;
//Station name
static const string m_stationName;
// reference to dev kit
IDevKit& m_iDevKit;
// reference to logger
Logger& m_logger;
// reference to devices
LPS25HBDevice m_lps25hb;
HDC1000Device m_hdc1000;
// reference to values' history storage
MeasurementHistory m_history;
// reference to advertising payload
ServiceDataPayload dataPayload[1];
};