+ return new Response(Response::PLANT_NOT_FOUND,
+ string("No existe la planta '") + plant + "'");
+ }
+ bool open = true;
+ if ((value == "false") || (value == "0") || (value == "off")
+ || (value == "no")) {
+ open = false;
+ }
+ if (!plants[plant]->set_open(element, open)) {
+ return new Response(Response::ERROR_CHANGING_ELEMENT_INPUT,
+ string("No se pudo cambiar la entrada '") + input
+ + "' del elemento '" + element + "' de la planta '"
+ + plant + "'");
+ }
+ return new Response(Response::OK,
+ string("Se cambió la entrada '") + input + "' del elemento '"
+ + element + "' de la planta '" + plant + "' a '" + value + "'");
+}
+
+Response* Server::cmd_plant_set_frequency(const Command& command) {
+ if (command.get_args().size() < 2) {
+ return new Response(Response::ARGUMENT_MISSING, "Faltan argumentos "
+ " para el comando 'set_frequency' del destino 'plant'");
+ }
+ Glib::Mutex::Lock lock(plants_mutex);
+ const string name = command.get_args()[0];
+ if (plants.find(name) == plants.end()) {
+ return new Response(Response::PLANT_NOT_FOUND,
+ string("No existe la planta '") + name + "'");
+ }
+ unsigned hz;
+ to(command.get_args()[1], hz);
+ plants[name]->set_frequency(hz);
+ String shz;
+ shz.from(hz);
+ return new Response(Response::OK,
+ string("Se cambió la frecuencia de refresco de la planta '") + name
+ + "' a '" + shz + "' veces por segundo");
+}
+
+Response* Server::cmd_plant_start(const Command& command) {
+ if (!command.get_args().size()) {
+ return new Response(Response::ARGUMENT_MISSING, "Faltan argumentos "
+ " para el comando 'start' del destino 'plant'");
+ }
+ Glib::Mutex::Lock lock(plants_mutex);
+ const string name = command.get_args()[0];
+ if (plants.find(name) == plants.end()) {
+ return new Response(Response::PLANT_NOT_FOUND,
+ string("No existe la planta '") + name + "'");
+ }
+ plants[name]->set_paused(false);
+ return new Response(Response::OK,
+ string("La planta '") + name + "' fue reanudada");
+}
+
+Response* Server::cmd_plant_stop(const Command& command) {
+ if (!command.get_args().size()) {
+ return new Response(Response::ARGUMENT_MISSING, "Faltan argumentos "
+ " para el comando 'stop' del destino 'plant'");
+ }
+ Glib::Mutex::Lock lock(plants_mutex);
+ const string name = command.get_args()[0];
+ if (plants.find(name) == plants.end()) {
+ return new Response(Response::PLANT_NOT_FOUND,
+ string("No existe la planta '") + name + "'");