mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
Добавляем механизм глобальных векторов для модулей и сенсоров. Модуль Dallas полностью интегрирован поновому
This commit is contained in:
20
include/Class/IoTModule.h
Normal file
20
include/Class/IoTModule.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <WString.h>
|
||||
|
||||
struct ModuleInfo
|
||||
{
|
||||
String name;
|
||||
String key;
|
||||
String parameters;
|
||||
String type;
|
||||
};
|
||||
|
||||
class IoTModule {
|
||||
public:
|
||||
IoTModule();
|
||||
~IoTModule();
|
||||
|
||||
virtual void* initInstance(String parameters);
|
||||
virtual ModuleInfo getInfo();
|
||||
};
|
||||
20
include/Class/IoTSensor.h
Normal file
20
include/Class/IoTSensor.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <WString.h>
|
||||
|
||||
class IoTSensor {
|
||||
public:
|
||||
IoTSensor();
|
||||
~IoTSensor();
|
||||
|
||||
void loop();
|
||||
virtual void doByInterval();
|
||||
void init(unsigned long interval, String key);
|
||||
void regEvent(String value, String consoleInfo);
|
||||
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
unsigned long _interval;
|
||||
String _key;
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifdef EnableSensorDallas
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
#include "Global.h"
|
||||
|
||||
//ИНТЕГРИРУЮ: Объявляем глагольные переменные необходимые интегрируемой библиотеке
|
||||
extern DallasTemperature sensors;
|
||||
extern OneWire* oneWire;
|
||||
|
||||
//ИНТЕГРИРУЮ: следим за наименованиями далее
|
||||
class SensorDallas;
|
||||
|
||||
typedef std::vector<SensorDallas> MySensorDallasVector;
|
||||
|
||||
class SensorDallas {
|
||||
public:
|
||||
//ИНТЕГРИРУЮ: обращаем внимание на параметры, берутся из таблицы настроек
|
||||
SensorDallas(unsigned long interval, unsigned int pin, unsigned int index, String addr, String key);
|
||||
~SensorDallas();
|
||||
|
||||
void loop();
|
||||
void readDallas();
|
||||
|
||||
private:
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
unsigned long _interval;
|
||||
String _key;
|
||||
String _addr;
|
||||
unsigned int _pin;
|
||||
unsigned int _index;
|
||||
};
|
||||
|
||||
extern MySensorDallasVector* mySensorDallas2;
|
||||
|
||||
extern void dallas();
|
||||
#endif
|
||||
Reference in New Issue
Block a user