Commit 2943c657 authored by Cristina Cocho's avatar Cristina Cocho
Browse files

work on hexamove controller

parent 9e37949d
......@@ -90,21 +90,31 @@ HexamoveController::HexamoveController(const std::string &name) :
m_appInitialized = false;
}
HexamoveController::HexamoveController(const HexamoveController &controller) :
ExperimentController(controller), Open3dView(this), SetFrames(this), GoToRefSystems(this), GoToMotion(this) {
m_appInitialized = false;
}
HexamoveController::~HexamoveController() {
}
void HexamoveController::postConfiguration() {
// Get cameo server
// if (m_server.get() == 0) {
// m_server = cameo::Server::create(serverEndpoint(), 1000);
// m_server->init();
// }
// initApplication();
if (m_server.get() == 0) {
m_server = cameo::Server::create(serverEndpoint(), 1000);
m_server->init();
}
initApplication();
}
void HexamoveController::open3DView() {
//TODO
if(m_appInitialized) {
m_requester->send("HOLA");
std::optional<std::string> responseMessage = m_requester->receive();
std::cout << "Received answer from responder " << responseMessage.value() << std::endl;
}
}
void HexamoveController::setFrames() {
......@@ -130,7 +140,7 @@ void HexamoveController::goToMotion() {
}
bool HexamoveController::initApplication() {
/* // (1) Start the remote server
// (1) Start the remote server
if (!m_server->isAvailable(1000)) {
return false;
}
......@@ -152,15 +162,18 @@ bool HexamoveController::initApplication() {
}
// (4) Create our Requester
// m_requester = cameo::coms::Requester::create(*m_3DViewApplication, RESPONDER);
// if (m_requester.get() == nullptr) {
// std::cout << "requester error" << std::endl;
// return false;
// }
// m_requester->init();
m_requester = cameo::coms::Requester::create(*m_3DViewApplication, RESPONDER);
if (m_requester.get() == nullptr) {
std::cout << "requester error" << std::endl;
return false;
}
std::cout << "Before INIT" << std::endl;
m_requester->init(); // Set a timeout to avoid blocking the server
std::cout << "After INIT" << std::endl;
m_appInitialized = true;
return true;*/
return true;
}
}
......@@ -85,6 +85,7 @@ public:
static const std::string TYPE;
HexamoveController(const std::string& name);
HexamoveController(const HexamoveController& controller);
virtual ~HexamoveController();
virtual void postConfiguration();
void open3DView();
......@@ -123,8 +124,8 @@ private:
static const int32 MOTION;
std::unique_ptr<cameo::Server> m_server;
// std::unique_ptr<cameo::App> m_3DViewApplication;
// std::unique_ptr<cameo::coms::Requester> m_requester;
std::unique_ptr<cameo::App> m_3DViewApplication;
std::unique_ptr<cameo::coms::Requester> m_requester;
static const std::string VIEW3D_APPLICATION;
static const std::string RESPONDER;
......
Supports Markdown
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