]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/server.h
Se corrige el bug al parsear el xml.
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / server.h
index 21a1958e798dd6dc6973d8c65bd28e801059a6b5..20458bbcd6e7693a56df4d37fb1e6264bf3a7ae5 100644 (file)
 
 #include "plaqui/server/tcpserver.h"
 #include "plaqui/server/controlserver.h"
 
 #include "plaqui/server/tcpserver.h"
 #include "plaqui/server/controlserver.h"
-#include "plaqui/server/transmitter.h"
+//#include "plaqui/server/transmitter.h"
 #include "plaqui/server/plant.h"
 #include "plaqui/server/command.h"
 #include "plaqui/server/plant.h"
 #include "plaqui/server/command.h"
+#include "plaqui/server/response.h"
 #include <socket++/sockinet.h>
 #include <string>
 #include <map>
 #include <socket++/sockinet.h>
 #include <string>
 #include <map>
@@ -47,6 +48,7 @@ namespace Server {
         */
        class Server: public TCPServer {
 
         */
        class Server: public TCPServer {
 
+               /////////////////////////////////////////////////////////////////////
                // Tipos.
 
                private:
                // Tipos.
 
                private:
@@ -54,6 +56,7 @@ namespace Server {
                        /// Lista de plantas químicas.
                        typedef std::map<std::string, Plant*> PlantList;
 
                        /// Lista de plantas químicas.
                        typedef std::map<std::string, Plant*> PlantList;
 
+               /////////////////////////////////////////////////////////////////////
                // Atributos.
 
                private:
                // Atributos.
 
                private:
@@ -64,6 +67,7 @@ namespace Server {
                        /// Mutex para las plantas.
                        Glib::Mutex plants_mutex;
 
                        /// Mutex para las plantas.
                        Glib::Mutex plants_mutex;
 
+               /////////////////////////////////////////////////////////////////////
                // Métodos.
 
                protected:
                // Métodos.
 
                protected:
@@ -78,49 +82,69 @@ namespace Server {
                        virtual Connection* new_connection(const sockbuf::sockdesc& sd);
 
                        /**
                        virtual Connection* new_connection(const sockbuf::sockdesc& sd);
 
                        /**
-                        * Maneja el comando server/status.
+                        * Maneja el comando server/info.
                         */
                         */
-                       HTTPResponse* cmd_server_status(void) const;
+                       Response* cmd_server_info(void) const;
 
                        /**
                         * Maneja el comando connection/list.
                         */
 
                        /**
                         * Maneja el comando connection/list.
                         */
-                       HTTPResponse* cmd_connection_list(void);
+                       Response* cmd_connection_list(void);
 
                        /**
                         * Maneja el comando connection/stop.
                         */
 
                        /**
                         * Maneja el comando connection/stop.
                         */
-                       HTTPResponse* cmd_connection_stop(const Command& command);
+                       Response* cmd_connection_stop(const Command& command);
 
                        /**
                         * Maneja el comando transmission/list.
                         */
 
                        /**
                         * Maneja el comando transmission/list.
                         */
-                       HTTPResponse* cmd_transmission_list(void);
+                       Response* cmd_transmission_list(void);
 
                        /**
                         * Maneja el comando transmission/start.
                         */
 
                        /**
                         * Maneja el comando transmission/start.
                         */
-                       HTTPResponse* cmd_transmission_start(const Command& command);
+                       Response* cmd_transmission_start(const Command& command);
 
                        /**
                         * Maneja el comando transmission/stop.
                         */
 
                        /**
                         * Maneja el comando transmission/stop.
                         */
-                       HTTPResponse* cmd_transmission_stop(const Command& command);
+                       Response* cmd_transmission_stop(const Command& command);
 
                        /**
                         * Maneja el comando plant/list.
                         */
 
                        /**
                         * Maneja el comando plant/list.
                         */
-                       HTTPResponse* cmd_plant_list(void);
+                       Response* cmd_plant_list(void);
 
                        /**
                         * Maneja el comando plant/get.
                         */
 
                        /**
                         * Maneja el comando plant/get.
                         */
-                       HTTPResponse* cmd_plant_get(const Command& command);
+                       Response* cmd_plant_get(const Command& command);
+
+                       /**
+                        * Maneja el comando plant/set.
+                        */
+                       Response* cmd_plant_set(const Command& command);
+
+                       /**
+                        * Maneja el comando plant/set_frequency.
+                        */
+                       Response* cmd_plant_set_frequency(const Command& command);
+
+                       /**
+                        * Maneja el comando plant/start.
+                        */
+                       Response* cmd_plant_start(const Command& command);
 
                        /**
                         * Maneja el comando plant/stop.
                         */
 
                        /**
                         * Maneja el comando plant/stop.
                         */
-                       HTTPResponse* cmd_plant_stop(const Command& command);
+                       Response* cmd_plant_stop(const Command& command);
+
+                       /**
+                        * Maneja el comando plant/remove.
+                        */
+                       Response* cmd_plant_remove(const Command& command);
 
                public:
 
 
                public:
 
@@ -132,10 +156,11 @@ namespace Server {
                        /**
                         * Constructor.
                         *
                        /**
                         * Constructor.
                         *
-                        * \param port Puerto en el cual escuchar.
+                        * \param plant_filename Nombre del archivo con la planta a cargar.
+                        * \param port           Puerto en el cual escuchar.
                         */
                        Server(const std::string& plant_filename,
                         */
                        Server(const std::string& plant_filename,
-                                       const Connection::Port& port = 7522);
+                                       const Connection::Port& port = 7522) throw(sockerr);
 
                        /**
                         * Maneja los comandos recibidos por las conexiones.
 
                        /**
                         * Maneja los comandos recibidos por las conexiones.
@@ -146,17 +171,10 @@ namespace Server {
                        /**
                         * Se encarga de borrar una planta de la lista cuando finaliza.
                         *
                        /**
                         * Se encarga de borrar una planta de la lista cuando finaliza.
                         *
-                        * \param connection Conexión a eliminar.
+                        * \param plant Nombre de la planta a elminar.
                         */
                        void on_plant_finished(const char* plant);
 
                         */
                        void on_plant_finished(const char* plant);
 
-                       /**
-                        * Envia el estado de una planta cuando esta se actualiza.
-                        *
-                        * \param plant Planta actualizada.
-                        */
-                       void on_plant_updated(const Plant* const);
-
        };
 
 }
        };
 
 }