|
|
@ -23,23 +23,43 @@ static string projectType2Str(int val) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// /etc/hostname
|
|
|
|
static string readHostname() { |
|
|
|
string hostname; |
|
|
|
ifstream file("/etc/hostname"); |
|
|
|
if (file.is_open()) { |
|
|
|
getline(file, hostname); |
|
|
|
file.close(); |
|
|
|
} |
|
|
|
return hostname; |
|
|
|
} |
|
|
|
|
|
|
|
void ProjectPort::initialize() { |
|
|
|
GET_TO_SERVICE(gConfig); |
|
|
|
if (gConfig->get_projectType() == PROJECT_LARGE_SPACE_DM) { |
|
|
|
|
|
|
|
string projectTypeName = gConfig->get_projectType(); |
|
|
|
if (projectTypeName.empty()) { |
|
|
|
projectTypeName = readHostname(); |
|
|
|
} |
|
|
|
|
|
|
|
if (projectTypeName == PROJECT_LARGE_SPACE_DM) { |
|
|
|
initProjectSetting(klarge_space_disinfection_machine); |
|
|
|
} else if (gConfig->get_projectType() == PROJECT_SMALL_SPACE_DM) { |
|
|
|
} else if (projectTypeName == PROJECT_SMALL_SPACE_DM) { |
|
|
|
initProjectSetting(ksmall_space_disinfection_machine); |
|
|
|
} else if (gConfig->get_projectType() == PROJECT_PIPE_DM) { |
|
|
|
} else if (projectTypeName == PROJECT_PIPE_DM) { |
|
|
|
initProjectSetting(kpipe_disinfection_machine); |
|
|
|
} else if (gConfig->get_projectType() == PROJECT_DRAW_BAR_DM) { |
|
|
|
} else if (projectTypeName == PROJECT_DRAW_BAR_DM) { |
|
|
|
initProjectSetting(kdraw_bar_disinfection_box); |
|
|
|
} else { |
|
|
|
// THROW_APP_EXCEPTION(err::kappe_code_error, "ProjectPort::initialize: projectType not found");
|
|
|
|
logger->error("project type not support:{}", gConfig->get_projectType()); |
|
|
|
logger->error("project type not support:{}", projectTypeName); |
|
|
|
exit(-1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ProjectPort::getProjType() { return projectTypeInt; } |
|
|
|
string ProjectPort::getProjTypeString() { return projectType; } |
|
|
|
|
|
|
|
void ProjectPort::initProjectSetting(int projectTypeInt) { |
|
|
|
projectTypeInt = projectTypeInt; |
|
|
|
projectType = projectType2Str(projectTypeInt); |
|
|
|