-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
Actually, I have the following definition:
struct Sensor {
int value;
int type;
};
class SensorState {
public:
Sensor sensors[4];
static void read(SensorState& settings, JsonObject& root) {
for (int i = 0; i < 4; i++) {
root["value"][i] = settings.sensors[i].value;
root["type"][i] = settings.sensors[i].type;
}
}
...
};
I would like to use a JSON array instead of an object to have code that looks more like this:
class SensorState {
public:
Sensor sensors[4];
static void read(SensorState& settings, JsonArray& root) {
for (int i = 0; i < 4; i++) {
root[i]["value"] = settings.sensors[i].value;
root[i]["type"] = settings.sensors[i].type;
}
}
...
};
Do you know how I can do that?
I tried modifying StatefullService to accept arrays, but I confess I'm not proficient enough in C++ to accomplish it.
I love this framework and I congratulate @rjwats once again for creating it.
It would be great in my case if I could pass arrays instead of objects.
Metadata
Metadata
Assignees
Labels
No labels