整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

57
hardware/Sensor.h Normal file
View file

@ -0,0 +1,57 @@
#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