mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
Добавляем переменные в систему как специальный Item
This commit is contained in:
@@ -16,6 +16,7 @@ void* getAPI_SysExt(String subtype, String params);
|
||||
void* getAPI_Ads1115(String subtype, String params);
|
||||
void* getAPI_Mcp23017(String subtype, String params);
|
||||
void* getAPI_ButtonOut(String subtype, String params);
|
||||
void* getAPI_Variable(String subtype, String params);
|
||||
//============================================================================================
|
||||
|
||||
void* getAPI(String subtype, String params) {
|
||||
@@ -36,6 +37,7 @@ void* getAPI(String subtype, String params) {
|
||||
if ((tmpAPI = getAPI_Ads1115(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
|
||||
//================================================================================================================
|
||||
|
||||
return nullptr;
|
||||
|
||||
21
src/modules/Variable.cpp
Normal file
21
src/modules/Variable.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
|
||||
class Variable : public IoTItem {
|
||||
public:
|
||||
Variable(String parameters): IoTItem(parameters) { }
|
||||
|
||||
// особенность данного модуля - просто хранение значения для сценария, нет событий
|
||||
// void setValue(IoTValue Value) {
|
||||
// value = Value;
|
||||
// }
|
||||
};
|
||||
|
||||
void* getAPI_Variable(String subtype, String param) {
|
||||
if (subtype == F("Variable")) {
|
||||
return new Variable(param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user