void CSMMRepeater::XMLParameters(TiXmlNode *node) { if(node->FirstChild("Repeats")) SetRepetitions(ToUInt(node->FirstChild("Repeats")->FirstChild("Bagging")),ToUInt(node->FirstChild("Repeats")->FirstChild("CrossValidation"))); if(node->FirstChild("LambdaRange")) SetLambdaRange(ToDouble(node->FirstChild("LambdaRange")->FirstChild("Min")),ToDouble(node->FirstChild("LambdaRange")->FirstChild("Start")),ToDouble(node->FirstChild("LambdaRange")->FirstChild("Max"))); if(node->FirstChild("Precission")) SetPrecission(ToDouble(node->FirstChild("Precission"))); if(node->FirstChild("LogDetail")) { string detail=node->FirstChild("LogDetail")->Value(); if(detail=="None") clog_detail.push_back(NONE); else if(detail=="Minimal") clog_detail.push_back(MINIMAL); else if(detail=="Medium") clog_detail.push_back(MEDIUM); else if(detail=="Detailed") clog_detail.push_back(DETAILED); else if(detail=="All") clog_detail.push_back(ALL); } if(node->FirstChild("SeedRandomizer")) m_srand=ToUInt(node->FirstChild("SeedRandomizer")); if(node->FirstChild("MaxNormIterations")) SetMaxNormIterations(ToUInt(node->FirstChild("MaxNormIterations"))); }
// Set value of given attribute. int CGXDLMSAutoConnect::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e) { if (e.GetIndex() == 1) { return SetLogicalName(this, e.GetValue()); } else if (e.GetIndex() == 2) { SetMode((AUTO_CONNECT_MODE) e.GetValue().ToInteger()); return DLMS_ERROR_CODE_OK; } else if (e.GetIndex() == 3) { SetRepetitions(e.GetValue().lVal); return DLMS_ERROR_CODE_OK; } else if (e.GetIndex() == 4) { SetRepetitionDelay(e.GetValue().lVal); return DLMS_ERROR_CODE_OK; } else if (e.GetIndex() == 5) { m_CallingWindow.clear(); for (std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item) { CGXDLMSVariant tmp; CGXDLMSClient::ChangeType(item->Arr[0], DLMS_DATA_TYPE_DATETIME, tmp); CGXDateTime start = tmp.dateTime; CGXDLMSClient::ChangeType(item->Arr[1], DLMS_DATA_TYPE_DATETIME, tmp); CGXDateTime end = tmp.dateTime; m_CallingWindow.push_back(std::make_pair(start, end)); } return DLMS_ERROR_CODE_OK; } else if (e.GetIndex() == 6) { m_Destinations.clear(); std::vector< std::string > items; for (std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item) { CGXDLMSVariant value; CGXDLMSClient::ChangeType(*item, DLMS_DATA_TYPE_STRING, value); items.push_back(e.GetValue().ToString()); } SetDestinations(items); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
CSMMRepeater::CSMMRepeater(void) { SetRepetitions(); SetInitRand(); }