57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#ifndef F49794A5_C3E3_4955_B9B2_6BAA267D3436
|
|
#define F49794A5_C3E3_4955_B9B2_6BAA267D3436
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include <Poco/SharedPtr.h>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace Hardware
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class Sensor
|
|
{
|
|
public:
|
|
using Ptr = Poco::SharedPtr<Sensor>;
|
|
|
|
enum Type
|
|
{
|
|
TEMPERATURE,
|
|
};
|
|
|
|
public:
|
|
Sensor(Type type);
|
|
virtual ~Sensor();
|
|
|
|
public:
|
|
virtual void read(float& value);
|
|
virtual void read(float values[]);
|
|
|
|
Type type();
|
|
|
|
private:
|
|
Type _type;
|
|
};
|
|
|
|
class SensorManager
|
|
{
|
|
public:
|
|
static Sensor& getDefaultSensor(Sensor::Type type);
|
|
static void registerSensor(Sensor::Type type, Sensor::Ptr pSensor);
|
|
|
|
private:
|
|
using SensorList = std::vector<Sensor::Ptr>;
|
|
using SensorCollection = std::map<Sensor::Type, SensorList>;
|
|
|
|
private:
|
|
static SensorCollection _sensorCollection;
|
|
};
|
|
}
|
|
#endif
|