Commit d4a59f54 authored by Cristina Cocho's avatar Cristina Cocho
Browse files

Work on Nomad3DFilter - Huge modifications related to Cameo

parent 9408aacd
......@@ -49,7 +49,7 @@ AxisRecorder::~AxisRecorder() {
void AxisRecorder::postConfiguration() {
m_experimentControllersMap = InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap();
m_experimentControllersMap = InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap(false);
map<string, ExperimentController*>::iterator it;
for (it = m_experimentControllersMap.begin(); it != m_experimentControllersMap.end(); it++) {
......
......@@ -48,7 +48,7 @@ CyclopsDataHeader::CyclopsDataHeader(const string& name) :
m_CyclopsSetting.init(this, "cyclops_setting");
map<string, ExperimentController*> experimentControllersMap =
InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap();
InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap(false);
map<string, ExperimentController*>::iterator it;
for (it = experimentControllersMap.begin(); it != experimentControllersMap.end(); it++) {
if (dynamic_cast<axis::AxisController*>(it->second) != 0) {
......
......@@ -69,9 +69,9 @@ GpCamComController::~GpCamComController() {
m_remoteApplication->stop();
// Wait for the termination
application::State state = m_remoteApplication->waitFor();
cameo::State state = m_remoteApplication->waitFor();
cout << "Remote application " << m_remoteApplication->getName() << " terminated with state " << application::toString(state) << endl;
cout << "Remote application " << m_remoteApplication->getName() << " terminated with state " << cameo::toString(state) << endl;
}
}
......@@ -81,11 +81,12 @@ void GpCamComController::postConfiguration() {
// Create a new server if it is not already created.
// In case of a simulated server, avoid the real remote endpoint.
if (serverEndpoint() == "" || m_driver->state() != REAL_DEVICE_CONTAINER) {
m_server.reset(new Server(application::This::getServer().getEndpoint()));
m_server.reset(cameo::Server::create(cameo::This::getServer().getEndpoint()).get());
}
else {
m_server.reset(new Server(serverEndpoint(), 1000));
m_server.reset(cameo::Server::create(serverEndpoint(), 1000).get());
}
m_server->init();
}
initialized = initApplication();
......@@ -100,7 +101,7 @@ void GpCamComController::postConfiguration() {
}
void GpCamComController::registerControllers() {
map<string, ExperimentController*> experimentControllersMap = InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap();
map<string, ExperimentController*> experimentControllersMap = InstrumentManager::getInstance()->getAllInstalledExperimentControllersMap(false);
map<string, ExperimentController*>::iterator it;
for (it = experimentControllersMap.begin(); it != experimentControllersMap.end(); it++) {
if (dynamic_cast<scan::GenericScan1D*>(it->second) != 0) {
......@@ -161,38 +162,41 @@ bool GpCamComController::initApplication() {
cout << "Remote server is connected" << endl;
m_remoteApplication = m_server->connect(REMOTE_APPLICATION);
if (m_remoteApplication->exists()) {
if (m_remoteApplication) {
// The application exists from a previous server session
m_remoteApplication->kill();
application::State state = m_remoteApplication->waitFor();
cout << "Terminated remote application with state " << application::toString(state) << endl;
cameo::State state = m_remoteApplication->waitFor();
cout << "Terminated remote application with state " << cameo::toString(state) << endl;
}
m_remoteApplication = m_server->start(REMOTE_APPLICATION);
if (!m_remoteApplication->exists()) {
try {
m_remoteApplication = m_server->start(REMOTE_APPLICATION);
} catch (...) {
cout << "No remote application" << endl;
return false;
}
// Create the requester
m_requester = application::Requester::create(*m_remoteApplication, RESPONDER);
m_requester = coms::Requester::create(*m_remoteApplication, RESPONDER);
if (m_requester.get() == 0) {
cout << "requester error" << endl;
return false;
}
m_requester->init();
// Create the subscriber.
m_subscriber = application::Subscriber::create(*m_remoteApplication, "publisher");
m_subscriber = coms::Subscriber::create(*m_remoteApplication, "publisher");
m_subscriber->init();
m_subscriberThread.reset(new std::thread([this] {
string event;
std::optional<std::string> event;
while (m_subscriber->receive(event)) {
while (event = m_subscriber->receive()) {
cout << "Received " << event << endl;
cout << "Received " << event.value() << endl;
}
}));
......@@ -237,16 +241,15 @@ void GpCamComController::start() {
// Init gpCAM.
m_requester->send(createInitRequest());
string responseMessage;
m_requester->receive(responseMessage);
std::optional<std::string> responseMessage = m_requester->receive();
cout << "Init response " << responseMessage << endl;
cout << "Init response " << responseMessage.value()<< endl;
// Test next point.
m_requester->send(createNextPointRequest());
m_requester->receive(responseMessage);
responseMessage = m_requester->receive();
cout << "Next point response " << responseMessage << endl;
cout << "Next point response " << responseMessage.value() << endl;
}
void GpCamComController::stop() {
......
......@@ -23,7 +23,7 @@
#include <controllers/common/acquisition/ExperimentData.h>
#include <controllers/common/utilities/CountSpy.h>
#include <drivers/utilities/null/NullDriver.h>
#include <cameo/cameo.h>
#include <cameo/api/cameo.h>
namespace gpcam {
......@@ -61,9 +61,9 @@ private:
static const std::string PUBLISHER;
std::unique_ptr<cameo::Server> m_server;
std::unique_ptr<cameo::application::Instance> m_remoteApplication;
std::unique_ptr<cameo::application::Requester> m_requester;
std::unique_ptr<cameo::application::Subscriber> m_subscriber;
std::unique_ptr<cameo::App> m_remoteApplication;
std::unique_ptr<cameo::coms::Requester> m_requester;
std::unique_ptr<cameo::coms::Subscriber> m_subscriber;
std::unique_ptr<std::thread> m_subscriberThread;
std::vector<scan::GenericScan1D*> m_scanControllers;
......
......@@ -125,7 +125,7 @@ void GpCamComSlave::postConfiguration() {
// Create a new server if it is not already created.
// In case of a simulated server, avoid the real remote endpoint.
if (gpCAMServerEndpoint() == "" || m_driver->state() != REAL_DEVICE_CONTAINER) {
m_gpCAMServer.reset(new Server(application::This::getServer().getEndpoint()));
m_gpCAMServer.reset(new Server(cameo::This::getServer().getEndpoint()));
}
else {
m_gpCAMServer.reset(new Server(gpCAMServerEndpoint(), 1000));
......@@ -133,7 +133,8 @@ void GpCamComSlave::postConfiguration() {
}
// Create the responder.
m_responder = application::Responder::create("gpcam-responder");
m_responder = coms::basic::Responder::create("gpcam-responder");
m_responder->init();
// Register the property updaters.
registerFloat64PropertyUpdater(m_tasSettings->as, as);
......@@ -168,7 +169,7 @@ bool GpCamComSlave::initApplication() {
cout << "gpCAM server is connected" << endl;
m_gpCAMApplication = m_gpCAMServer->connect(GPCAM_APPLICATION);
if (m_gpCAMApplication->exists()) {
if (m_gpCAMApplication) {
// The application already exists.
gpCAMMode = MANUAL;
......@@ -180,9 +181,9 @@ bool GpCamComSlave::initApplication() {
gpCAMMode = AUTOMATIC;
// We start the app.
m_gpCAMApplication = m_gpCAMServer->start(GPCAM_APPLICATION);
if (!m_gpCAMApplication->exists()) {
try {
m_gpCAMApplication = m_gpCAMServer->start(GPCAM_APPLICATION);
} catch (...) {
cout << "No remote application" << endl;
return false;
}
......@@ -380,7 +381,7 @@ void GpCamComSlave::start() {
cout << "Waiting for request" << endl;
// Get the request.
unique_ptr<application::Request> request = m_responder->receive();
unique_ptr<coms::basic::Request> request = m_responder->receive();
// The responder is canceled.
if (request.get() == nullptr) {
......@@ -571,9 +572,9 @@ void GpCamComSlave::stop() {
cout << "Stopping gpCAM" << endl;
m_gpCAMApplication->stop();
application::State state = m_gpCAMApplication->waitFor();
cameo::State state = m_gpCAMApplication->waitFor();
cout << "gpCAM application " << m_gpCAMApplication->getName() << " terminated with state " << application::toString(state) << endl;
cout << "gpCAM application " << m_gpCAMApplication->getName() << " terminated with state " << cameo::toString(state) << endl;
}
else {
cout << "Do not stop gpCAM in mode " << gpCAMMode() << endl;
......
......@@ -27,7 +27,7 @@
#include "controllers/tas/common/IncidentBeam.h"
#include "controllers/tas/common/TasScatteredBeam.h"
#include <drivers/utilities/null/NullDriver.h>
#include <cameo/cameo.h>
#include <cameo/api/cameo.h>
namespace gpcam {
......@@ -104,9 +104,9 @@ private:
ControllerPtr<tas::IncidentBeam> m_incidentBeam;
ControllerPtr<tas::TasScatteredBeam> m_scatteredBeam;
std::unique_ptr<cameo::application::Responder> m_responder;
std::unique_ptr<cameo::coms::basic::Responder> m_responder;
std::unique_ptr<cameo::Server> m_gpCAMServer;
std::unique_ptr<cameo::application::Instance> m_gpCAMApplication;
std::unique_ptr<cameo::App> m_gpCAMApplication;
static constexpr float64 WE = 2.702;
......
......@@ -111,9 +111,9 @@ LssAutoConfig::~LssAutoConfig() {
m_remoteApplication->stop();
// Wait for the termination
application::State state = m_remoteApplication->waitFor();
cameo::State state = m_remoteApplication->waitFor();
cout << "Remote application " << m_remoteApplication->getName() << " terminated with state " << application::toString(state) << endl;
cout << "Remote application " << m_remoteApplication->getName() << " terminated with state " << cameo::toString(state) << endl;
}
}
......@@ -123,14 +123,15 @@ void LssAutoConfig::postConfiguration() {
// Create a new server if it is not already created.
// In case of a simulated server, avoid the real remote endpoint.
if (serverEndpoint() == "" || m_driver->state() != REAL_DEVICE_CONTAINER) {
m_server.reset(new Server(application::This::getServer().getEndpoint()));
m_server.reset(cameo::Server::create(cameo::This::getServer().getEndpoint()).get());
} else {
m_server.reset(new Server(serverEndpoint(), 1000));
m_server.reset(cameo::Server::create(serverEndpoint(), 1000).get());
}
m_server->init();
}
// Get the count spy.
m_countSpy = dynamic_cast<utilities::CountSpy*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(utilities::CountSpy::TYPE));
m_countSpy = dynamic_cast<utilities::CountSpy*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(utilities::CountSpy::TYPE, false));
if (m_countSpy != nullptr) {
m_countSpy->attach(this);
}
......@@ -161,27 +162,30 @@ bool LssAutoConfig::initApplication() {
cout << "Remote server is connected" << endl;
m_remoteApplication = m_server->connect(REMOTE_APPLICATION);
if (m_remoteApplication->exists()) {
if (m_remoteApplication) {
// The application exists from a previous server session
m_remoteApplication->kill();
application::State state = m_remoteApplication->waitFor();
cout << "Terminated remote application with state " << application::toString(state) << endl;
cameo::State state = m_remoteApplication->waitFor();
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->exists()) {
} catch(...) {
//TODO ::AppStartException
cout << "No remote application" << endl;
return false;
}
// Create the requester
m_requester = application::Requester::create(*m_remoteApplication, RESPONDER);
m_requester = coms::Requester::create(*m_remoteApplication, RESPONDER);
if (m_requester.get() == nullptr) {
cout << "requester error" << endl;
return false;
}
m_requester->init();
// Initialize the list of types.
// Define the type of request.
......@@ -189,14 +193,13 @@ bool LssAutoConfig::initApplication() {
requestType.set_type(lssautoconfig::Request::Init);
// Send the request.
m_requester->sendBinary(requestType.SerializeAsString());
m_requester->send(requestType.SerializeAsString()); //sendBinary
// Wait for the response from the server.
string response;
m_requester->receiveBinary(response);
std::optional<std::string> response = m_requester->receive(); //receiveBinary(response)
lssautoconfig::InitResponse autoConfigResponse;
autoConfigResponse.ParseFromString(response);
autoConfigResponse.ParseFromString(response.value()); // we should check response.hasValue() first
// Calc type.
int size = autoConfigResponse.types_size();
......@@ -328,11 +331,10 @@ bool LssAutoConfig::sendRequestAndProcess() {
Date begin;
// Send the request.
m_requester->sendTwoBinaryParts(m_requestTypeStr, m_requestStr);
m_requester->sendTwoParts(m_requestTypeStr, m_requestStr);
// Wait for the response from the server.
string response;
m_requester->receiveBinary(response);
std::optional<std::string> response = m_requester->receive();
// Print the duration.
Date end;
......@@ -340,7 +342,7 @@ bool LssAutoConfig::sendRequestAndProcess() {
cout << "Request processed in " << ms << " ms" << endl;
lssautoconfig::NumorResponse autoConfigResponse;
autoConfigResponse.ParseFromString(response);
autoConfigResponse.ParseFromString(response.value()); // we should check response.hasValue()
calculatedRun = autoConfigResponse.numor();
scatterModelType = autoConfigResponse.scattermodeltype();
......
......@@ -20,7 +20,7 @@
#define LSS_AUTOCONFIG_H
#include <Controller.h>
#include <cameo/cameo.h>
#include <cameo/api/cameo.h>
#include <controllers/common/utilities/CountSpy.h>
#include <controllers/lss/remotelsssimulation/RemoteLSSSimulation.h>
#include <controllers/common/acquisition/Count.h>
......@@ -107,8 +107,8 @@ private:
static const std::string RESPONDER;
std::unique_ptr<cameo::Server> m_server;
std::unique_ptr<cameo::application::Instance> m_remoteApplication;
std::unique_ptr<cameo::application::Requester> m_requester;
std::unique_ptr<cameo::App> m_remoteApplication;
std::unique_ptr<cameo::coms::Requester> m_requester;
ControllerPtr<remotelsssimulation::RemoteLSSSimulation> m_simulation;
DriverPtr<driver::NullDriver> m_driver;
......
......@@ -152,10 +152,11 @@ void RemoteLSSSimulation::postConfiguration() {
// Create a new server if it is not already created.
// In case of a simulated server, avoid the real remote endpoint.
if (serverEndpoint() == "" || m_driver->state() != REAL_DEVICE_CONTAINER) {
m_server.reset(new Server(application::This::getServer().getEndpoint()));
m_server.reset(cameo::Server::create(cameo::This::getServer().getEndpoint()).get());
} else {
m_server.reset(new Server(serverEndpoint(), 1000));
m_server.reset(cameo::Server::create(serverEndpoint(), 1000).get());
}
m_server->init();
}
registerRefresher(displaySampleModelName, &RemoteLSSSimulation::refreshDisplaySampleModelProperty, this);
registerRefresher(displaySampleParametersValues, &RemoteLSSSimulation::refreshDisplaySampleParametersValuesProperty, this);
......@@ -304,30 +305,33 @@ bool RemoteLSSSimulation::initApplication() {
m_matlabApplication = m_server->connect(MATLAB_APPLICATION);
if (m_matlabApplication->exists() == false) {
m_matlabApplication = m_server->start(MATLAB_APPLICATION);
if (!m_matlabApplication->exists()) {
if (m_matlabApplication) {
try {
m_matlabApplication = m_server->start(MATLAB_APPLICATION);
} catch (...) {
cout << "No matlab application" << endl;
return false;
}
applicationState = m_matlabApplication->waitFor(application::STARTING);
applicationState = m_matlabApplication->waitFor(cameo::STARTING);
}
// First delete the requester if it exists.
m_requester.reset(0);
// Create a new requester.
m_requester = application::Requester::create(*m_matlabApplication, RESPONDER_NAME);
m_requester = coms::Requester::create(*m_matlabApplication, RESPONDER_NAME);
if (m_requester.get() == 0) {
cout << "requester error" << endl;
return false;
}
m_requester->init();
// Application initialized.
initialized = true;
applicationState = m_matlabApplication->waitFor(application::RUNNING);
applicationState = m_matlabApplication->waitFor(cameo::RUNNING);
cout << "Matlab application initialized" << endl;
......@@ -359,15 +363,14 @@ void RemoteLSSSimulation::test() {
jsonWriter.Key("request_type");
jsonWriter.Int(3);
jsonWriter.EndObject();
m_requester->sendBinary(jsonString.GetString());
m_requester->send(jsonString.GetString());
cout << getName() << " sent get data request " << endl;
// Wait for the response synchronously.
// Note that responses can be processed asynchronously if the server is able to.
string data;
m_requester->receiveBinary(data);
m_JsonDocument.Parse(data.c_str());
std::optional<std::string> data = m_requester->receive();
m_JsonDocument.Parse(data.value().c_str());
cout << "received test response " << m_JsonDocument["value"].GetInt() << endl;
......@@ -383,7 +386,7 @@ void RemoteLSSSimulation::start() {
bool RemoteLSSSimulation::initSimulate() {
acquisition::ExperimentData* title = dynamic_cast<acquisition::ExperimentData*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(acquisition::ExperimentData::TYPE));
acquisition::ExperimentData* title = dynamic_cast<acquisition::ExperimentData*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(acquisition::ExperimentData::TYPE, false));
if (title == nullptr) {
log(Level::s_Error) << " missing controller Title in this instrument" << endlog;
commandStatus.setError();
......@@ -461,7 +464,7 @@ void RemoteLSSSimulation::getData() {
jsonWriter.StartObject();
// 'instrument' : 'd11','d22' or 'd33'
acquisition::ExperimentData* title = dynamic_cast<acquisition::ExperimentData*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(acquisition::ExperimentData::TYPE));
acquisition::ExperimentData* title = dynamic_cast<acquisition::ExperimentData*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(acquisition::ExperimentData::TYPE, false));
if (title == nullptr) {
log(Level::s_Error) << " missing controller Title in this instrument" << endlog;
commandStatus.setError();
......@@ -479,7 +482,7 @@ void RemoteLSSSimulation::getData() {
jsonWriter.StartArray();
// %'source_size' : e.g. rectangular [30e-3, 30e-3] [m] or circular [30e-3] [m]
if (title->instrumentName() == "D11") {
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D11_COLLIMATION_TYPE));
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D11_COLLIMATION_TYPE, false));
if (collimation == nullptr) {
log(Level::s_Error) << " missing controller Collimation in this instrument" << endlog;
commandStatus.setError();
......@@ -527,7 +530,7 @@ void RemoteLSSSimulation::getData() {
}
}
} else if (title->instrumentName() == "D22") {
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D22_COLLIMATION_TYPE));
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D22_COLLIMATION_TYPE, false));
if (collimation == nullptr) {
log(Level::s_Error) << " missing controller Collimation in this instrument" << endlog;
commandStatus.setError();
......@@ -538,7 +541,7 @@ void RemoteLSSSimulation::getData() {
jsonWriter.Double(collimation->selectedApertInfo()[i] / 1000.);
}
} else if (title->instrumentName() == "D33") {
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D33_COLLIMATION_TYPE));
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D33_COLLIMATION_TYPE, false));
if (collimation == nullptr) {
log(Level::s_Error) << " missing controller Collimation in this instrument" << endlog;
commandStatus.setError();
......@@ -554,7 +557,7 @@ void RemoteLSSSimulation::getData() {
jsonWriter.Key("col");
// %'col' . : e.g. 12.8, 10.3, 7.8, 5.3, or 2.8 [m]
if (title->instrumentName() == "D11") {
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D11_COLLIMATION_TYPE));
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D11_COLLIMATION_TYPE, false));
if (collimation == nullptr) {
log(Level::s_Error) << " missing controller Collimation in this instrument" << endlog;
commandStatus.setError();
......@@ -565,7 +568,7 @@ void RemoteLSSSimulation::getData() {
jsonWriter.Double(8.0);
} else if (title->instrumentName() == "D22") {
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D22_COLLIMATION_TYPE));
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D22_COLLIMATION_TYPE, false));
if (collimation == nullptr) {
log(Level::s_Error) << " missing controller Collimation in this instrument" << endlog;
commandStatus.setError();
......@@ -574,7 +577,7 @@ void RemoteLSSSimulation::getData() {
}
jsonWriter.Double(collimation->selectedColSetup());
} else if (title->instrumentName() == "D33") {
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D33_COLLIMATION_TYPE));
lss::CollimationProperties* collimation = dynamic_cast<lss::CollimationProperties*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(D33_COLLIMATION_TYPE, false));
if (collimation == nullptr) {
log(Level::s_Error) << " missing controller Collimation in this instrument" << endlog;
commandStatus.setError();
......@@ -587,7 +590,7 @@ void RemoteLSSSimulation::getData() {
// %'sample_size' : e.g. rectangular [10e-3, 10e-3] [m] or circular [10e-3] [m]
jsonWriter.Key("sample_size");
jsonWriter.StartArray();
utilities::DataParams* dataparams = dynamic_cast<utilities::DataParams*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(utilities::DataParams::TYPE));
utilities::DataParams* dataparams = dynamic_cast<utilities::DataParams*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(utilities::DataParams::TYPE, false));
if (dataparams == nullptr) {
log(Level::s_Error) << " missing controller Data Params in this instrument" << endlog;
commandStatus.setError();
......@@ -634,7 +637,7 @@ void RemoteLSSSimulation::getData() {
jsonWriter.EndArray();
// %'wav' : 6 [angs] (monochromatic) or [1,2,3,4,5,6,....] (array of wavelength bin-centres for tof)
lss::LSSWavelength* wavelength = dynamic_cast<lss::LSSWavelength*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(lss::LSSWavelength::TYPE));
lss::LSSWavelength* wavelength = dynamic_cast<lss::LSSWavelength*>(InstrumentManager::getInstance()->getFirstExperimentControllerByType(lss::LSSWavelength::TYPE, false));
if (wavelength == nullptr) {
log(Level::s_Error) << " missing controller Wavelength in this instrument" << endlog;
commandStatus.setError();
......@@ -909,13 +912,12 @@ void RemoteLSSSimulation::getData() {
params = jsonString.GetString();
}
m_requester->sendTwoBinaryParts(request, params);
m_requester->sendTwoParts(request, params);
// Wait for the response synchronously.
// Note that responses can be processed asynchronously if the server is able to.
string datastring;
m_requester->receiveBinary(datastring);
m_JsonDocument.Parse(datastring.c_str());
std::optional<std::string> datastring = m_requester->receive();
m_JsonDocument.Parse(datastring.value().c_str());
if (m_JsonDocument["error"].GetStringLength() > 0) {
log(Level::s_Error) << " matlab error: " << m_JsonDocument["error"].GetString() << endlog;
}
......@@ -955,16 +957,15 @@ void RemoteLSSSimulation::init() {
jsonWriter.EndObject();
// Send the message.
m_requester->sendBinary(jsonString.GetString());
m_requester->send(jsonString.GetString());
cout << getName() << " sent get models request " << endl;
// Wait for the response synchronously.
// Note that responses can be processed asynchronously if the server is able to.
string data;
m_requester->receiveBinary(data);
std::optional<std::string> data = m_requester->receive();
m_JsonDocument.Parse(data.c_str());
m_JsonDocument.Parse(data.value().c_str());
cout << "received response " << m_JsonDocument["models"].Size() << endl;
if (m_JsonDocument["error"].GetStringLength() > 0) {
......
......@@ -26,7 +26,7 @@
#include <rapidjson/stringbuffer.h>
#include <rapidjson/prettywriter.h>
#include <rapidjson/document.h>
#include <cameo/cameo.h>
#include <cameo/api/cameo.h>
#include <memory>
#include <thread>
......@@ -133,8 +133,8 @@ private:
static const std::string D33_COLLIMATION_TYPE;
std::unique_ptr<cameo::Server> m_server;
std::unique_ptr<cameo::application::Instance> m_matlabApplication;
std::unique_ptr<cameo::application::Requester> m_requester;
std::unique_ptr<cameo::App> m_matlabApplication;
std::unique_ptr<cameo::coms::Requester> m_requester;
DriverPtr<driver::NullDriver> m_driver;
ControllerPtr<utilities::CountSpy> m_countSpy;
......
......@@ -89,9 +89,9 @@ ReductionController::~ReductionController() {
m_remoteApplication->stop();
// Wait for the termination
application::State state = m_remoteApplication->waitFor();
cameo::State state = m_remoteApplication->waitFor();