X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/ea73629e106c1ba77bcd09feac7e22035f28b7d7..e76a2b3254a9ddd5902230ca21c532168d0e93b4:/Server/src/plant.cpp?ds=inline diff --git a/Server/src/plant.cpp b/Server/src/plant.cpp index ce9f737..b020e21 100644 --- a/Server/src/plant.cpp +++ b/Server/src/plant.cpp @@ -27,7 +27,7 @@ #include "plaqui/server/plant.h" #include -#include +#include #include #ifdef DEBUG # include @@ -79,11 +79,12 @@ void Plant::real_run(void) { while (!stop) { simulator_mutex.lock(); simulator.simulate(); + string plantstatus = simulator.get_state_as_xml(); simulator_mutex.unlock(); transmissions_mutex.lock(); for (TransmitterList::iterator i = transmissions.begin(); i != transmissions.end(); i++) { - (*i)->send(simulator.get_state_as_xml()); + (*i)->send(plantstatus); } transmissions_mutex.unlock(); Glib::usleep(1000000); @@ -129,6 +130,9 @@ bool Plant::transmission_start(string& host, Connection::Port& port) { // return false; } transmissions.push_back(trans); + trans->signal_finished().connect(SigC::bind( + SigC::slot_class(*this, &Plant::on_transmission_finished), + trans)); trans->run(); host = trans->get_host(); port = trans->get_port(); @@ -138,9 +142,9 @@ bool Plant::transmission_start(string& host, Connection::Port& port) { bool Plant::transmission_stop(const string& host, const Connection::Port& port) { #ifdef DEBUG - cerr << __FILE__ << "(" << __LINE__ << ")" - << ": transmission_stop(host = " << host << - ", port = " << port << ")." << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": transmission_stop(host = " << host << + ", port = " << port << ")." << endl; #endif // DEBUG Glib::Mutex::Lock lock(transmissions_mutex); for (TransmitterList::iterator i = transmissions.begin(); @@ -153,7 +157,7 @@ bool Plant::transmission_stop(const string& host, return false; // No la encontrĂ³. } -bool Plant::on_transmission_finished(Transmitter* transmission) { +void Plant::on_transmission_finished(Transmitter* transmission) { #ifdef DEBUG cerr << __FILE__ << "(" << __LINE__ << ")" << ": on_transmission_finished(transmission = "