#include "common.h"
#include "sensor.h"
+#include "actuator.h"
#include "control.h"
#include "options.h"
+#include "image.h"
/**The time period (in seconds) before the control key expires @ */
#define CONTROL_TIMEOUT 180
case FCGI_BOOL_T:
*((bool*) val->value) = true;
break;
- case FCGI_LONG_T:
- *((long*) val->value) = strtol(value, &ptr, 10);
+ case FCGI_INT_T: case FCGI_LONG_T: {
+ long parsed = strtol(value, &ptr, 10);
if (!*value || *ptr) {
snprintf(buf, BUFSIZ, "Expected int for '%s' but got '%s'", key, value);
FCGI_RejectJSON(context, FCGI_EscapeJSON(buf));
return false;
}
- break;
+
+ if (FCGI_TYPE(val->flags) == FCGI_INT_T)
+ *((int*) val->value) = parsed;
+ else
+ *((long*) val->value) = parsed;
+ } break;
case FCGI_DOUBLE_T:
*((double*) val->value) = strtod(value, &ptr);
if (!*value || *ptr) {
va_end(list);
}
+
+/**
+ * Write binary data
+ * See fwrite
+ */
+void FCGI_WriteBinary(void * data, size_t size, size_t num_elem)
+{
+ Log(LOGDEBUG,"Writing!");
+ FCGI_fwrite(data, size, num_elem, FCGI_stdout);
+}
+
/**
* Main FCGI request loop that receives/responds to client requests.
* @param data Reserved.
Log(LOGDEBUG, "First request...");
while (FCGI_Accept() >= 0) {
-
-
Log(LOGDEBUG, "Got request #%d", context.response_number);
ModuleHandler module_handler = NULL;
char module[BUFSIZ], params[BUFSIZ];
module_handler = Control_Handler;
} else if (!strcmp("sensors", module)) {
module_handler = Sensor_Handler;
+ } else if (!strcmp("actuators", module)) {
+ module_handler = Actuator_Handler;
+ } else if (!strcmp("image", module)) {
+ module_handler = Image_Handler;
}
context.current_module = module;