Commit 8f0decf4 authored by legoc's avatar legoc
Browse files

Some cameo related code

parent 70857ad2
...@@ -6,3 +6,4 @@ ...@@ -6,3 +6,4 @@
/INSTALL /INSTALL
/Makefile.in /Makefile.in
.settings/ .settings/
/configure~
\ No newline at end of file
...@@ -130,6 +130,8 @@ void GpCamComSlave::postConfiguration() { ...@@ -130,6 +130,8 @@ void GpCamComSlave::postConfiguration() {
else { else {
m_gpCAMServer = Server::create(gpCAMServerEndpoint(), 1000); m_gpCAMServer = Server::create(gpCAMServerEndpoint(), 1000);
} }
m_gpCAMServer->init();
} }
// Create the responder. // Create the responder.
...@@ -183,7 +185,8 @@ bool GpCamComSlave::initApplication() { ...@@ -183,7 +185,8 @@ bool GpCamComSlave::initApplication() {
// We start the app. // We start the app.
try { try {
m_gpCAMApplication = m_gpCAMServer->start(GPCAM_APPLICATION); m_gpCAMApplication = m_gpCAMServer->start(GPCAM_APPLICATION);
} catch (...) { }
catch (const StartException& e) {
cout << "No remote application" << endl; cout << "No remote application" << endl;
return false; return false;
} }
...@@ -384,7 +387,7 @@ void GpCamComSlave::start() { ...@@ -384,7 +387,7 @@ void GpCamComSlave::start() {
unique_ptr<coms::basic::Request> request = m_responder->receive(); unique_ptr<coms::basic::Request> request = m_responder->receive();
// The responder is canceled. // The responder is canceled.
if (request.get() == nullptr) { if (!request) {
loopStatus = IDLE; loopStatus = IDLE;
// Reset the mode. // Reset the mode.
return; return;
...@@ -524,13 +527,7 @@ void GpCamComSlave::start() { ...@@ -524,13 +527,7 @@ void GpCamComSlave::start() {
} }
loopStatus = REPLYING; loopStatus = REPLYING;
request->reply(response);
request->setTimeout(10000);
if (!request->reply(response)) {
cout << "Timeout while replying to gpCAM" << endl;
error = true;
break;
}
cout << "Replied " << response << endl; cout << "Replied " << response << endl;
} }
......
...@@ -236,9 +236,10 @@ bool LssAutoConfig::initApplication() { ...@@ -236,9 +236,10 @@ bool LssAutoConfig::initApplication() {
cout << "Terminated remote application with state " << cameo::toString(state) << endl; cout << "Terminated remote application with state " << cameo::toString(state) << endl;
} }
m_remoteApplication = m_server->start(REMOTE_APPLICATION); try {
m_remoteApplication = m_server->start(REMOTE_APPLICATION);
if (m_remoteApplication->getActualState() != cameo::RUNNING) { }
catch (const StartException& e) {
cout << "No remote application" << endl; cout << "No remote application" << endl;
return false; return false;
} }
......
...@@ -369,12 +369,13 @@ bool RemoteLSSSimulation::initApplication() { ...@@ -369,12 +369,13 @@ bool RemoteLSSSimulation::initApplication() {
m_matlabApplication = m_server->connect(MATLAB_APPLICATION); m_matlabApplication = m_server->connect(MATLAB_APPLICATION);
if (m_matlabApplication->getActualState() != cameo::RUNNING) { if (m_matlabApplication->getActualState() != cameo::RUNNING) {
m_matlabApplication = m_server->start(MATLAB_APPLICATION); try {
if (m_matlabApplication->getActualState() != cameo::RUNNING) { m_matlabApplication = m_server->start(MATLAB_APPLICATION);
}
catch (const StartException& e) {
cout << "No matlab application" << endl; cout << "No matlab application" << endl;
return false; return false;
} }
applicationState = m_matlabApplication->waitFor(cameo::STARTING);
} }
// First delete the requester if it exists. // First delete the requester if it exists.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment