Files
IoTManager/src/ESPConfiguration.cpp
2022-01-15 17:41:12 +01:00

27 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "ESPConfiguration.h"
std::vector<IoTSensor*> iotSensors;
//============================================================================================
//здесь скопируйте строку и вставьте ниже, заменив имя AnalogAdc на название вашего сенсора
extern void* getAPI_AnalogAdc(String params);
//============================================================================================
void configure(String path) {
File file = seekFile(path);
file.find("[");
while (file.available()) {
String jsonArrayElement = file.readStringUntil('}') + "}";
if (jsonArrayElement.startsWith(",")) {
jsonArrayElement = jsonArrayElement.substring(1, jsonArrayElement.length()); //это нужно оптимизировать в последствии
}
//===============================================================================================================
//здесь нужно скопировать блок еще раз и вставить его ниже, переименовав AnalogAdc на название вашего сенсора
myIoTSensor = (IoTSensor*)getAPI_AnalogAdc(jsonArrayElement);
if (myIoTSensor) {
iotSensors.push_back(myIoTSensor);
}
//================================================================================================================
}
file.close();
}