本文整理汇总了C++中CGXDLMSVariant::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ CGXDLMSVariant::ToString方法的具体用法?C++ CGXDLMSVariant::ToString怎么用?C++ CGXDLMSVariant::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGXDLMSVariant
的用法示例。
在下文中一共展示了CGXDLMSVariant::ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValue
// Set value of given attribute.
int CGXDLMSModemConfiguration::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
m_CommunicationSpeed = (BAUDRATE) value.bVal;
return ERROR_CODES_OK;
}
else if (index == 3)
{
m_InitialisationStrings.clear();
int ret;
for (vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSModemInitialisation item;
CGXDLMSVariant tmp;
if((ret = CGXDLMSClient::ChangeType(it->Arr[0].byteArr, DLMS_DATA_TYPE_STRING, tmp)) != ERROR_CODES_OK)
{
return ret;
}
item.SetRequest(tmp.ToString());
if((ret = CGXDLMSClient::ChangeType(it->Arr[1].byteArr, DLMS_DATA_TYPE_STRING, tmp)) != ERROR_CODES_OK)
{
return ret;
}
item.SetResponse(tmp.ToString());
if (it->Arr.size() > 2)
{
item.SetDelay(it->Arr[2].uiVal);
}
m_InitialisationStrings.push_back(item);
}
return ERROR_CODES_OK;
}
else if (index == 4)
{
m_ModemProfile.clear();
int ret;
for (vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSVariant tmp;
if((ret = CGXDLMSClient::ChangeType(it->byteArr, DLMS_DATA_TYPE_STRING, tmp)) != ERROR_CODES_OK)
{
return ret;
}
m_ModemProfile.push_back(tmp.ToString());
}
return ERROR_CODES_OK;
}
return ERROR_CODES_INVALID_PARAMETER;
}
示例2: SetValue
// Set value of given attribute.
int CGXDLMSImageTransfer::SetValue(CGXDLMSSettings* settings, int index, CGXDLMSVariant& value)
{
if (index == 1)
{
return SetLogicalName(this, value);
}
else if (index == 2)
{
m_ImageBlockSize = value.ToInteger();
}
else if (index == 3)
{
m_ImageTransferredBlocksStatus = value.ToString();
}
else if (index == 4)
{
m_ImageFirstNotTransferredBlockNumber = value.ToInteger();
}
else if (index == 5)
{
m_ImageTransferEnabled = value.boolVal;
}
else if (index == 6)
{
m_ImageTransferStatus = (IMAGE_TRANSFER_STATUS) value.ToInteger();
}
else if (index == 7)
{
m_ImageActivateInfo.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
CGXDLMSVariant tmp;
for (std::vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSImageActivateInfo item;
item.SetSize((*it).Arr[0].ToInteger());
CGXDLMSClient::ChangeType((*it).Arr[1], DLMS_DATA_TYPE_STRING, tmp);
item.SetIdentification(tmp.ToString());
CGXDLMSClient::ChangeType((*it).Arr[2], DLMS_DATA_TYPE_STRING, tmp);
item.SetSignature(tmp.ToString());
m_ImageActivateInfo.push_back(item);
}
}
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例3: SetValue
// Set value of given attribute.
int CGXDLMSGPRSSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
if (value.vt == DLMS_DATA_TYPE_STRING)
{
m_APN = value.ToString();
}
else
{
CGXDLMSVariant tmp;
int ret;
if ((ret = CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_STRING, tmp)) != 0)
{
return ret;
}
m_APN = tmp.strVal;
}
value = m_APN;
}
else if (index == 3)
{
m_PINCode = value.uiVal;
}
else if (index == 4)
{
m_DefaultQualityOfService.SetPrecedence(value.Arr[0].Arr[0].iVal);
m_DefaultQualityOfService.SetDelay(value.Arr[0].Arr[1].iVal);
m_DefaultQualityOfService.SetReliability(value.Arr[0].Arr[2].iVal);
m_DefaultQualityOfService.SetPeakThroughput(value.Arr[0].Arr[3].iVal);
m_DefaultQualityOfService.SetMeanThroughput(value.Arr[0].Arr[4].iVal);
m_RequestedQualityOfService.SetPrecedence(value.Arr[1].Arr[0].iVal);
m_RequestedQualityOfService.SetDelay(value.Arr[1].Arr[1].iVal);
m_RequestedQualityOfService.SetReliability(value.Arr[1].Arr[2].iVal);
m_RequestedQualityOfService.SetPeakThroughput(value.Arr[1].Arr[3].iVal);
m_RequestedQualityOfService.SetMeanThroughput(value.Arr[1].Arr[4].iVal);
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例4: SetValue
int CGXDLMSAssociationLogicalName::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_ObjectList.clear();
if (value.vt != DLMS_DATA_TYPE_NONE)
{
for (std::vector<CGXDLMSVariant >::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
OBJECT_TYPE type = (OBJECT_TYPE) (*it).Arr[0].ToInteger();
int version = (*it).Arr[1].ToInteger();
string ln;
CGXOBISTemplate::GetLogicalName(&(*it).Arr[2].byteArr[0], ln);
CGXDLMSObject* pObj = GetParent()->FindByLN(type, ln);
if (pObj == NULL)
{
pObj = CGXDLMSObjectFactory::CreateObject(type);
pObj->SetLogicalName(ln);
pObj->SetVersion(version);
}
UpdateAccessRights(pObj, (*it).Arr[3]);
m_ObjectList.push_back(pObj);
}
}
}
else if (index == 3)
{
m_AssociatedPartnersId = value;
}
else if (index == 4)
{
m_ApplicationContextName = value;
}
else if (index == 5)
{
m_XDLMSContextInfo = value;
}
else if (index == 6)
{
m_AuthenticationMechanismMame = value;
}
else if (index == 7)
{
m_Secret = value;
}
else if (index == 8)
{
m_AssociationStatus = (GX_ASSOCIATION_STATUS) value.ToInteger();
}
else if (index == 9)
{
m_SecuritySetupReference = value.ToString();
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例5: GetProfileGenerics
int CGXCommunication::GetProfileGenerics()
{
char buff[200];
int ret = 0;
std::string str;
std::string value;
//Find profile generics and read them.
CGXDLMSObjectCollection pgs;
m_Parser->GetObjects().GetObjects(DLMS_OBJECT_TYPE_PROFILE_GENERIC, pgs);
for (std::vector<CGXDLMSObject*>::iterator it = pgs.begin(); it != pgs.end(); ++it)
{
#if _MSC_VER > 1000
sprintf_s(buff, 200, "-------- Reading %s %s %s\r\n", CGXDLMSClient::ObjectTypeToString((*it)->GetObjectType()).c_str(), (*it)->GetName().ToString().c_str(), (*it)->GetDescription().c_str());
#else
sprintf(buff, "-------- Reading %s %s %s\r\n", CGXDLMSClient::ObjectTypeToString((*it)->GetObjectType()).c_str(), (*it)->GetName().ToString().c_str(), (*it)->GetDescription().c_str());
#endif
WriteValue(m_Trace, buff);
if ((ret = Read(*it, 7, value)) != DLMS_ERROR_CODE_OK)
{
#if _MSC_VER > 1000
sprintf_s(buff, 100, "Error! Index: %d: %s\r\n", 7, CGXDLMSConverter::GetErrorMessage(ret));
#else
sprintf(buff, "Error! Index: %d: %s\r\n", 7, CGXDLMSConverter::GetErrorMessage(ret));
#endif
WriteValue(GX_TRACE_LEVEL_ERROR, buff);
//Continue reading.
}
std::string entriesInUse = value;
if ((ret = Read(*it, 8, value)) != DLMS_ERROR_CODE_OK)
{
#if _MSC_VER > 1000
sprintf_s(buff, 100, "Error! Index: %d: %s\r\n", 8, CGXDLMSConverter::GetErrorMessage(ret));
#else
sprintf(buff, "Error! Index: %d: %s\r\n", 8, CGXDLMSConverter::GetErrorMessage(ret));
#endif
WriteValue(GX_TRACE_LEVEL_ERROR, buff);
//Continue reading.
}
std::string entries = value;
str = "Entries: ";
str += entriesInUse;
str += "/";
str += entries;
str += "\r\n";
WriteValue(m_Trace, str);
//If there are no columns or rows.
if (((CGXDLMSProfileGeneric*)*it)->GetEntriesInUse() == 0 || ((CGXDLMSProfileGeneric*)*it)->GetCaptureObjects().size() == 0)
{
continue;
}
//All meters are not supporting parameterized read.
CGXDLMSVariant rows;
if ((m_Parser->GetNegotiatedConformance() & (DLMS_CONFORMANCE_PARAMETERIZED_ACCESS | DLMS_CONFORMANCE_SELECTIVE_ACCESS)) != 0)
{
//Read first row from Profile Generic.
if ((ret = ReadRowsByEntry((CGXDLMSProfileGeneric*)*it, 1, 1, rows)) != 0)
{
str = "Error! Failed to read first row:";
str += CGXDLMSConverter::GetErrorMessage(ret);
str += "\r\n";
WriteValue(GX_TRACE_LEVEL_ERROR, str);
//Continue reading.
}
else
{
//////////////////////////////////////////////////////////////////////////////
//Show rows.
WriteValue(m_Trace, rows.ToString());
}
}
//All meters are not supporting parameterized read.
if ((m_Parser->GetNegotiatedConformance() & (DLMS_CONFORMANCE_PARAMETERIZED_ACCESS | DLMS_CONFORMANCE_SELECTIVE_ACCESS)) != 0)
{
CGXDateTime start = CGXDateTime::Now();
start.ResetTime();
CGXDateTime end = CGXDateTime::Now();
if ((ret = ReadRowsByRange((CGXDLMSProfileGeneric*)(*it), start, end, rows)) != 0)
{
str = "Error! Failed to read last day:";
str += CGXDLMSConverter::GetErrorMessage(ret);
str += "\r\n";
WriteValue(GX_TRACE_LEVEL_ERROR, str);
//Continue reading.
}
else
{
//////////////////////////////////////////////////////////////////////////////
//Show rows.
WriteValue(m_Trace, rows.ToString());
}
}
}
return ret;
}
示例6: SetValue
// Set value of given attribute.
int CGXDLMSPppSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
if (value.vt == DLMS_DATA_TYPE_STRING)
{
m_PHYReference = value.ToString();
}
else
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_OCTET_STRING, tmp);
m_PHYReference = tmp.ToString();
}
}
else if (index == 3)
{
m_LCPOptions.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for(vector<CGXDLMSVariant>::iterator item = value.Arr.begin(); item != value.Arr.end(); ++item)
{
CGXDLMSPppSetupLcpOption it;
it.SetType((*item).Arr[0].ToInteger());
it.SetLength((*item).Arr[1].ToInteger());
it.SetData((*item).Arr[2]);
m_LCPOptions.push_back(it);
}
}
}
else if (index == 4)
{
m_IPCPOptions.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for(vector<CGXDLMSVariant>::iterator item = value.Arr.begin(); item != value.Arr.end(); ++item)
{
CGXDLMSPppSetupIPCPOption it;
it.SetType((PPP_SETUP_IPCP_OPTION_TYPE)(*item).Arr[0].ToInteger());
it.SetLength((*item).Arr[1].ToInteger());
it.SetData((*item).Arr[2]);
m_IPCPOptions.push_back(it);
}
}
}
else if (index == 5)
{
m_UserName = value.Arr[0].byteArr;
m_Password = value.Arr[1].byteArr;
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例7: SetValue
// Set value of given attribute.
int CGXDLMSPppSetup::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
if (e.GetIndex() == 1)
{
return SetLogicalName(this, e.GetValue());
}
else if (e.GetIndex() == 2)
{
if (e.GetValue().vt == DLMS_DATA_TYPE_STRING)
{
m_PHYReference = e.GetValue().ToString();
}
else
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(e.GetValue(), DLMS_DATA_TYPE_OCTET_STRING, tmp);
m_PHYReference = tmp.ToString();
}
}
else if (e.GetIndex() == 3)
{
m_LCPOptions.clear();
if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
{
for(std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
{
CGXDLMSPppSetupLcpOption it;
it.SetType((PPP_SETUP_LCP_OPTION_TYPE) (*item).Arr[0].ToInteger());
it.SetLength((*item).Arr[1].ToInteger());
it.SetData((*item).Arr[2]);
m_LCPOptions.push_back(it);
}
}
}
else if (e.GetIndex() == 4)
{
m_IPCPOptions.clear();
if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
{
for(std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
{
CGXDLMSPppSetupIPCPOption it;
it.SetType((PPP_SETUP_IPCP_OPTION_TYPE)(*item).Arr[0].ToInteger());
it.SetLength((*item).Arr[1].ToInteger());
it.SetData((*item).Arr[2]);
m_IPCPOptions.push_back(it);
}
}
}
else if (e.GetIndex() == 5)
{
m_UserName.Clear();
m_Password.Clear();
m_UserName.Set(e.GetValue().Arr[0].byteArr, e.GetValue().Arr[0].size);
m_Password.Set(e.GetValue().Arr[1].byteArr, e.GetValue().Arr[1].size);
}
else
{
return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
return DLMS_ERROR_CODE_OK;
}
示例8: SetValue
// Set value of given attribute.
int CGXDLMSTcpUdpSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
SetPort(value.ToInteger());
return ERROR_CODES_OK;
}
else if (index == 3)
{
if (value.vt == DLMS_DATA_TYPE_NONE)
{
SetIPReference("");
}
else
{
if (value.vt == DLMS_DATA_TYPE_OCTET_STRING)
{
SetIPReference(value.ToString());
}
else
{
SetIPReference(value.ToString());
}
}
}
else if (index == 4)
{
if (value.vt == DLMS_DATA_TYPE_NONE)
{
SetMaximumSegmentSize(576);
}
else
{
SetMaximumSegmentSize(value.ToInteger());
}
}
else if (index == 5)
{
if (value.vt == DLMS_DATA_TYPE_NONE)
{
SetMaximumSimultaneousConnections(1);
}
else
{
SetMaximumSimultaneousConnections(value.ToInteger());
}
}
else if (index == 6)
{
if (value.vt == DLMS_DATA_TYPE_NONE)
{
SetInactivityTimeout(180);
}
else
{
SetInactivityTimeout(value.ToInteger());
}
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例9: SetValue
// Set value of given attribute.
int CGXDLMSMBusClient::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_OCTET_STRING, tmp);
m_MBusPortReference = tmp.ToString();
}
else if (index == 3)
{
m_CaptureDefinition.clear();
CGXDLMSVariant tmp1, tmp2;
for(vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSClient::ChangeType((*it).Arr[0].byteArr, DLMS_DATA_TYPE_OCTET_STRING, tmp1);
CGXDLMSClient::ChangeType((*it).Arr[1].byteArr, DLMS_DATA_TYPE_OCTET_STRING, tmp2);
m_CaptureDefinition.push_back(std::pair<string, string>(tmp1.ToString(), tmp2.ToString()));
}
}
else if (index == 4)
{
m_CapturePeriod = value.ToInteger();
}
else if (index == 5)
{
m_PrimaryAddress = value.ToInteger();
}
else if (index == 6)
{
m_IdentificationNumber = value.ToInteger();
}
else if (index == 7)
{
m_ManufacturerID = value.ToInteger();
}
else if (index == 8)
{
m_DataHeaderVersion = value.ToInteger();
}
else if (index == 9)
{
m_DeviceType = value.ToInteger();
}
else if (index == 10)
{
m_AccessNumber = value.ToInteger();
}
else if (index == 11)
{
m_Status = value.ToInteger();
}
else if (index == 12)
{
m_Alarm = value.ToInteger();
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例10: SetValue
// Set value of given attribute.
int CGXDLMSLimiter::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
if (e.GetIndex() == 1)
{
return SetLogicalName(this, e.GetValue());
}
else if (e.GetIndex() == 2)
{
DLMS_OBJECT_TYPE ot = (DLMS_OBJECT_TYPE) e.GetValue().Arr[0].ToInteger();
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(e.GetValue().Arr[1], DLMS_DATA_TYPE_OCTET_STRING, tmp);
std::string ln = tmp.ToString();
m_SetSelectedAttributeIndex = e.GetValue().Arr[2].ToInteger();
m_MonitoredValue = settings.GetObjects().FindByLN(ot, ln);
}
else if (e.GetIndex() == 3)
{
m_ThresholdActive = e.GetValue();
}
else if (e.GetIndex() == 4)
{
m_ThresholdNormal = e.GetValue();
}
else if (e.GetIndex() == 5)
{
m_ThresholdEmergency = e.GetValue();
}
else if (e.GetIndex() == 6)
{
m_MinOverThresholdDuration = e.GetValue().ToInteger();
}
else if (e.GetIndex() == 7)
{
m_MinUnderThresholdDuration = e.GetValue().ToInteger();
}
else if (e.GetIndex() == 8)
{
m_EmergencyProfile.SetID(e.GetValue().Arr[0].ToInteger());
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(e.GetValue().Arr[1], DLMS_DATA_TYPE_DATETIME, tmp);
m_EmergencyProfile.SetActivationTime(tmp.dateTime);
m_EmergencyProfile.SetDuration(e.GetValue().Arr[2].ToInteger());
}
else if (e.GetIndex() == 9)
{
m_EmergencyProfileGroupIDs.clear();
for (std::vector<CGXDLMSVariant>::iterator it = e.GetValue().Arr.begin(); it != e.GetValue().Arr.end(); ++it)
{
m_EmergencyProfileGroupIDs.push_back((*it).ToInteger());
}
}
else if (e.GetIndex() == 10)
{
m_EmergencyProfileActive = e.GetValue().boolVal;
}
else if (e.GetIndex() == 11)
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(e.GetValue().Arr[0].Arr[0], DLMS_DATA_TYPE_OCTET_STRING, tmp);
m_ActionOverThreshold.SetLogicalName(tmp.ToString());
m_ActionOverThreshold.SetScriptSelector(e.GetValue().Arr[0].Arr[1].ToInteger());
CGXDLMSClient::ChangeType(e.GetValue().Arr[1].Arr[0], DLMS_DATA_TYPE_OCTET_STRING, tmp);
m_ActionUnderThreshold.SetLogicalName(tmp.ToString());
m_ActionUnderThreshold.SetScriptSelector(e.GetValue().Arr[1].Arr[1].ToInteger());
}
else
{
return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
return DLMS_ERROR_CODE_OK;
}