Commit 9f83c043 authored by yannick legoc's avatar yannick legoc
Browse files

Added attributes to spy in D22AutoConfig

parent e2caac75
......@@ -47,7 +47,9 @@ AutoConfig::AutoConfig(const std::string& name) :
serverEndpoint.init(this, SAVE, "cameo_server");
initialized.init(this, NOSAVE, "initialized");
scatterModelType.init(this, NOSAVE | SPY, "scatter_model_type", "Model");
scatterModelType.init(this, NOSAVE, "scatter_model_type");
scatterModel.init(this, NOSAVE | SPY, "scatter_model", "Model");
scatterModelAccuracy.init(this, NOSAVE | SPY, "scatter_model_accuracy", "Accuracy");
sampleParameters.init(this, NOSAVE | SPY, "sample_parameters", "Sample");
calcTypeSize.init(this, NOSAVE, "calc_type_size");
......@@ -310,49 +312,51 @@ void AutoConfig::start() {
autoConfigResponse.ParseFromString(response);
scatterModelType = autoConfigResponse.scattermodeltype();
scatterModel = autoConfigResponse.scattermodel();
scatterModelAccuracy = autoConfigResponse.scattermodelaccuracy();
string status = autoConfigResponse.status();
if (status == "ERROR") {
commandProgression = 100;
commandStatus.setError();
}
else {
int size = autoConfigResponse.results_size();
resultSize = size;
int size = autoConfigResponse.results_size();
resultSize = size;
type.resize(size);
distance.resize(size);
wavelength.resize(size);
collimation.resize(size);
type.resize(size);
distance.resize(size);
wavelength.resize(size);
collimation.resize(size);
for (int i = 0; i < size; ++i) {
type.set(i, autoConfigResponse.results(i).type());
distance.set(i, autoConfigResponse.results(i).parameters().distance());
wavelength.set(i, autoConfigResponse.results(i).parameters().wavelength());
collimation.set(i, autoConfigResponse.results(i).parameters().collimation());
}
for (int i = 0; i < size; ++i) {
type.set(i, autoConfigResponse.results(i).type());
distance.set(i, autoConfigResponse.results(i).parameters().distance());
wavelength.set(i, autoConfigResponse.results(i).parameters().wavelength());
collimation.set(i, autoConfigResponse.results(i).parameters().collimation());
}
string sampleParametersString;
for (int i = 0; i < autoConfigResponse.sampleparameters_size() - 1; ++i) {
sampleParametersString += autoConfigResponse.sampleparameters(i).type() + " " + to_string(autoConfigResponse.sampleparameters(i).value()) + ", ";
}
int i = autoConfigResponse.sampleparameters_size() - 1;
sampleParametersString += autoConfigResponse.sampleparameters(i).type() + " " + to_string(autoConfigResponse.sampleparameters(i).value());
sampleParameters = sampleParametersString;
string sampleParametersString;
for (int i = 0; i < autoConfigResponse.sampleparameters_size() - 1; ++i) {
sampleParametersString += autoConfigResponse.sampleparameters(i).type() + " " + to_string(autoConfigResponse.sampleparameters(i).value()) + ", ";
}
int i = autoConfigResponse.sampleparameters_size() - 1;
sampleParametersString += autoConfigResponse.sampleparameters(i).type() + " " + to_string(autoConfigResponse.sampleparameters(i).value());
sampleParameters = sampleParametersString;
// Intermediate progression.
commandProgression = 50;
// Intermediate progression.
commandProgression = 50;
if (status == "ERROR") {
commandStatus.setError();
log(Level::s_Error) << "No prediction" << endlog;
}
else {
log(Level::s_Debug) << "Apply" << endlog;
apply();
// End progression.
commandProgression = 100;
commandStatus.setIdle();
}
// End progression.
commandProgression = 100;
commandStatus.setIdle();
log(Level::s_Info) << "Finished auto settings" << endlog;
}
......
......@@ -51,6 +51,8 @@ public:
Property<bool> initialized;
Property<std::string> scatterModelType;
Property<std::string> scatterModel;
Property<std::string> scatterModelAccuracy;
Property<std::string> sampleParameters;
Property<int32> calcTypeSize;
......
......@@ -55,7 +55,9 @@ message InitResponse {
message NumorResponse {
required string scatterModelType = 1;
required string status = 2;
repeated SampleParameters sampleParameters = 3;
repeated Result results = 4;
required string scatterModel = 2;
required string scatterModelAccuracy = 3;
required string status = 4;
repeated SampleParameters sampleParameters = 5;
repeated Result results = 6;
}
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