int CGXDLMSAssociationShortName::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_ObjectList.clear();
        if (value.vt == DLMS_DATA_TYPE_ARRAY)
        {
			for(vector<CGXDLMSVariant>::iterator item = value.Arr.begin(); item != value.Arr.end(); ++item)
            {
				int sn = item->Arr[0].ToInteger();
				CGXDLMSObject* pObj = GetParent()->FindBySN(sn);
				if (pObj == NULL)
				{
                    OBJECT_TYPE type = (OBJECT_TYPE) item->Arr[1].ToInteger();
					int version = item->Arr[2].ToInteger();
					string ln;
					CGXOBISTemplate::GetLogicalName(&(*item).Arr[3].byteArr[0], ln);
					pObj = CGXDLMSObjectFactory::CreateObject(type);
                    pObj->SetLogicalName(ln);
					pObj->SetShortName(sn);
					pObj->SetVersion(version);						
				}
				m_ObjectList.push_back(pObj);
            }               
        }
    }  
    else if (index == 3)
    {
        if (value.vt == DLMS_DATA_TYPE_NONE)
        {
			for(vector<CGXDLMSObject*>::iterator it = m_ObjectList.begin(); it != m_ObjectList.end(); ++it)
            {
                for(int pos = 1; pos != (*it)->GetAttributeCount(); ++pos)
                {
					(*it)->SetAccess(pos, ACCESSMODE_NONE);
                }
            }
        }
        else
        {
            UpdateAccessRights(value);
        }
    }
	return ERROR_CODES_INVALID_PARAMETER;
}
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;
}