This commit is contained in:
2026-04-28 09:21:14 +02:00
parent 4d809d11e0
commit 6b209181e5
2 changed files with 17 additions and 9 deletions
+16 -9
View File
@@ -1,5 +1,5 @@
#include "ePowerSwitchFront.h"
#include "ePowerSwitchConfig.h"
#include "../include/ePowerSwitchFront.h"
#include "../include/ePowerSwitchConfig.h"
#include "m_epics_ca.h"
#include "tmfe.h"
#include <format>
@@ -19,29 +19,36 @@ std::string format(std::string str, int value) {
}
int main(int argc, char *argv[]) {
if (argv[0][0] == '.') {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Relative path are strongly not recommended, "
"please use an absolut path");
}
std::string frontendName = "ePowerSwitch";
std::string equipmentName = "powerswitch";
if (argc == 1) {
if (argc == 2) {
frontendName = std::string(argv[1]);
argv++;
argc--;
} else if (argc == 2) {
} else if (argc == 3) {
frontendName = std::string(argv[1]);
equipmentName = std::string(argv[2]);
argv += 2;
argc -= 2;
}
auto front = new ePowerSwitchFrontend(frontendName.c_str());
auto front = new ePowerSwitchFrontend(frontendName, equipmentName);
front->FeMain(argc, argv);
}
ePowerSwitchEquipment::ePowerSwitchEquipment(std::string equipmentName,
const char *equipmentFileName)
: TMFeEquipment(equipmentName, equipmentFileName),
outletNumberRecord(
mEpicsCa<int>(EPOWERSWITCH_SOCKETNUMBER_INFO_PREFIX, true)) {
: TMFeEquipment(equipmentName.c_str(), equipmentFileName),
outletNumberRecord(mEpicsCa<int>(
std::string_view(EPOWERSWITCH_SOCKETNUMBER_INFO_PREFIX), true)) {
fEqConfReadConfigFromOdb = false;
fEqConfPeriodMilliSec = 1000;
fEqConfLogHistory = 1;
@@ -113,6 +120,6 @@ void ePowerSwitchEquipment::updateSocketNumber() {
ePowerSwitchFrontend::ePowerSwitchFrontend(std::string frontendName,
std::string equipmentName) {
FeSetName(frontname.c_str());
FeSetName(frontendName.c_str());
FeAddEquipment(new ePowerSwitchEquipment(equipmentName.c_str(), __FILE__));
}