Skip to content
Snippets Groups Projects
Commit 665de63f authored by Tomasz Kozak's avatar Tomasz Kozak
Browse files

Merge branch 'wip/tkozak-40-Data-with-invalid-flag'

parents bed97419 5cdc0a0f
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,14 @@ namespace ChimeraTK {
// DoocsUpdater
auto data = _processScalar->accessData(0);
bool storeInHistory = true;
auto archiverStatus = ArchiveStatus::sts_ok;
if(_processScalar->dataValidity() != ChimeraTK::DataValidity::ok) {
if(this->d_error()) // data are alredy invalid, do not store in history
storeInHistory = false;
archiverStatus = ArchiveStatus::sts_err;
//set data invalid in DOOCS for current data
this->d_error(stale_data);
}
else {
......@@ -70,14 +77,16 @@ namespace ChimeraTK {
// we must not call set_and_archive if there is no history (otherwise it
// will be activated), but we have to if it is there. -> Abstraction,
// please!
if(this->get_histPointer()) {
//
// We should also checked if data should be stored (flag storeInHistory). Invalid data should NOT be stored except first invalid data point.
// (https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter/issues/40)
if(this->get_histPointer() && storeInHistory) {
// Set eventId
doocs::EventId eventId;
if(_macroPulseNumberSource) eventId = doocs::EventId(_macroPulseNumberSource->accessData(0));
/*FIXME: The archiver also has a status code. Set it correctly.*/
// The timestamp we give with set_and_archive is for the archiver only.
this->set_and_archive(data, ArchiveStatus::sts_ok, timestamp, eventId);
this->set_and_archive(data, archiverStatus, timestamp, eventId);
}
else {
this->set_value(data);
......
......@@ -62,10 +62,16 @@ namespace ChimeraTK {
return;
}
bool storeInHistory = true;
auto archiverStatus = ArchiveStatus::sts_ok;
if(_i1Value->dataValidity() != ChimeraTK::DataValidity::ok ||
_f1Value->dataValidity() != ChimeraTK::DataValidity::ok ||
_f2Value->dataValidity() != ChimeraTK::DataValidity::ok ||
_f3Value->dataValidity() != ChimeraTK::DataValidity::ok) {
if(this->d_error()) // data are alredy invalid, do not store in history
storeInHistory = false;
archiverStatus = ArchiveStatus::sts_err;
this->d_error(stale_data);
}
else {
......@@ -85,15 +91,17 @@ namespace ChimeraTK {
set_global_timestamp(timestamp);
}
if(this->get_histPointer()) {
// We should also checked if data should be stored (flag storeInHistory). Invalid data should NOT be stored except first invalid data point.
// (https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter/issues/40)
if(this->get_histPointer() && storeInHistory) {
/*
doocs::EventId eventId =
(_macroPulseNumberSource) ? doocs::EventId(_macroPulseNumberSource->accessData(0)) : doocs::EventId(0);
*/
/*FIXME: The archiver also has a status code. Set it correctly.*/
/*FIXME: This set_and_archive does not support the timestamp yet (only sec and msec, and I guess m is milli?)*/
/*FIXME: This set_and_archive does not support eventIDs yet */
this->set_and_archive(&ifff, ArchiveStatus::sts_ok, 0, 0 /*msec*/);
this->set_and_archive(&ifff, archiverStatus, 0, 0 /*msec*/);
}
else {
this->set_value(&ifff);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment