Files
ePowerSwitch/src/frontend/ePowerSwitchFrontend.cpp
T

49 lines
1.7 KiB
C++

#include "ePowerSwitchFrontend.h"
#include "../device/ePowerSwitchEquipment.h"
#include "ePowerSwitchFrontendConfig.h"
#include "tmfe.h"
int main(int argc, char *argv[]) {
if (argv[0][0] == '.') {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Relative paths are strongly discouraged; "
"please use an absolute path.");
}
std::string frontendName;
std::string equipmentName;
if (argc == 1) {
frontendName = DEFAULT_FRONTEND_NAME;
TMFE::Instance()->Msg(MINFO, __FUNCTION__,
"No frontend name provided; %s will be used",
DEFAULT_FRONTEND_NAME);
equipmentName = DEFAULT_EQUIPMENT_NAME;
TMFE::Instance()->Msg(MINFO, __FUNCTION__,
"No equipment name provided; %s will be used",
DEFAULT_EQUIPMENT_NAME);
}
if (argc == 2) {
frontendName = std::string(argv[1]);
argv++;
argc--;
TMFE::Instance()->Msg(MINFO, __FUNCTION__,
"No equipment name provided; %s will be use",
DEFAULT_EQUIPMENT_NAME);
} else if (argc == 3) {
frontendName = std::string(argv[1]);
equipmentName = std::string(argv[2]);
argv += 2;
argc -= 2;
}
auto front = ePowerSwitchFrontend(frontendName, equipmentName);
front.FeMain(argc, argv);
}
ePowerSwitchFrontend::ePowerSwitchFrontend(std::string frontendName,
std::string equipmentName) {
FeSetName(frontendName.c_str());
FeAddEquipment(new ePowerSwitchEquipment(equipmentName.c_str(), __FILE__));
}