- if (end) {
- *(context->login_key) = 0;
- FCGI_BeginJSON(context, STATUS_OK);
- FCGI_EndJSON();
- return;
+ FCGI_BeginJSON(context, STATUS_OK);
+ FCGI_JSONPair("description", "MCTX3420 Server API (2013)");
+ FCGI_JSONPair("build_date", __DATE__ " " __TIME__);
+ FCGI_JSONLong("api_version", API_VERSION);
+ if (identSensors) {
+ FCGI_JSONKey("sensors");
+ FCGI_JSONValue("{\n\t\t");
+ for (i = 0; i < NUMSENSORS; i++) {
+ if (i > 0) {
+ FCGI_JSONValue(",\n\t\t");
+ }
+ FCGI_JSONValue("\"%d\" : \"%s\"", i, g_sensor_names[i]);
+ }
+ FCGI_JSONValue("\n\t}");
+ }
+ if (identActuators) {
+ FCGI_JSONKey("actuators");
+ FCGI_JSONValue("{\n\t\t");
+ for (i = 0; i < NUMACTUATORS; i++) {
+ if (i > 0) {
+ FCGI_JSONValue(",\n\t\t");
+ }
+ FCGI_JSONValue("\"%d\" : \"%s\"", i, g_actuator_names[i]);
+ }
+ FCGI_JSONValue("\n\t}");