removing redundancy error message, and exiting if we are disconnected from midas

This commit is contained in:
2026-05-01 14:48:10 +02:00
parent 130b1962b3
commit 96e75fe16b
+10 -27
View File
@@ -64,7 +64,6 @@ void ePowerSwitchEquipment::refreshOutlet(int outletId) {
}
std::string midasRequestedOutletState = std::string("Off");
MVOdbError ovbError;
int mepicscaReturnCode;
fOdbEqVariables->RS(usernameVarname.c_str(), &midasUsername, true,
midasUsername.length() + 1, &ovbError);
if (ovbError.fError) {
@@ -91,28 +90,18 @@ void ePowerSwitchEquipment::refreshOutlet(int outletId) {
}
std::string epicsCurrentOutletState;
mepicscaReturnCode =
int mepicscaReturnCode =
this->outletGetRecords.at(outletId)->get(&epicsCurrentOutletState);
if (mepicscaReturnCode != CM_SUCCESS) {
fMfe->Msg(MERROR, __FUNCTION__,
"Couldn't get the value, skipping refreshing outlet %d. "
"Error code %d",
outletId, mepicscaReturnCode);
if (mepicscaReturnCode != CM_SUCCESS)
return;
}
if (epicsCurrentOutletState != midasRequestedOutletState) {
mepicscaReturnCode = this->outletSetRecords.at(outletId)->put(
&midasRequestedOutletState);
if (mepicscaReturnCode != CM_SUCCESS) {
fMfe->Msg(MERROR, __FUNCTION__,
"Couldn't put the value, skipping refreshing outlet %d. "
"Error code %d",
outletId, mepicscaReturnCode);
if (mepicscaReturnCode != CM_SUCCESS)
return;
}
}
fOdbEqVariables->WS(currentVarname.c_str(), epicsCurrentOutletState.c_str(),
@@ -133,20 +122,10 @@ void ePowerSwitchEquipment::refreshAllOutlets() {
void ePowerSwitchEquipment::updateOutletNumber() {
int epicsOutletNumber = 0;
if (!outletNumberRecord.connected()) {
fMfe->Msg(MERROR, __FUNCTION__,
"Couldn't connect to outlet number record.");
return;
}
int returnCode = outletNumberRecord.get(&epicsOutletNumber);
if (returnCode < 0) {
fMfe->Msg(MERROR, __FUNCTION__,
"Couldn't get outlet number record. [ERROR_CODE : %d]\n "
"Skipping function execution",
returnCode);
if (returnCode != CM_SUCCESS)
return;
}
if (this->numberOfOutlet < epicsOutletNumber)
fMfe->Msg(MDEBUG, __FUNCTION__,
@@ -204,12 +183,16 @@ void ePowerSwitchEquipment::updateOutletNumber() {
MVOdbError ovbError;
fOdbEqVariables->Delete(requestedVarname.c_str(), &ovbError);
if (ovbError.fError)
if (ovbError.fError) {
fMfe->Msg(MERROR, __FUNCTION__, ovbError.fErrorString);
exit(EXIT_FAILURE);
}
fOdbEqVariables->Delete(currentVarname.c_str(), &ovbError);
if (ovbError.fError)
if (ovbError.fError) {
fMfe->Msg(MERROR, __FUNCTION__, ovbError.fErrorString);
exit(EXIT_FAILURE);
}
this->outletSetRecords.pop_back();
this->outletGetRecords.pop_back();