本文整理汇总了C++中CIniParser::FindGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ CIniParser::FindGroup方法的具体用法?C++ CIniParser::FindGroup怎么用?C++ CIniParser::FindGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIniParser
的用法示例。
在下文中一共展示了CIniParser::FindGroup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteCmdFinalAssemblyNumber
// write Command Final Assembly Number to config_universal.ini file
bool GatewayConfig::WriteCmdFinalAssemblyNumber(uint32_t finalAssemblyNumber)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
{
LOG("------- NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
else
{
int finAssemblyNumber;
finAssemblyNumber = (int) finalAssemblyNumber;
if (!gwVarConfig.SetVar("WH_GATEWAY", "FINAL_ASSEMBLY_NUMBER", finAssemblyNumber))
return 0;
}
return 1;
}
示例2: LoadNextMAC
int PublisherConf::LoadNextMAC(CIniParser& parser /*[in]*/, hart7::hostapp::MAC& mac/*[in/out]*/)
{
const char *pgroup = NULL;
LOG_INFO_APP( "[LoadPublishers]: loading next mac...");
if (!(pgroup = parser.FindGroup(NULL, true, true, true)))
{
LOG_WARN_APP( "[LoadPublishers]: no mac found");
return -1;
}
if (pgroup[hart7::hostapp::MAC::TEXT_SIZE] != '\0')
{
LOG_ERROR_APP( "[LoadPublishers]: read mac has not the proper format.");
return -1;
}
std::string strMac = pgroup;
LOG_INFO_APP("[LoadPublishers]: mac=" << strMac << " read from conf." );
try
{
mac = hart7::hostapp::MAC(strMac);
}
catch (...)
{
return -1;
}
return 0;
}
示例3: WriteGwReqMaxRetryNo
bool GatewayConfig::WriteGwReqMaxRetryNo(uint8_t p_u8RetryNo)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_CONFIGINI, "r+"))
{
LOG("------- NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
if (!gwVarConfig.SetVar("WH_GATEWAY", "GW_REQ_MAX_RETRY_NO", p_u8RetryNo, 0, true))
{
return 0;
}
return 1;
}
示例4: WriteCmdUniversalMessage
bool GatewayConfig::WriteCmdUniversalMessage(char * universalmessage)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
{
LOG("------- NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
if (!gwVarConfig.SetVar("WH_GATEWAY", "CMD_UNIVERSAL_MESSAGE", universalmessage))
{
return 0;
}
return 1;
}
示例5: WriteMinRespPreamblesNo
bool GatewayConfig::WriteMinRespPreamblesNo(uint8_t p_u8MinRespPreamblesNo)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
{
LOG("------- NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
int minRespPreamblesNo = p_u8MinRespPreamblesNo;
if (!gwVarConfig.SetVar("WH_GATEWAY", "MIN_RESP_PREAMBLES_NO", minRespPreamblesNo))
{
return 0;
}
return 1;
}
示例6: WriteCmdMasterDescriptor
bool GatewayConfig::WriteCmdMasterDescriptor(char * masterDescriptor)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
{
LOG("------- NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
else
{
if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DESCRIPTOR", masterDescriptor))
return 0;
}
return 1;
}
示例7: WriteCmdTag
bool GatewayConfig::WriteCmdTag(char * tag)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
{
LOG("-------NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
else
{
if (!gwVarConfig.SetVar("WH_GATEWAY", "TAG", tag))
return 0;
}
return 1;
}
示例8: WriteCmdMasterDate
bool GatewayConfig::WriteCmdMasterDate(WHartDate masterDate)
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
{
LOG("-------NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
else
{
int date_day;
int date_month;
int date_year;
date_day = (int) masterDate.day;
date_month = (int) masterDate.month;
date_year = (int) masterDate.year;
if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DATE_DAY", date_day))
return 0;
if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DATE_MONTH", date_month))
return 0;
if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DATE_YEAR", date_year))
return 0;
}
return 1;
}
示例9: ReadGWUniversalVariables
bool GatewayConfig::ReadGWUniversalVariables()
{
CIniParser gwVarConfig;
if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV))
{
LOG("------- NO CONFIG.INI FILE -------");
return 0;
}
if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
{
return 0;
}
// variables for C000
int min_req_preambles_no;
if (!(gwVarConfig.GetVar("WH_GATEWAY", "MIN_REQ_PREAMBLES_NO", &min_req_preambles_no)))
min_req_preambles_no = 0; // default value
m_u8MinReqPreamblesNo = (uint8_t) min_req_preambles_no;
int device_revision_level;
if (!gwVarConfig.GetVar("WH_GATEWAY", "DEVICE_REVISION_LEVEL", &device_revision_level))
device_revision_level = 0; // default value
m_u8DevRevisionLevel = (uint8_t) device_revision_level;
int sw_revision_no;
if (!gwVarConfig.GetVar("WH_GATEWAY", "SOFTWARE_REVISION_LEVEL", &sw_revision_no))
sw_revision_no = 0; // default value
m_u8SoftwRevisionLevel = (uint8_t) sw_revision_no;
int hwRevisionLevel_physicalSignalingMode;
if (!gwVarConfig.GetVar("WH_GATEWAY", "HWREVLEVEL_PHYSIGNALMODE", &hwRevisionLevel_physicalSignalingMode))
hwRevisionLevel_physicalSignalingMode = 0; // default value
m_u8HWRevisionLevel_PhysicalSignCode = (uint8_t) hwRevisionLevel_physicalSignalingMode;
if (!(gwVarConfig.GetVar("WH_GATEWAY", "FLAGS", &m_u8Flags, 1) == 1))
m_u8HWRevisionLevel_PhysicalSignCode = 0; // default value
int min_resp_preambles_no;
if (!(gwVarConfig.GetVar("WH_GATEWAY", "MIN_RESP_PREAMBLES_NO", &min_resp_preambles_no)))
min_resp_preambles_no = 0; // default value
m_u8MinRespPreamblesNo = (uint8_t) min_resp_preambles_no;
int max_no_of_devices_var;
if (!(gwVarConfig.GetVar("WH_GATEWAY", "MAX_NO_OF_DEVICES_VARS", &max_no_of_devices_var)))
max_no_of_devices_var = 0; // default value
m_u8MaxNoOfDevicesVar = (uint8_t) max_no_of_devices_var;
int configChangeCounter;
if (!(gwVarConfig.GetVar("WH_GATEWAY", "CHANGE_COUNTER", &configChangeCounter)))
configChangeCounter = 0; // default value
m_u16ConfigChangeCounter = (uint16_t) configChangeCounter;
int field_device_status;
if (!gwVarConfig.GetVar("WH_GATEWAY", "EXTENDED_STATUS", &field_device_status))
field_device_status = 0; // default value
m_u8FlagBits = (uint8_t) field_device_status;
if (!(gwVarConfig.GetVar("WH_GATEWAY", "MANUFACT_ID_CODE", m_u8ManufactCode, sizeof(m_u8ManufactCode))
== sizeof(m_u8ManufactCode)))
memset(m_u8ManufactCode, 0, sizeof(m_u8ManufactCode)); // default value
if (!(gwVarConfig.GetVar("WH_GATEWAY", "PRIVATE_LABEL_CODE", m_u8ManufactLabel, sizeof(m_u8ManufactLabel))
== sizeof(m_u8ManufactLabel)))
memset(m_u8ManufactLabel, 0, sizeof(m_u8ManufactLabel)); // default value
// end of variables for C000
// variables for C020 and C022
char long_tag[33];
if (!(gwVarConfig.GetVar("WH_GATEWAY", "LONG_TAG", long_tag, sizeof(long_tag)) > 0))
memset(long_tag, 0, sizeof(long_tag)); //default value
memcpy(m_szLongTag, long_tag, sizeof(m_szLongTag));
// variables for C016 and C019
int finalAssemblyNumber;
if (!gwVarConfig.GetVar("WH_GATEWAY", "FINAL_ASSEMBLY_NUMBER", &finalAssemblyNumber))
finalAssemblyNumber = 0; //default value
memcpy(&m_u32FinalAssemblyNumber, &finalAssemblyNumber, sizeof(m_u32FinalAssemblyNumber));
// variables for commands 013 and 018
char tag[9];
if (!(gwVarConfig.GetVar("WH_GATEWAY", "TAG", tag, sizeof(tag)) > 0))
memset(tag, 0, sizeof(tag));
memcpy(m_szTag, tag, sizeof(m_szTag));
if (!(gwVarConfig.GetVar("WH_GATEWAY", "MASTER_DESCRIPTOR", m_szMasterDescriptor, sizeof(m_szMasterDescriptor)) > 0))
memset(m_szMasterDescriptor, 0, sizeof(m_szMasterDescriptor)); // default value
int master_date_day;
int master_date_month;
int master_date_year;
if (!gwVarConfig.GetVar("WH_GATEWAY", "MASTER_DATE_DAY", &master_date_day))
master_date_day = 0; // default value
//.........这里部分代码省略.........