mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-28 15:12:19 +03:00
Новый модуль Math для хранения математических функция для сценариев
This commit is contained in:
25
src/modules/virtual/Math/Math.cpp
Normal file
25
src/modules/virtual/Math/Math.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
class IoTMath : public IoTItem {
|
||||
private:
|
||||
public:
|
||||
IoTMath(String parameters) : IoTItem(parameters) {}
|
||||
|
||||
IoTValue execute(String command, std::vector<IoTValue> ¶m) {
|
||||
if(command == "map" & param.size() == 5) {
|
||||
IoTValue valTmp;
|
||||
valTmp.isDecimal = true;
|
||||
valTmp.valD = map(param[0].valD, param[1].valD, param[2].valD, param[3].valD, param[4].valD);
|
||||
return valTmp;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
void *getAPI_IoTMath(String subtype, String param) {
|
||||
if (subtype == F("IoTMath")) {
|
||||
return new IoTMath(param);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user