#ifndef BAROMETERSENSORDUMMY_H
#define BAROMETERSENSORDUMMY_H

#include "../BarometerSensor.h"
#include "RandomSensor.h"
#include <random>

class BarometerSensorDummy : public RandomSensor<BarometerData, BarometerSensor> {

private:

	std::thread thread;

	/** hidden ctor */
	BarometerSensorDummy() : RandomSensor(Timestamp::fromMS(100)) {
		;
	}

public:

	/** singleton access */
	static BarometerSensorDummy& get() {
		static BarometerSensorDummy baro;
		return baro;
	}

protected:

	std::minstd_rand gen;
	std::uniform_real_distribution<float> distNoise = std::uniform_real_distribution<float>(-0.09, +0.09);

	BarometerData getRandomEntry() override {

		const Timestamp ts = Timestamp::fromRunningTime();

		const float hPa = 930 + std::sin(ts.sec()) * 0.5 + distNoise(gen);
		return BarometerData(hPa);

	}

};

#endif // BAROMETERSENSORDUMMY_H
