2022-01-14 22:51:28 +01:00
|
|
|
#include "Configuration.h"
|
2022-01-15 16:30:34 +01:00
|
|
|
#include "modules/AnalogAdc.h"
|
2022-01-14 20:22:52 +01:00
|
|
|
|
2022-01-15 02:01:22 +01:00
|
|
|
std::vector<IoTSensor*> iotSensors;
|
|
|
|
|
|
|
|
|
|
void configure(String path) {
|
2022-01-14 20:42:11 +01:00
|
|
|
File file = seekFile(path);
|
2022-01-15 02:01:22 +01:00
|
|
|
file.find("[");
|
2022-01-14 20:42:11 +01:00
|
|
|
while (file.available()) {
|
|
|
|
|
String jsonArrayElement = file.readStringUntil('}') + "}";
|
2022-01-15 02:01:22 +01:00
|
|
|
if (jsonArrayElement.startsWith(",")) {
|
|
|
|
|
jsonArrayElement = jsonArrayElement.substring(1, jsonArrayElement.length()); //это нужно оптимизировать в последствии
|
|
|
|
|
}
|
2022-01-15 16:30:34 +01:00
|
|
|
|
|
|
|
|
myIoTSensor = (IoTSensor*)getAPI_AnalogAdc(jsonArrayElement);
|
|
|
|
|
if (myIoTSensor) {
|
|
|
|
|
iotSensors.push_back(myIoTSensor);
|
2022-01-14 20:42:11 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file.close();
|
2022-01-14 20:22:52 +01:00
|
|
|
}
|