Skip to content
Snippets Groups Projects
Commit aae95e35 authored by Locatelli's avatar Locatelli
Browse files

Add specific stuff for SANE

parent 7f6c84c8
No related branches found
No related tags found
No related merge requests found
......@@ -242,6 +242,15 @@ private:
configuration::WebSpyContainer container;
container.ParseFromString(data2);
WebServant webservant;
// SANE
map<string, string> heliums;
string useTempValue;
string mainTypeValue;
string mainIdValue;
string useInsertValue;
string insertTypeValue;
string insertIdValue;
//////
for(auto servant : container.servants()) {
bool visible = servant.visible();
string type = servant.type();
......@@ -251,9 +260,33 @@ private:
|| ((visible == false) && (type == "commandline"))
|| ((visible == false) && (type == "command_zone_spy")))
&& (servant.properties_size() > 3)) {
// SANE
string heliumvalue;
/////
WebServantController controller(servant.name());
for(auto property : servant.properties()) {
WebServantProperty wepproperty(property.name(), property.value());
if (property.name() == "level") {
heliumvalue = property.value();
}
else if (property.name() == "use_temp") {
useTempValue = property.value();
}
else if (property.name() == "main_type") {
mainTypeValue = property.value();
}
else if (property.name() == "main_id") {
mainIdValue = property.value();
}
else if (property.name() == "use_insert") {
useInsertValue = property.value();
}
else if (property.name() == "insert_type") {
insertTypeValue = property.value();
}
else if (property.name() == "insert_id") {
insertIdValue = property.value();
}
if (property.has_setpoint_name() && property.has_setpoint_value()) {
wepproperty.addSetPoint(property.setpoint_name(), property.setpoint_value());
}
......@@ -266,6 +299,12 @@ private:
controller.addProperty(property.id(), wepproperty);
}
webservant.addController(type, controller);
// SANE
// Create Stats file for SANE
if ((type == "level") && (servant.name().find("Helium") != string::npos)) {
heliums[servant.name()] = heliumvalue;
}
////
}
}
ofstream fout(instrumentNameTmp.c_str(), ios::out);
......@@ -277,6 +316,27 @@ private:
boost::filesystem::remove (instrumentName);
}
boost::filesystem::copy_file(instrumentNameTmp, instrumentName);
// SANE
string filename = "sane/" + name + "_helium.txt";
ofstream file(filename.c_str(), fstream::trunc);
if (useTempValue == "true") {
file << mainTypeValue << " " << mainIdValue << endl;
}
else {
file << "Nothing" << endl;
}
if (useInsertValue == "true") {
file << insertTypeValue << " " << insertIdValue << endl;
}
else {
file << "No Insert" << endl;
}
for(auto h : heliums) {
file << h.first << " " << h.second << endl;
}
file.close();
////
}
else if (message.type() == configuration::WebSpyMessage::Plot) {
string filename = LOCALPATH + name + "_" + message.filename() + ".png";
......@@ -395,6 +455,16 @@ int32 main(int32 argc, char* argv[]) {
err = state->execute(argc, argv, userName);
delete state;
}
string filename = "inc/" + instrumentName + ".inc";
if (boost::filesystem::exists(filename) == true) {
boost::filesystem::remove (filename);
}
filename = "sane/" + instrumentName + "_helium.txt";
if (boost::filesystem::exists(filename) == true) {
boost::filesystem::remove (filename);
}
This::terminate();
return err;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment