当前位置: 首页>>代码示例>>C++>>正文


C++ CGXDLMSVariant::ToInteger方法代码示例

本文整理汇总了C++中CGXDLMSVariant::ToInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ CGXDLMSVariant::ToInteger方法的具体用法?C++ CGXDLMSVariant::ToInteger怎么用?C++ CGXDLMSVariant::ToInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGXDLMSVariant的用法示例。


在下文中一共展示了CGXDLMSVariant::ToInteger方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetValue

// Set value of given attribute.
int CGXDLMSMBusSlavePortSetup::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_DefaultBaud = (BAUDRATE) value.ToInteger();            
    }
    else if (index == 3)
    {
        m_AvailableBaud = (BAUDRATE) value.ToInteger();                       
    }
    else if (index == 4)
    {
		m_AddressState = (ADDRESS_STATE) value.ToInteger();            
    }
    else if (index == 5)
    {
        m_BusAddress = value.ToInteger();
    }
	else
	{
		return ERROR_CODES_INVALID_PARAMETER;
	}
	return ERROR_CODES_OK;
}
开发者ID:JacquesWattel,项目名称:GuruxDLMSLibClientExample,代码行数:33,代码来源:GXDLMSMBusSlavePortSetup.cpp

示例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;
}
开发者ID:d21d3q,项目名称:Gurux.DLMS.cpp,代码行数:51,代码来源:GXDLMSImageTransfer.cpp

示例3: SetValue

// Set value of given attribute.
int CGXDLMSHdlcSetup::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_CommunicationSpeed = (BAUDRATE) value.ToInteger();
    }
    else if (index == 3)
    {
        m_WindowSizeTransmit = value.ToInteger();
    }
    else if (index == 4)
    {
        m_WindowSizeReceive = value.ToInteger();
    }
    else if (index == 5)
    {
        m_MaximumInfoLengthTransmit = value.ToInteger();
    }
    else if (index == 6)
    {
        m_MaximumInfoLengthReceive = value.ToInteger();
    }
    else if (index == 7)
    {
        m_InterCharachterTimeout = value.ToInteger();
    }
    else if (index == 8)
    {
        m_InactivityTimeout = value.ToInteger();
    }
    else if (index == 9)
    {
        m_DeviceAddress = value.ToInteger();
    }
	else
	{
		return ERROR_CODES_INVALID_PARAMETER;
	}
	return ERROR_CODES_OK;
}
开发者ID:cautonwong,项目名称:GuruxDLMSLib,代码行数:49,代码来源:GXDLMSHdlcSetup.cpp

示例4: SetValue

// Set value of given attribute.
int CGXDLMSIecHdlcSetup::SetValue(CGXDLMSSettings* settings, int index, CGXDLMSVariant& value)
{
    if (index == 1)
    {
        return SetLogicalName(this, value);
    }
    else if (index == 2)
    {
        m_CommunicationSpeed = (BAUDRATE) value.ToInteger();
    }
    else if (index == 3)
    {
        m_WindowSizeTransmit = value.ToInteger();
    }
    else if (index == 4)
    {
        m_WindowSizeReceive = value.ToInteger();
    }
    else if (index == 5)
    {
        m_MaximumInfoLengthTransmit = value.ToInteger();
    }
    else if (index == 6)
    {
        m_MaximumInfoLengthReceive = value.ToInteger();
    }
    else if (index == 7)
    {
        m_InterCharachterTimeout = value.ToInteger();
    }
    else if (index == 8)
    {
        m_InactivityTimeout = value.ToInteger();
    }
    else if (index == 9)
    {
        m_DeviceAddress = value.ToInteger();
    }
    else
    {
        return ERROR_CODES_INVALID_PARAMETER;
    }
    return ERROR_CODES_OK;
}
开发者ID:d21d3q,项目名称:Gurux.DLMS.cpp,代码行数:45,代码来源:GXDLMSHdlcSetup.cpp

示例5: SetValue

// Set value of given attribute.
int CGXDLMSMBusMasterPortSetup::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_CommSpeed = (BAUDRATE) value.ToInteger();
	}
	else
	{
		return ERROR_CODES_INVALID_PARAMETER;
	}
	return ERROR_CODES_OK;
}
开发者ID:JacquesWattel,项目名称:GuruxDLMSLibClientExample,代码行数:21,代码来源:GXDLMSMBusMasterPortSetup.cpp

示例6: 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;
}
开发者ID:bgb043,项目名称:GuruxDLMSLibClientExample,代码行数:67,代码来源:GXDLMSAssociationLogicalName.cpp

示例7: SetValue

/*
 * Set value of given attribute.
 */
int CGXDLMSProfileGeneric::SetValue(int index, CGXDLMSVariant& value)
{
	int ret;
    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 (m_CaptureObjects.size() == 0)
        {
			//Read capture objects first.
			return ERROR_CODES_INVALID_PARAMETER;                
        }
        m_Buffer.clear();
		if (value.vt != DLMS_DATA_TYPE_NONE)
        {
            vector<DLMS_DATA_TYPE> types;
			DLMS_DATA_TYPE type;
			for (std::vector<std::pair<CGXDLMSObject*, CGXDLMSCaptureObject*> >::iterator it = m_CaptureObjects.begin(); it != m_CaptureObjects.end(); ++it)                    
            {
				if ((ret = (*it).first->GetUIDataType((*it).second->GetAttributeIndex(), type)) != 0)
				{
					return ret;
				}
                types.push_back(type);
            }
			
			for (std::vector<CGXDLMSVariant >::iterator row = value.Arr.begin(); row != value.Arr.end(); ++row)                    
            {
                if ((*row).Arr.size() != m_CaptureObjects.size())
                {
                    //Number of columns do not match.
					return ERROR_CODES_INVALID_PARAMETER;
                }
                for(unsigned int a = 0; a < (*row).Arr.size(); ++a)
                {
                    CGXDLMSVariant data = (*row).Arr[a];
                    DLMS_DATA_TYPE type = types[a];
                    if (type != DLMS_DATA_TYPE_NONE && data.vt == DLMS_DATA_TYPE_OCTET_STRING)
                    {
						unsigned char* pBuff = &data.byteArr[0];
						int size = data.byteArr.size();
                        if ((ret = CGXOBISTemplate::GetData(pBuff, size, type, (*row).Arr[a])) != 0)
						{
							return ret;
						}
                    }
					std::pair<CGXDLMSObject*, CGXDLMSCaptureObject*> item = m_CaptureObjects[a];
					if (item.first->GetObjectType() == OBJECT_TYPE_REGISTER && item.second->GetAttributeIndex() == 2)
                    {
                        double scaler = ((CGXDLMSRegister*) item.first)->GetScaler();
                        if (scaler != 1)
                        {
                            row[a] = data.ToDouble() * scaler;                                    
                        }
                    }   
                }
				m_Buffer.push_back(row->Arr);
            }  			
        }
		m_EntriesInUse = m_Buffer.size();
    }
    else if (index == 3)
    {
        m_CaptureObjects.clear();
		m_Buffer.clear();
		m_EntriesInUse = 0;
        if (value.vt == DLMS_DATA_TYPE_ARRAY)
        {
			for (std::vector<CGXDLMSVariant >::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
            {                    
                if ((*it).Arr.size() != 4)
                {
					//Invalid structure format.
					return ERROR_CODES_INVALID_PARAMETER;                        
                }
                OBJECT_TYPE type = (OBJECT_TYPE) (*it).Arr[0].ToInteger();
				string ln;
				CGXOBISTemplate::GetLogicalName(&(*it).Arr[1].byteArr[0], ln);
                CGXDLMSObject* pObj = NULL;
				if (GetParent() != NULL)
				{
					pObj = GetParent()->FindByLN(type, ln);
				}
                if(pObj == NULL)
                {                        
                    pObj = CGXDLMSObjectFactory::CreateObject(type);
                    pObj->SetLogicalName(ln);
                }                    
                AddCaptureObject(pObj, (*it).Arr[2].ToInteger(), (*it).Arr[3].ToInteger());
            }
        }
//.........这里部分代码省略.........
开发者ID:JacquesWattel,项目名称:GuruxDLMSLibClientExample,代码行数:101,代码来源:GXDLMSProfileGeneric.cpp

示例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;
}
开发者ID:JacquesWattel,项目名称:GuruxDLMSLibClientExample,代码行数:73,代码来源:GXDLMSTcpUdpSetup.cpp

示例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;
}
开发者ID:JacquesWattel,项目名称:GuruxDLMSLibClientExample,代码行数:70,代码来源:GXDLMSMBusClient.cpp


注:本文中的CGXDLMSVariant::ToInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。