removing hardcoded values
This commit is contained in:
@@ -4,4 +4,7 @@
|
||||
#define EPOWERSWITCH_SOCKET_COMMAND_PREFIX "ePowerSwitch_command_outlet_"
|
||||
#define EPOWERSWITCH_SOCKETNUMBER_INFO_PREFIX "ePowerSwitch_config_maxOutlet"
|
||||
|
||||
#define DEFAULT_FRONTEND_NAME "ePowerSwitch"
|
||||
#define DEFAULT_EQUIPMENT_NAME "powerswitch"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include <sstream>
|
||||
|
||||
/**
|
||||
* @brief local function, append an integer at the end of a string
|
||||
* @param str string prfix
|
||||
* @brief local function: append an integer to the end of a string.
|
||||
* @param str string prefix
|
||||
* @param value integer to append
|
||||
* @return "str" + integer
|
||||
*/
|
||||
@@ -22,17 +22,30 @@ 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");
|
||||
"Relative paths are strongly not recommended; "
|
||||
"please use an absolute path");
|
||||
}
|
||||
|
||||
std::string frontendName = "ePowerSwitch";
|
||||
std::string equipmentName = "powerswitch";
|
||||
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]);
|
||||
@@ -71,7 +84,6 @@ void ePowerSwitchEquipment::refreshSocket(int socketId) {
|
||||
|
||||
if (midasSocketState != this->outletLastState.at(socketId)) {
|
||||
this->outletCommandRecords.at(socketId)->put(&midasSocketState);
|
||||
printf("send command : %d\n", midasSocketState);
|
||||
}
|
||||
|
||||
this->outletLastState.at(socketId) = midasSocketState;
|
||||
|
||||
Reference in New Issue
Block a user