diff --git a/src/device/ePowerSwitchEquipment.cpp b/src/device/ePowerSwitchEquipment.cpp index 3417036..cd6fc4c 100644 --- a/src/device/ePowerSwitchEquipment.cpp +++ b/src/device/ePowerSwitchEquipment.cpp @@ -20,7 +20,7 @@ ePowerSwitchEquipment::ePowerSwitchEquipment(std::string equipmentName, const char *equipmentFileName) : TMFeEquipment(equipmentName.c_str(), equipmentFileName), outletNumberRecord(mEpicsCa( - std::string_view(EPOWERSWITCH_SOCKETNUMBER_INFO_PREFIX))) { + std::string_view(EPOWERSWITCH_OUTLETNUMBER_INFO_PREFIX))) { fEqConfPeriodMilliSec = 1000; // refresh rate of midas frontend fEqConfLogHistory = @@ -32,37 +32,37 @@ ePowerSwitchEquipment::ePowerSwitchEquipment(std::string equipmentName, } void ePowerSwitchEquipment::HandlePeriodic() { - updateSocketNumber(); - refreshAllSockets(); + updateOutletNumber(); + refreshAllOutlets(); } -void ePowerSwitchEquipment::refreshSocket(int socketId) { +void ePowerSwitchEquipment::refreshOutlet(int outletId) { std::string usernameVarname; { - static const std::string str1 = "Socket "; + static const std::string str1 = "Outlet "; static const std::string str2 = " name"; - usernameVarname = insert(&str1, socketId, &str2); + usernameVarname = insert(&str1, outletId, &str2); } std::string requestedVarname; { static const std::string str1 = "|-> "; static const std::string str2 = " requested"; - requestedVarname = insert(&str1, socketId, &str2); + requestedVarname = insert(&str1, outletId, &str2); } std::string currentVarname; { static const std::string str1 = "\\-> "; static const std::string str2 = " current"; - currentVarname = insert(&str1, socketId, &str2); + currentVarname = insert(&str1, outletId, &str2); } std::string midasUsername; { - static const std::string str1 = "Socket "; + static const std::string str1 = "Outlet "; static const std::string str2 = ""; - midasUsername = insert(&str1, socketId, &str2); + midasUsername = insert(&str1, outletId, &str2); } - std::string midasRequestedSocketState = std::string("Off"); + std::string midasRequestedOutletState = std::string("Off"); MVOdbError ovbError; int mepicscaReturnCode; fOdbEqVariables->RS(usernameVarname.c_str(), &midasUsername, true, @@ -72,8 +72,8 @@ void ePowerSwitchEquipment::refreshSocket(int socketId) { exit(EXIT_FAILURE); } - fOdbEqVariables->RS(requestedVarname.c_str(), &midasRequestedSocketState, - true, midasRequestedSocketState.length() + 1, + fOdbEqVariables->RS(requestedVarname.c_str(), &midasRequestedOutletState, + true, midasRequestedOutletState.length() + 1, &ovbError); if (ovbError.fError) { @@ -90,33 +90,33 @@ void ePowerSwitchEquipment::refreshSocket(int socketId) { exit(EXIT_FAILURE); } - std::string epicsCurrentSocketState; + std::string epicsCurrentOutletState; mepicscaReturnCode = - this->outletGetRecords.at(socketId)->get(&epicsCurrentSocketState); + this->outletGetRecords.at(outletId)->get(&epicsCurrentOutletState); if (mepicscaReturnCode != CM_SUCCESS) { fMfe->Msg(MERROR, __FUNCTION__, - "Couldn't get the value, skipping refreshing socket %d. " + "Couldn't get the value, skipping refreshing outlet %d. " "Error code %d", - socketId, mepicscaReturnCode); + outletId, mepicscaReturnCode); return; } - if (epicsCurrentSocketState != midasRequestedSocketState) { - mepicscaReturnCode = this->outletSetRecords.at(socketId)->put( - &midasRequestedSocketState); + 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 socket %d. " + "Couldn't put the value, skipping refreshing outlet %d. " "Error code %d", - socketId, mepicscaReturnCode); + outletId, mepicscaReturnCode); return; } } - fOdbEqVariables->WS(currentVarname.c_str(), epicsCurrentSocketState.c_str(), - epicsCurrentSocketState.length() + 1, &ovbError); + fOdbEqVariables->WS(currentVarname.c_str(), epicsCurrentOutletState.c_str(), + epicsCurrentOutletState.length() + 1, &ovbError); if (ovbError.fError) { fMfe->Msg(MERROR, __FUNCTION__, ovbError.fErrorString); @@ -124,13 +124,13 @@ void ePowerSwitchEquipment::refreshSocket(int socketId) { } } -void ePowerSwitchEquipment::refreshAllSockets() { +void ePowerSwitchEquipment::refreshAllOutlets() { for (int i = 0; i < this->numberOfOutlet; i++) { - refreshSocket(i); + refreshOutlet(i); } } -void ePowerSwitchEquipment::updateSocketNumber() { +void ePowerSwitchEquipment::updateOutletNumber() { int epicsOutletNumber = 0; if (!outletNumberRecord.connected()) { @@ -150,13 +150,13 @@ void ePowerSwitchEquipment::updateSocketNumber() { if (this->numberOfOutlet < epicsOutletNumber) fMfe->Msg(MDEBUG, __FUNCTION__, - "Socket number increasing, creating %d new socket(s)", + "Outlet number increasing, creating %d new outlet(s)", epicsOutletNumber - this->numberOfOutlet); for (int i = this->numberOfOutlet; i < epicsOutletNumber; i++) { std::string epicsSetRecordName; { - static const std::string *str1 = &EPOWERSWITCH_SOCKET_SET_PREFIX; + static const std::string *str1 = &EPOWERSWITCH_OUTLET_SET_PREFIX; static const std::string str2 = ""; epicsSetRecordName = insert(str1, i, &str2); } @@ -167,7 +167,7 @@ void ePowerSwitchEquipment::updateSocketNumber() { std::string epicsGetRecordName; { - static const std::string *str1 = &EPOWERSWITCH_SOCKET_GET_PREFIX; + static const std::string *str1 = &EPOWERSWITCH_OUTLET_GET_PREFIX; static const std::string str2 = ""; epicsGetRecordName = insert(str1, i, &str2); } @@ -179,7 +179,7 @@ void ePowerSwitchEquipment::updateSocketNumber() { if (this->numberOfOutlet > epicsOutletNumber) fMfe->Msg(MDEBUG, __FUNCTION__, - "Socket number decreasing, destroying %d socket(s)", + "Outlet number decreasing, destroying %d outlet(s)", this->numberOfOutlet - epicsOutletNumber); for (int i = epicsOutletNumber; i < this->numberOfOutlet; i++) { @@ -187,7 +187,7 @@ void ePowerSwitchEquipment::updateSocketNumber() { std::string requestedVarname; std::string currentVarname; { - static const std::string str1 = "Socket "; + static const std::string str1 = "Outlet "; static const std::string str2a = " current"; static const std::string str2b = " requested"; requestedVarname = insert(&str1, i, &str2a); diff --git a/src/device/ePowerSwitchEquipment.h b/src/device/ePowerSwitchEquipment.h index 4ac8032..e514de2 100644 --- a/src/device/ePowerSwitchEquipment.h +++ b/src/device/ePowerSwitchEquipment.h @@ -25,26 +25,26 @@ class ePowerSwitchEquipment : public TMFeEquipment { private: std::vector>> outletSetRecords; std::vector>> outletGetRecords; - std::vector socketNames; + std::vector outletNames; mEpicsCa outletNumberRecord; int numberOfOutlet; /** - * @brief refresh information about the given socket ID + * @brief refresh information about the given outlet ID * - * @param socketId which socket to refresh + * @param outletId which outlet to refresh */ - void refreshSocket(int socketId); + void refreshOutlet(int outletId); /** - * @brief refresh information about all the available sockets + * @brief refresh information about all the available outlets */ - void refreshAllSockets(); + void refreshAllOutlets(); /** - * @brief detect and modify the current socket pool in case of change + * @brief detect and modify the current outlet pool in case of change */ - void updateSocketNumber(); + void updateOutletNumber(); }; #endif \ No newline at end of file diff --git a/src/device/ePowerSwitchEquipmentConfig.h b/src/device/ePowerSwitchEquipmentConfig.h index 663e6e1..e4e83f1 100644 --- a/src/device/ePowerSwitchEquipmentConfig.h +++ b/src/device/ePowerSwitchEquipmentConfig.h @@ -2,12 +2,12 @@ #define EPOWERSWITCH_CONFIG_H #include -const std::string EPOWERSWITCH_SOCKET_SET_PREFIX = "ePowerSwitch_set_outlet_"; -const std::string EPOWERSWITCH_SOCKET_GET_PREFIX = "ePowerSwitch_get_outlet_"; -const std::string EPOWERSWITCH_SOCKETNUMBER_INFO_PREFIX = +const std::string EPOWERSWITCH_OUTLET_SET_PREFIX = "ePowerSwitch_set_outlet_"; +const std::string EPOWERSWITCH_OUTLET_GET_PREFIX = "ePowerSwitch_get_outlet_"; +const std::string EPOWERSWITCH_OUTLETNUMBER_INFO_PREFIX = "ePowerSwitch_config_maxOutlet"; -const std::string EPOWERSWITCH_DEFAULT_SOCKET_NAME = "Socket"; -const std::string EPOWERSWITCH_DEFAULT_SOCKET_STATUS = "Off"; +const std::string EPOWERSWITCH_DEFAULT_OUTLET_NAME = "Outlet"; +const std::string EPOWERSWITCH_DEFAULT_OUTLET_STATUS = "Off"; #endif