2022-01-14 22:51:28 +01:00
|
|
|
#include "Configuration.h"
|
2022-01-14 20:22:52 +01:00
|
|
|
|
2022-01-14 20:42:11 +01:00
|
|
|
void configure(String& path) {
|
|
|
|
|
File file = seekFile(path);
|
|
|
|
|
while (file.available()) {
|
|
|
|
|
String jsonArrayElement = file.readStringUntil('}') + "}";
|
2022-01-14 22:51:28 +01:00
|
|
|
String subtype;
|
|
|
|
|
if (jsonRead(jsonArrayElement, F("subtype"), subtype)) {
|
|
|
|
|
if (subtype == F("button-out")) {
|
2022-01-14 20:42:11 +01:00
|
|
|
//=============================
|
2022-01-14 22:51:28 +01:00
|
|
|
} else if (subtype == F("pwm-out")) {
|
2022-01-14 21:48:43 +01:00
|
|
|
//=============================
|
2022-01-14 22:51:28 +01:00
|
|
|
} else if (subtype == F("analog-adc")) {
|
2022-01-15 00:14:36 +01:00
|
|
|
// iotSensors.push_back(new IoTSensorAnalog(jsonArrayElement));
|
2022-01-14 20:47:24 +01:00
|
|
|
} else {
|
|
|
|
|
SerialPrint(F("E"), F("Config"), F("config.json error, type not exist"));
|
2022-01-14 20:42:11 +01:00
|
|
|
}
|
|
|
|
|
} else {
|
2022-01-14 20:47:24 +01:00
|
|
|
SerialPrint(F("E"), F("Config"), F("config.json error, type wrong or missing"));
|
2022-01-14 20:42:11 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file.close();
|
2022-01-14 20:22:52 +01:00
|
|
|
}
|