// 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; }
/////////////////////////////////////////////////////////////////////////////////////////////////// /// SenderPipeline::RemoveDestination() /// /// Remove a destination address or hostname to the sender's pipeline. /////////////////////////////////////////////////////////////////////////////////////////////////// void SenderPipeline::RemoveDestination(const char* destination) { std::vector<const std::string*>::const_iterator it = m_vDestinations.begin(); while (it != m_vDestinations.end()) { if ((*it)->compare(destination) == 0) { m_vDestinations.erase(it); } else { ++it; } } SetDestinations(); }
/////////////////////////////////////////////////////////////////////////////////////////////////// /// SenderPipeline::AddDestination() /// /// Add a destination address or hostname to the sender's pipeline. /////////////////////////////////////////////////////////////////////////////////////////////////// void SenderPipeline::AddDestination(const char* destination) { m_vDestinations.push_back(new std::string(destination)); SetDestinations(); }