| 43 | } |
| 44 | |
| 45 | void onAjaxInput(HttpRequest& request, HttpResponse& response) |
| 46 | { |
| 47 | JsonObjectStream* stream = new JsonObjectStream(); |
| 48 | JsonObject json = stream->getRoot(); |
| 49 | json["status"] = (bool)true; |
| 50 | |
| 51 | String stringKey = F("StringKey"); |
| 52 | String stringValue = F("StringValue"); |
| 53 | |
| 54 | json[stringKey] = stringValue; |
| 55 | |
| 56 | for(int i = 0; i < 11; i++) { |
| 57 | String desiredString = F("sensor_") + String(i); |
| 58 | json[desiredString] = desiredString; |
| 59 | } |
| 60 | |
| 61 | JsonObject gpio = json.createNestedObject("gpio"); |
| 62 | for(unsigned i = 0; i < ARRAY_SIZE(inputs); ++i) { |
| 63 | gpio[String(i)] = digitalRead(inputs[i]); |
| 64 | } |
| 65 | |
| 66 | response.sendDataStream(stream, MIME_JSON); |
| 67 | } |
| 68 | |
| 69 | void onAjaxFrequency(HttpRequest& request, HttpResponse& response) |
| 70 | { |
nothing calls this directly
no test coverage detected