private void GetAccessRights(GXDLMSSettings settings, GXDLMSObject item, GXByteBuffer data)
{
data.SetUInt8((byte)DataType.Structure);
data.SetUInt8((byte)2);
data.SetUInt8((byte)DataType.Array);
GXAttributeCollection attributes = item.Attributes;
int cnt = (item as IGXDLMSBase).GetAttributeCount();
data.SetUInt8((byte)cnt);
for (int pos = 0; pos != cnt; ++pos)
{
GXDLMSAttributeSettings att = attributes.Find(pos + 1);
data.SetUInt8((byte)DataType.Structure); //attribute_access_item
data.SetUInt8((byte)3);
GXCommon.SetData(settings, data, DataType.Int8, pos + 1);
//If attribute is not set return read only.
if (att == null)
{
GXCommon.SetData(settings, data, DataType.Enum, AccessMode.Read);
}
else
{
GXCommon.SetData(settings, data, DataType.Enum, att.Access);
}
GXCommon.SetData(settings, data, DataType.None, null);
}
data.SetUInt8((byte)DataType.Array);
attributes = item.MethodAttributes;
cnt = (item as IGXDLMSBase).GetMethodCount();
data.SetUInt8((byte)cnt);
for (int pos = 0; pos != cnt; ++pos)
{
GXDLMSAttributeSettings att = attributes.Find(pos + 1);
data.SetUInt8((byte)DataType.Structure); //attribute_access_item
data.SetUInt8((byte)2);
GXCommon.SetData(settings, data, DataType.Int8, pos + 1);
//If method attribute is not set return no access.
if (att == null)
{
GXCommon.SetData(settings, data, DataType.Enum, MethodAccessMode.NoAccess);
}
else
{
GXCommon.SetData(settings, data, DataType.Enum, att.MethodAccess);
}
}
}