diff --git a/src/ePowerSwitchFront.cpp b/src/ePowerSwitchFront.cpp index c1a81aa..0b03f06 100644 --- a/src/ePowerSwitchFront.cpp +++ b/src/ePowerSwitchFront.cpp @@ -22,8 +22,8 @@ int main(int argc, char *argv[]) { if (argv[0][0] == '.') { TMFE::Instance()->Msg(MERROR, __FUNCTION__, - "Relative paths are strongly not recommended; " - "Please use an absolute path"); + "Relative paths are strongly discouraged; " + "please use an absolute path."); } std::string frontendName; @@ -83,18 +83,49 @@ void ePowerSwitchEquipment::refreshSocket(int socketId) { format("Socket ", socketId) + std::string(" current"); std::string midasRequestedSocketState = std::string("Off"); + MVOdbError ovbError; + int mepicscaReturnCode; fOdbEqVariables->RS(requestedVarname.c_str(), &midasRequestedSocketState, - true, midasRequestedSocketState.length() + 1); + true, midasRequestedSocketState.length() + 1, + &ovbError); + + if (ovbError.fError) { + fMfe->Msg(MERROR, __FUNCTION__, ovbError.fErrorString); + exit(EXIT_FAILURE); + } std::string epicsCurrentSocketState; - this->outletGetRecords.at(socketId)->get(&epicsCurrentSocketState); + mepicscaReturnCode = + this->outletGetRecords.at(socketId)->get(&epicsCurrentSocketState); + + if (mepicscaReturnCode != CM_SUCCESS) { + fMfe->Msg(MERROR, __FUNCTION__, + "Couldn't get the value, skipping refreshing socket %d. " + "Error code %d", + socketId, mepicscaReturnCode); + return; + } if (epicsCurrentSocketState != midasRequestedSocketState) { - this->outletSetRecords.at(socketId)->put(&midasRequestedSocketState); + mepicscaReturnCode = this->outletSetRecords.at(socketId)->put( + &midasRequestedSocketState); + + if (mepicscaReturnCode != CM_SUCCESS) { + fMfe->Msg(MERROR, __FUNCTION__, + "Couldn't put the value, skipping refreshing socket %d. " + "Error code %d", + socketId, mepicscaReturnCode); + return; + } } fOdbEqVariables->WS(currentVarname.c_str(), epicsCurrentSocketState.c_str(), - epicsCurrentSocketState.length() + 1); + epicsCurrentSocketState.length() + 1, &ovbError); + + if (ovbError.fError) { + fMfe->Msg(MERROR, __FUNCTION__, ovbError.fErrorString); + exit(EXIT_FAILURE); + } } void ePowerSwitchEquipment::refreshAllSockets() {