- Log(LOGDEBUG, "Id %d", id); // to stop compiler complaining for now
-
- if (action == NULL) { //Must have an action
- FCGI_RejectJSON(context, "No action specified");
- } else if (!strcmp(action, "start")) {
- FCGI_BeginControl(context, force);
- } else if (!strcmp(action, "stop")) { //Don't require control key to stop...
- //EMERGENCY STOP!! TODO - replace!
- FCGI_BeginJSON(context, STATUS_OK);
- FCGI_JSONPair("description", "stopped! (not)");
- FCGI_EndJSON();
- } else { //Under this section, the user must have the current control key.
- if (!FCGI_HasControl(context, control_key)) {
- FCGI_RejectJSONEx(context,
- STATUS_UNAUTHORIZED, "Invalid control key specified.");
- } else if (!strcmp(action, "end")) {
- FCGI_EndControl(context);
- } else if (!strcmp(action, "set")) {
- if (set_value == NULL || *set_value == '\0') {
- FCGI_RejectJSONEx(context,
- STATUS_ERROR, "Set called but no value specified.");
- } else
- {
-// ActuatorHandler(context, id, set_value);
- }
- }
+ pthread_mutex_unlock(&(g_controls.mutex));
+ return ret;
+}
+
+
+bool Control_Pause() {
+ bool ret = false;
+ pthread_mutex_lock(&(g_controls.mutex));
+ if (g_controls.state == STATE_RUNNING) {
+ Actuator_PauseAll();
+ Sensor_PauseAll();
+ g_controls.state = STATE_PAUSED;
+ ret = true;