#include "plaqui/server/command.h"
#include "plaqui/server/connection.h"
+#include "plaqui/server/receiver.h" // TODO TEMPRORAL
#include <string>
namespace PlaQui {
/// Señal para indicar que se recibió un error.
SignalErrorReceived error_received;
+ /// Receptor del estado de la planta TODO Temporal.
+ Receiver receiver;
+
// Métodos.
private:
*/
SignalErrorReceived& signal_error_received(void);
+ /**
+ * Obtiene la señal que avisa cuando se recibió un cuadro.
+ */
+ Receiver::SignalFrameReceived& signal_frame_received(void);
+
};
}
#ifdef DEBUG
cerr << __FILE__ << ": destructor." << endl;
#endif // DEBUG
+ // TODO Temporal: espero que el receiver muera.
+ receiver.finish(true);
}
ControlClient::ControlClient(const string& host, const Connection::Port& port):
}
host = socket->localhost();
port = socket->localport();
- // TODO sacar a la mierda?
+ // TODO sacar signal_connected?
connected();
+ // TODO Temporal: el receiver empieza a escuchar.
+ receiver.run();
while (!stop) {
HTTPResponse response;
try {
return error_received;
}
+// TODO - temporal
+Receiver::SignalFrameReceived& ControlClient::signal_frame_received(void) {
+ return receiver.signal_frame_received();
+}
+
} // namespace Server
} // namespace PlaQui
cout << " Body: " << body << endl;
}
+void on_frame_received(const string& frame) {
+ cout << " Frame recibido! :-D" << endl;
+ cout << frame << endl;
+}
+
void on_error_received(unsigned code) {
cout << " Respuesta recibida: Error nro " << code << "! :-(" << endl;
}
client->signal_connected().connect(SigC::slot(on_connected));
client->signal_ok_received().connect(SigC::slot(on_ok_received));
client->signal_error_received().connect(SigC::slot(on_error_received));
+ client->signal_frame_received().connect(SigC::slot(on_frame_received));
client->run();
char buf[BUFSIZ];
while (cin.getline(buf, BUFSIZ)) {