void CMP_LIBRARY::SearchEntryNames( std::vector<wxArrayString>& aNames, const wxString& aNameSearch, const wxString& aKeySearch, bool aSort ) { LIB_ALIAS_MAP::iterator it; for( it = aliases.begin(); it!=aliases.end(); it++ ) { if( !aKeySearch.IsEmpty() && KeyWordOk( aKeySearch, (*it).second->GetKeyWords() ) ) { wxArrayString item; item.Add( (*it).first ); item.Add( GetLogicalName() ); aNames.push_back( item ); } if( !aNameSearch.IsEmpty() && WildCompareString( aNameSearch, (*it).second->GetName(), false ) ) { wxArrayString item; item.Add( (*it).first ); item.Add( GetLogicalName() ); aNames.push_back( item ); } } if( aSort ) std::sort( aNames.begin(), aNames.end(), sortFunction ); }
void CGXDLMSImageTransfer::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSVariant(m_ImageBlockSize).ToString()); values.push_back(CGXDLMSVariant(m_ImageTransferredBlocksStatus).ToString()); values.push_back(CGXDLMSVariant(m_ImageFirstNotTransferredBlockNumber).ToString()); values.push_back(CGXDLMSVariant(m_ImageTransferEnabled).ToString()); values.push_back(CGXDLMSVariant(m_ImageTransferStatus).ToString()); std::stringstream sb; sb << '['; bool empty = true; for(std::vector<CGXDLMSImageActivateInfo>::iterator it = m_ImageActivateInfo.begin(); it != m_ImageActivateInfo.end(); ++it) { if (!empty) { sb << ", "; } empty = false; std::string str = it->ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); }
int CGXDLMSRegister::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArgs& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { e.SetValue(m_Value); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 3) { e.GetValue().Clear(); e.GetValue().vt = DLMS_DATA_TYPE_STRUCTURE; e.GetValue().Arr.push_back(m_Scaler); e.GetValue().Arr.push_back(m_Unit); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
void CGXDLMSAutoAnswer::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSVariant(m_Mode).ToString()); std::stringstream sb; sb << '['; bool empty = true; for(std::vector<std::pair< CGXDateTime, CGXDateTime> >::iterator it = m_ListeningWindow.begin(); it != m_ListeningWindow.end(); ++it) { if (!empty) { sb << ", "; } empty = false; std::string str = it->first.ToString(); sb.write(str.c_str(), str.size()); sb << " "; str = it->second.ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); values.push_back(CGXDLMSVariant(m_Status).ToString()); values.push_back(CGXDLMSVariant(m_NumberOfCalls).ToString()); //Clean sb.str(std::string()); sb << m_NumberOfRingsInListeningWindow; sb << "/"; sb << m_NumberOfRingsOutListeningWindow; values.push_back(sb.str()); }
void CGXDLMSMBusClient::GetValues(vector<string>& values) { values.clear(); string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(m_MBusPortReference); std::stringstream sb; sb << '['; bool empty = true; for(vector<pair<string, string> >::iterator it = m_CaptureDefinition.begin(); it != m_CaptureDefinition.end(); ++it) { if (!empty) { sb << ", "; } empty = false; sb.write(it->first.c_str(), it->first.size()); sb << " "; sb.write(it->second.c_str(), it->second.size()); } sb << ']'; values.push_back(sb.str()); values.push_back(CGXDLMSVariant(m_CapturePeriod).ToString()); values.push_back(CGXDLMSVariant(m_PrimaryAddress).ToString()); values.push_back(CGXDLMSVariant(m_IdentificationNumber).ToString()); values.push_back(CGXDLMSVariant(m_ManufacturerID).ToString()); values.push_back(CGXDLMSVariant(m_DataHeaderVersion).ToString()); values.push_back(CGXDLMSVariant(m_DeviceType).ToString()); values.push_back(CGXDLMSVariant(m_AccessNumber).ToString()); values.push_back(CGXDLMSVariant(m_Status).ToString()); values.push_back(CGXDLMSVariant(m_Alarm).ToString()); }
// Returns value of given attribute. int CGXDLMSDisconnectControl::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { e.SetValue(m_OutputState); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 3) { e.SetValue(m_ControlState); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 4) { e.SetValue(m_ControlMode); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
// Returns value of given attribute. int CGXDLMSMessageHandler::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { //TODO: e.SetValue(m_ListeningWindow); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 3) { //TODO: e.SetValue(m_AllowedSenders); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 4) { //TODO: e.SetValue(m_SendersAndActions); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
void CGXDLMSDemandRegister::GetValues(vector<string>& values) { values.clear(); string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(m_CurrentAvarageValue.ToString()); values.push_back(m_LastAvarageValue.ToString()); string str = "Scaler: "; //if there is no fractal part. double s = GetScaler(); if (s - (long)s == 0) { str += CGXDLMSVariant((long)s).ToString(); } else { str += CGXDLMSVariant(s).ToString(); } str += " Unit: "; str += CGXDLMSConverter::GetUnitAsString(m_Unit); values.push_back(str); values.push_back(m_Status.ToString()); values.push_back(m_CaptureTime.ToString()); values.push_back(m_StartTimeCurrent.ToString()); values.push_back(CGXDLMSVariant(m_Period).ToString()); values.push_back(CGXDLMSVariant(m_NumberOfPeriods).ToString()); }
/* * Return a handle to the first logical volume on the disk identified by DriveIndex */ HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive) { HANDLE hLogical = INVALID_HANDLE_VALUE; char* LogicalPath = GetLogicalName(DriveIndex, FALSE); hLogical = GetHandle(LogicalPath, bWriteAccess, bLockDrive); safe_free(LogicalPath); return hLogical; }
void CGXDLMSData::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(m_Value.ToString()); }
void CGXDLMSMBusMasterPortSetup::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSConverter::ToString(m_CommSpeed)); }
// Returns value of given attribute. int CGXDLMSImageTransfer::GetValue(int index, int selector, CGXDLMSVariant& parameters, CGXDLMSVariant& value) { if (index == 1) { return GetLogicalName(this, value); } if (index == 2) { value = GetImageBlockSize(); return ERROR_CODES_OK; } if (index == 3) { value = m_ImageTransferredBlocksStatus; return ERROR_CODES_OK; } if (index == 4) { value = m_ImageFirstNotTransferredBlockNumber; return ERROR_CODES_OK; } if (index == 5) { value = m_ImageTransferEnabled; return ERROR_CODES_OK; } if (index == 6) { value = m_ImageTransferStatus; return ERROR_CODES_OK; } if (index == 7) { CGXByteBuffer data; data.SetUInt8(DLMS_DATA_TYPE_ARRAY); data.SetUInt8(m_ImageActivateInfo.size()); //Count int ret; CGXDLMSVariant size, id, signature; for (std::vector<CGXDLMSImageActivateInfo>::iterator it = m_ImageActivateInfo.begin(); it != m_ImageActivateInfo.end(); ++it) { data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE); data.SetUInt8(3);//Item count. size = it->GetSize(); id = it->GetIdentification(); signature = (*it).GetSignature(); if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT32, size)) != 0 || (ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, id)) != 0 || (ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, signature)) != 0) { return ret; } } value = data; } return ERROR_CODES_INVALID_PARAMETER; }
void CGXDLMSMessageHandler::GetValues(vector<string>& values) { values.clear(); string ln; GetLogicalName(ln); values.push_back(ln); std::stringstream sb; sb << '['; bool empty = true; for(vector<pair<CGXDateTime, CGXDateTime> >::iterator it = m_ListeningWindow.begin(); it != m_ListeningWindow.end(); ++it) { if (!empty) { sb << ", "; } empty = false; string str = it->first.ToString(); sb.write(str.c_str(), str.size()); sb << " "; str = it->second.ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); sb.str(std::string()); sb << '['; empty = true; for(vector<string>::iterator it = m_AllowedSenders.begin(); it != m_AllowedSenders.end(); ++it) { if (!empty) { sb << ", "; } empty = false; sb.write(it->c_str(), it->size()); } sb << ']'; values.push_back(sb.str()); sb.str(std::string()); sb << '['; empty = true; for(vector<std::pair<string, std::pair<int, CGXDLMSScriptAction> > >::iterator it = m_SendersAndActions.begin(); it != m_SendersAndActions.end(); ++it) { if (!empty) { sb << ", "; } empty = false; sb.write(it->first.c_str(), it->first.size()); } sb << ']'; values.push_back(sb.str()); }
void CGXDLMSGPRSSetup::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(m_APN); values.push_back(CGXDLMSVariant(m_PINCode).ToString()); values.push_back(m_DefaultQualityOfService.ToString() + " " + m_RequestedQualityOfService.ToString()); }
void CGXDLMSDisconnectControl::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSVariant(m_OutputState).ToString()); values.push_back(CGXDLMSConverter::ToString(m_ControlState)); values.push_back(CGXDLMSConverter::ToString(m_ControlMode)); }
void CGXDLMSMBusSlavePortSetup::GetValues(vector<string>& values) { values.clear(); string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSConverter::ToString(m_DefaultBaud)); values.push_back(CGXDLMSConverter::ToString(m_AvailableBaud)); values.push_back(CGXDLMSConverter::ToString(m_AddressState)); values.push_back(CGXDLMSVariant(m_BusAddress).ToString()); }
/* * Returns value of given attribute. */ int CGXDLMSProfileGeneric::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArgs& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { CGXByteBuffer tmp; tmp.Set(e.GetValue().byteArr, e.GetValue().size); int ret = GetProfileGenericData(e.GetSelector(), e.GetParameters(), tmp); e.SetValue(tmp); return ret; } if (e.GetIndex() == 3) { CGXByteBuffer data; int ret = GetColumns(data); e.SetValue(data); return ret; } if (e.GetIndex() == 4) { e.SetValue(GetCapturePeriod()); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 5) { e.SetValue(GetSortMethod()); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 5) { return DLMS_ERROR_CODE_INVALID_PARAMETER; } if (e.GetIndex() == 7) { e.SetValue(GetEntriesInUse()); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 8) { e.SetValue(GetProfileEntries()); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
void CGXDLMSTcpUdpSetup::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSVariant(m_Port).ToString()); values.push_back(m_IPReference); values.push_back(CGXDLMSVariant(m_MaximumSegmentSize).ToString()); values.push_back(CGXDLMSVariant(m_MaximumSimultaneousConnections).ToString()); values.push_back(CGXDLMSVariant(m_InactivityTimeout).ToString()); }
void CGXDLMSPppSetup::GetValues(vector<string>& values) { values.clear(); string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(m_PHYReference); std::stringstream sb; sb << '['; bool empty = true; for(vector<CGXDLMSPppSetupLcpOption>::iterator it = m_LCPOptions.begin(); it != m_LCPOptions.end(); ++it) { if (!empty) { sb << ", "; } empty = false; string str = it->ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); //Clear str. sb.str(std::string()); sb << '['; empty = true; for(vector<CGXDLMSPppSetupIPCPOption>::iterator it = m_IPCPOptions.begin(); it != m_IPCPOptions.end(); ++it) { if (!empty) { sb << ", "; } empty = false; string str = it->ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); string str; if (m_UserName.size() != 0) { str.append((char*) &m_UserName[0], m_UserName.size()); } if (m_Password.size() != 0) { str.append(" "); str.append((char*) &m_Password[0], m_Password.size()); } values.push_back(str); }
// Returns value of given attribute. int CGXDLMSIecHdlcSetup::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } else if (e.GetIndex() == 2) { e.SetValue(m_CommunicationSpeed); } else if (e.GetIndex() == 3) { e.SetValue(m_WindowSizeTransmit); } else if (e.GetIndex() == 4) { e.SetValue(m_WindowSizeReceive); } else if (e.GetIndex() == 5) { e.SetValue(m_MaximumInfoLengthTransmit); } else if (e.GetIndex() == 6) { e.SetValue(m_MaximumInfoLengthReceive); } else if (e.GetIndex() == 7) { e.SetValue(m_InterCharachterTimeout); } else if (e.GetIndex() == 8) { e.SetValue(m_InactivityTimeout); } else if (e.GetIndex() == 9) { e.SetValue(m_DeviceAddress); } else { return DLMS_ERROR_CODE_INVALID_PARAMETER; } return DLMS_ERROR_CODE_OK; }
/* * Obtain a handle to the first logical volume on the disk identified by DriveIndex * Returns INVALID_HANDLE_VALUE on error or NULL if no logical path exists (typical * of unpartitioned drives) */ HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive) { HANDLE hLogical = INVALID_HANDLE_VALUE; char* LogicalPath = GetLogicalName(DriveIndex, FALSE, FALSE); if (LogicalPath == NULL) { uprintf("No logical drive found (unpartitioned?)\n"); return NULL; } hLogical = GetHandle(LogicalPath, bWriteAccess, bLockDrive); free(LogicalPath); return hLogical; }
void CGXDLMSIecHdlcSetup::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSConverter::ToString(m_CommunicationSpeed)); values.push_back(CGXDLMSVariant(m_WindowSizeTransmit).ToString()); values.push_back(CGXDLMSVariant(m_WindowSizeReceive).ToString()); values.push_back(CGXDLMSVariant(m_MaximumInfoLengthTransmit).ToString()); values.push_back(CGXDLMSVariant(m_MaximumInfoLengthReceive).ToString()); values.push_back(CGXDLMSVariant(m_InterCharachterTimeout).ToString()); values.push_back(CGXDLMSVariant(m_InactivityTimeout).ToString()); values.push_back(CGXDLMSVariant(m_DeviceAddress).ToString()); }
void CGXDLMSProfileGeneric::GetValues(vector<string>& values) { values.clear(); string ln; GetLogicalName(ln); values.push_back(ln); std::stringstream sb; bool empty = true; for(vector< vector<CGXDLMSVariant> >::iterator row = m_Buffer.begin(); row != m_Buffer.end(); ++row) { for(vector<CGXDLMSVariant>::iterator cell = row->begin(); cell != row->end(); ++cell) { sb << cell->ToString(); sb << " | "; } sb << "\r\n"; } values.push_back(sb.str()); //Clear str. sb.str(std::string()); sb << '['; empty = true; for(vector<pair<CGXDLMSObject*, CGXDLMSCaptureObject*> >::iterator it = m_CaptureObjects.begin(); it != m_CaptureObjects.end(); ++it) { if (!empty) { sb << ", "; } empty = false; string str = it->first->GetName().ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); values.push_back(CGXDLMSVariant(m_CapturePeriod).ToString()); values.push_back(CGXDLMSVariant(m_SortMethod).ToString()); if (m_SortObject == NULL) { values.push_back(""); } else { values.push_back(m_SortObject->GetName().ToString()); } values.push_back(CGXDLMSVariant(m_EntriesInUse).ToString()); values.push_back(CGXDLMSVariant(m_ProfileEntries).ToString()); }
// Returns value of given attribute. int CGXDLMSTcpUdpSetup::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { CGXDLMSVariant tmp = GetPort(); e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 3) { CGXDLMSVariant tmp; GXHelpers::SetLogicalName(m_IPReference.c_str(), tmp); e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 4) { CGXDLMSVariant tmp = GetMaximumSegmentSize(); e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 5) { CGXDLMSVariant tmp = GetMaximumSimultaneousConnections(); e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 6) { CGXDLMSVariant tmp = GetInactivityTimeout(); e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
/* Wait for a logical drive to reappear - Used when a drive has just been repartitioned */ BOOL WaitForLogical(DWORD DriveIndex) { DWORD i; char* LogicalPath = NULL; for (i = 0; i < DRIVE_ACCESS_RETRIES; i++) { LogicalPath = GetLogicalName(DriveIndex, FALSE, TRUE); if (LogicalPath != NULL) { free(LogicalPath); return TRUE; } if (IS_ERROR(FormatStatus)) // User cancel return FALSE; Sleep(DRIVE_ACCESS_TIMEOUT/DRIVE_ACCESS_RETRIES); } uprintf("Timeout while waiting for logical drive\n"); return FALSE; }
// Returns value of given attribute. int CGXDLMSIecHdlcSetup::GetValue(int index, int selector, CGXDLMSVariant& parameters, CGXDLMSVariant& value) { if (index == 1) { return GetLogicalName(this, value); } else if (index == 2) { value = m_CommunicationSpeed; } else if (index == 3) { value = m_WindowSizeTransmit; } else if (index == 4) { value = m_WindowSizeReceive; } else if (index == 5) { value = m_MaximumInfoLengthTransmit; } else if (index == 6) { value = m_MaximumInfoLengthReceive; } else if (index == 7) { value = m_InterCharachterTimeout; } else if (index == 8) { value = m_InactivityTimeout; } else if (index == 9) { value = m_DeviceAddress; } else { return ERROR_CODES_INVALID_PARAMETER; } return ERROR_CODES_OK; }
void CGXDLMSAutoConnect::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); values.push_back(CGXDLMSVariant(m_Mode).ToString()); values.push_back(CGXDLMSVariant(m_Repetitions).ToString()); values.push_back(CGXDLMSVariant(m_RepetitionDelay).ToString()); std::stringstream sb; sb << '['; bool empty = true; for(std::vector<std::pair< CGXDateTime, CGXDateTime> >::iterator it = m_CallingWindow.begin(); it != m_CallingWindow.end(); ++it) { if (!empty) { sb << ", "; } empty = false; std::string str = it->first.ToString(); sb.write(str.c_str(), str.size()); sb << " "; str = it->second.ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); //Clear str. sb.str(std::string()); sb << '['; empty = true; for(std::vector< std::string >::iterator it = m_Destinations.begin(); it != m_Destinations.end(); ++it) { if (!empty) { sb << ", "; } empty = false; sb.write(it->c_str(), it->size()); } sb << ']'; values.push_back(sb.str()); }
void CGXDLMSLimiter::GetValues(std::vector<std::string>& values) { values.clear(); std::string ln; GetLogicalName(ln); values.push_back(ln); if (m_MonitoredValue != NULL) { values.push_back(m_MonitoredValue->GetName().ToString()); } else { values.push_back(""); } values.push_back(m_ThresholdActive.ToString()); values.push_back(m_ThresholdNormal.ToString()); values.push_back(m_ThresholdEmergency.ToString()); values.push_back(CGXDLMSVariant(m_MinOverThresholdDuration).ToString()); values.push_back(CGXDLMSVariant(m_MinUnderThresholdDuration).ToString()); values.push_back(m_EmergencyProfile.ToString()); std::stringstream sb; sb << '['; bool empty = true; for(std::vector<int>::iterator it = m_EmergencyProfileGroupIDs.begin(); it != m_EmergencyProfileGroupIDs.end(); ++it) { if (!empty) { sb << ", "; } empty = false; std::string str = CGXDLMSVariant(*it).ToString(); sb.write(str.c_str(), str.size()); } sb << ']'; values.push_back(sb.str()); values.push_back(CGXDLMSVariant(m_EmergencyProfileActive).ToString()); sb.str(std::string()); sb << m_ActionOverThreshold.ToString().c_str(); sb << ", "; sb << m_ActionUnderThreshold.ToString().c_str(); values.push_back(sb.str()); }
// Returns value of given attribute. int CGXDLMSMBusMasterPortSetup::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArgs& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { e.SetValue(m_CommSpeed); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }
// Returns value of given attribute. int CGXDLMSSpecialDaysTable::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e) { if (e.GetIndex() == 1) { int ret; CGXDLMSVariant tmp; if ((ret = GetLogicalName(this, tmp)) != 0) { return ret; } e.SetValue(tmp); return DLMS_ERROR_CODE_OK; } if (e.GetIndex() == 2) { e.SetByteArray(true); CGXByteBuffer data; data.SetUInt8(DLMS_DATA_TYPE_ARRAY); //Add count GXHelpers::SetObjectCount((unsigned long)m_Entries.size(), data); int ret; CGXDLMSVariant index, date, id; for (std::vector<CGXDLMSSpecialDay*>::iterator it = m_Entries.begin(); it != m_Entries.end(); ++it) { data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE); data.SetUInt8(3); //Count index = (*it)->GetIndex(); date = (*it)->GetDate(); id = (*it)->GetDayId(); if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT16, index)) != DLMS_ERROR_CODE_OK || (ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, date)) != DLMS_ERROR_CODE_OK || (ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT8, id)) != DLMS_ERROR_CODE_OK) { return ret; } } e.SetValue(data); return DLMS_ERROR_CODE_OK; } return DLMS_ERROR_CODE_INVALID_PARAMETER; }