ToLogicalName() static private method

Reserved for internal use.
static private ToLogicalName ( byte buff ) : string
buff byte
return string
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, int index, object value)
 {
     if (index == 1)
     {
         if (value is string)
         {
             LogicalName = value.ToString();
         }
         else
         {
             LogicalName = GXDLMSClient.ChangeType((byte[])value, DataType.OctetString).ToString();
         }
     }
     else if (index == 2)
     {
         List <GXDLMSObjectDefinition> items = new List <GXDLMSObjectDefinition>();
         if (value != null)
         {
             foreach (Object[] it in (Object[])value)
             {
                 GXDLMSObjectDefinition item = new GXDLMSObjectDefinition();
                 item.ClassId     = (ObjectType)Convert.ToInt32(it[0]);
                 item.LogicalName = GXDLMSObject.ToLogicalName((byte[])it[1]);
                 items.Add(item);
             }
         }
         RegisterAssignment = items.ToArray();
     }
     else if (index == 3)
     {
         MaskList.Clear();
         if (value != null)
         {
             foreach (Object[] it in (Object[])value)
             {
                 List <byte> index_list = new List <byte>();
                 foreach (byte b in (Object[])it[1])
                 {
                     index_list.Add(b);
                 }
                 MaskList.Add(new KeyValuePair <byte[], byte[]>((byte[])it[0], index_list.ToArray()));
             }
         }
     }
     else if (index == 4)
     {
         if (value == null)
         {
             ActiveMask = null;
         }
         else
         {
             ActiveMask = (byte[])value;
         }
     }
     else
     {
         throw new ArgumentException("SetValue failed. Invalid attribute index.");
     }
 }
Beispiel #2
0
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
 {
     if (e.Index == 1)
     {
         if (e.Value is string)
         {
             LogicalName = e.Value.ToString();
         }
         else
         {
             LogicalName = GXDLMSClient.ChangeType((byte[])e.Value, DataType.OctetString).ToString();
         }
     }
     else if (e.Index == 2)
     {
         List <GXDLMSObjectDefinition> items = new List <GXDLMSObjectDefinition>();
         if (e.Value != null)
         {
             foreach (Object[] it in (Object[])e.Value)
             {
                 GXDLMSObjectDefinition item = new GXDLMSObjectDefinition();
                 item.ObjectType  = (ObjectType)Convert.ToInt32(it[0]);
                 item.LogicalName = GXDLMSObject.ToLogicalName((byte[])it[1]);
                 items.Add(item);
             }
         }
         RegisterAssignment = items.ToArray();
     }
     else if (e.Index == 3)
     {
         MaskList.Clear();
         if (e.Value != null)
         {
             foreach (Object[] it in (Object[])e.Value)
             {
                 List <byte> index_list = new List <byte>();
                 foreach (byte b in (Object[])it[1])
                 {
                     index_list.Add(b);
                 }
                 MaskList.Add(new KeyValuePair <byte[], byte[]>((byte[])it[0], index_list.ToArray()));
             }
         }
     }
     else if (e.Index == 4)
     {
         if (e.Value == null)
         {
             ActiveMask = null;
         }
         else
         {
             ActiveMask = (byte[])e.Value;
         }
     }
     else
     {
         e.Error = ErrorCode.ReadWriteDenied;
     }
 }
        /// <summary>
        /// Get selected (filtered) columns.
        /// </summary>
        /// <param name="cols">Selected columns.</param>
        /// <returns>Selected columns.</returns>
        private List <GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> > GetColumns(object[] cols)
        {
            List <GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> > columns = null;

            if (cols != null && cols.Length != 0)
            {
                columns = new List <GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> >();
                foreach (object it in cols)
                {
                    Object[]   tmp            = (Object[])it;
                    ObjectType ot             = (ObjectType)Convert.ToInt32(tmp[0]);
                    String     ln             = GXDLMSObject.ToLogicalName((byte[])tmp[1]);
                    short      attributeIndex = Convert.ToInt16(tmp[2]);
                    short      dataIndex      = Convert.ToInt16(tmp[3]);
                    // Find columns and update only them.
                    foreach (GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> c in CaptureObjects)
                    {
                        if (c.Key.ObjectType == ot &&
                            c.Value.AttributeIndex == attributeIndex &&
                            c.Value.DataIndex == dataIndex &&
                            c.Key.LogicalName.CompareTo(ln) == 0)
                        {
                            columns.Add(c);
                            break;
                        }
                    }
                }
            }
            return(columns);
        }
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, int index, object value)
 {
     if (index == 1)
     {
         if (value is string)
         {
             LogicalName = value.ToString();
         }
         else
         {
             LogicalName = GXDLMSClient.ChangeType((byte[])value, DataType.OctetString).ToString();
         }
     }
     else if (index == 2)
     {
         if (CaptureObjects == null || CaptureObjects.Count == 0)
         {
             throw new Exception("Read capture objects first.");
         }
         if (value != null && (value as object[]).Length != 0)
         {
             int      index2   = 0;
             DateTime lastDate = DateTime.MinValue;
             foreach (object[] row in (value as object[]))
             {
                 if ((row as object[]).Length != CaptureObjects.Count)
                 {
                     throw new Exception("Number of columns do not match.");
                 }
                 for (int pos = 0; pos != row.Length; ++pos)
                 {
                     index2 = CaptureObjects[pos].Value.AttributeIndex;
                     DataType type;
                     //Actaris SL 7000 and ACE 6000 returns 0.
                     if (index2 != 0)
                     {
                         type = CaptureObjects[pos].Key.GetUIDataType(index2);
                     }
                     else
                     {
                         type = DataType.None;
                     }
                     if (row[pos] is byte[])
                     {
                         if (type != DataType.None && row[pos] is byte[])
                         {
                             row[pos] = GXDLMSClient.ChangeType(row[pos] as byte[], type);
                             if (row[pos] is GXDateTime)
                             {
                                 GXDateTime dt = (GXDateTime)row[pos];
                                 lastDate = dt.Value.LocalDateTime;
                             }
                         }
                     }
                     else if (type == DataType.DateTime && row[pos] == null && CapturePeriod != 0)
                     {
                         if (lastDate == DateTime.MinValue && Buffer.Count != 0)
                         {
                             lastDate = ((GXDateTime)Buffer[Buffer.Count - 1].GetValue(pos)).Value.LocalDateTime;
                         }
                         if (lastDate != DateTime.MinValue)
                         {
                             lastDate = lastDate.AddSeconds(CapturePeriod);
                             row[pos] = new GXDateTime(lastDate);
                         }
                     }
                     if (CaptureObjects[pos].Key is GXDLMSRegister && index2 == 2)
                     {
                         double scaler = (CaptureObjects[pos].Key as GXDLMSRegister).Scaler;
                         if (scaler != 1)
                         {
                             try
                             {
                                 row[pos] = Convert.ToDouble(row[pos]) * scaler;
                             }
                             catch
                             {
                                 //Skip error
                             }
                         }
                     }
                 }
                 Buffer.Add(row);
             }
             EntriesInUse = Buffer.Count;
         }
     }
     else if (index == 3)
     {
         Buffer.Clear();
         EntriesInUse = 0;
         CaptureObjects.Clear();
         GXDLMSObjectCollection objects = new GXDLMSObjectCollection();
         foreach (object it in value as object[])
         {
             object[] tmp = it as object[];
             if (tmp.Length != 4)
             {
                 throw new GXDLMSException("Invalid structure format.");
             }
             ObjectType   type           = (ObjectType)Convert.ToInt16(tmp[0]);
             string       ln             = GXDLMSObject.ToLogicalName((byte[])tmp[1]);
             int          attributeIndex = Convert.ToInt16(tmp[2]);
             int          dataIndex      = Convert.ToInt16(tmp[3]);
             GXDLMSObject obj            = null;
             if (settings != null && settings.Objects != null)
             {
                 obj = settings.Objects.FindByLN(type, ln);
             }
             if (obj == null)
             {
                 obj = GXDLMSClient.CreateDLMSObject((int)type, null, 0, ln, 0);
             }
             CaptureObjects.Add(new GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(attributeIndex, dataIndex)));
             objects.Add(obj);
         }
     }
     else if (index == 4)
     {
         CapturePeriod = Convert.ToInt32(value);
     }
     else if (index == 5)
     {
         SortMethod = (SortMethod)Convert.ToInt32(value);
     }
     else if (index == 6)
     {
         if (value != null)
         {
             object[] tmp = value as object[];
             if (tmp.Length != 4)
             {
                 throw new GXDLMSException("Invalid structure format.");
             }
             ObjectType type = (ObjectType)Convert.ToInt16(tmp[0]);
             string     ln   = GXDLMSObject.ToLogicalName((byte[])tmp[1]);
             SortAttributeIndex = Convert.ToInt16(tmp[2]);
             SortDataIndex      = Convert.ToInt16(tmp[3]);
             SortObject         = null;
             foreach (var it in CaptureObjects)
             {
                 if (it.Key.ObjectType == type && it.Key.LogicalName == ln)
                 {
                     SortObject = it.Key;
                     break;
                 }
             }
         }
         else
         {
             SortObject = null;
         }
     }
     else if (index == 7)
     {
         EntriesInUse = Convert.ToInt32(value);
     }
     else if (index == 8)
     {
         ProfileEntries = Convert.ToInt32(value);
     }
     else
     {
         throw new ArgumentException("SetValue failed. Invalid attribute index.");
     }
 }
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
 {
     if (e.Index == 1)
     {
         if (e.Value is string)
         {
             LogicalName = e.Value.ToString();
         }
         else
         {
             LogicalName = GXDLMSClient.ChangeType((byte[])e.Value, DataType.OctetString, settings.UseUtc2NormalTime).ToString();
         }
     }
     else if (e.Index == 2)
     {
         ObjectList.Clear();
         if (e.Value != null)
         {
             foreach (Object[] item in (Object[])e.Value)
             {
                 ObjectType   type    = (ObjectType)Convert.ToInt32(item[0]);
                 int          version = Convert.ToInt32(item[1]);
                 String       ln      = GXDLMSObject.ToLogicalName((byte[])item[2]);
                 GXDLMSObject obj     = null;
                 if (settings.Objects != null)
                 {
                     obj = settings.Objects.FindByLN(type, ln);
                 }
                 if (obj == null)
                 {
                     obj             = Gurux.DLMS.GXDLMSClient.CreateObject(type);
                     obj.LogicalName = ln;
                     obj.Version     = version;
                 }
                 //Unknown objects are not shown.
                 if (obj is IGXDLMSBase && item[3] != null)
                 {
                     UpdateAccessRights(obj, (Object[])item[3]);
                     ObjectList.Add(obj);
                 }
             }
         }
     }
     else if (e.Index == 3)
     {
         if (e.Value != null)
         {
             ClientSAP = Convert.ToByte(((Object[])e.Value)[0]);
             ServerSAP = Convert.ToUInt16(((Object[])e.Value)[1]);
         }
     }
     else if (e.Index == 4)
     {
         //Value of the object identifier encoded in BER
         if (e.Value is byte[])
         {
             GXByteBuffer arr = new GXByteBuffer(e.Value as byte[]);
             if (arr.GetUInt8(0) == 0x60)
             {
                 ApplicationContextName.JointIsoCtt = 0;
                 ++arr.Position;
                 ApplicationContextName.Country = 0;
                 ++arr.Position;
                 ApplicationContextName.CountryName = 0;
                 ++arr.Position;
                 ApplicationContextName.IdentifiedOrganization = arr.GetUInt8();
                 ApplicationContextName.DlmsUA             = arr.GetUInt8();
                 ApplicationContextName.ApplicationContext = arr.GetUInt8();
                 ApplicationContextName.ContextId          = arr.GetUInt8();
             }
             else
             {
                 //Get Tag and Len.
                 if (arr.GetUInt8() != (int)BerType.Integer && arr.GetUInt8() != 7)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.JointIsoCtt = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.Country = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x12)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.CountryName = arr.GetUInt16();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.IdentifiedOrganization = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.DlmsUA = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.ApplicationContext = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.ContextId = arr.GetUInt8();
             }
         }
         else if (e.Value != null)
         {
             Object[] arr = (Object[])e.Value;
             ApplicationContextName.JointIsoCtt            = Convert.ToByte(arr[0]);
             ApplicationContextName.Country                = Convert.ToByte(arr[1]);
             ApplicationContextName.CountryName            = Convert.ToUInt16(arr[2]);
             ApplicationContextName.IdentifiedOrganization = Convert.ToByte(arr[3]);
             ApplicationContextName.DlmsUA             = Convert.ToByte(arr[4]);
             ApplicationContextName.ApplicationContext = Convert.ToByte(arr[5]);
             ApplicationContextName.ContextId          = Convert.ToByte(arr[6]);
         }
     }
     else if (e.Index == 5)
     {
         if (e.Value != null)
         {
             Object[]     arr = (Object[])e.Value;
             GXByteBuffer bb  = new GXByteBuffer();
             GXCommon.SetBitString(bb, arr[0]);
             bb.SetUInt8(0, 0);
             XDLMSContextInfo.Conformance       = (Conformance)bb.GetUInt32();
             XDLMSContextInfo.MaxReceivePduSize = Convert.ToUInt16(arr[1]);
             XDLMSContextInfo.MaxSendPpuSize    = Convert.ToUInt16(arr[2]);
             XDLMSContextInfo.DlmsVersionNumber = Convert.ToByte(arr[3]);
             XDLMSContextInfo.QualityOfService  = Convert.ToSByte(arr[4]);
             XDLMSContextInfo.CypheringInfo     = (byte[])arr[5];
         }
     }
     else if (e.Index == 6)
     {
         //Value of the object identifier encoded in BER
         if (e.Value is byte[])
         {
             GXByteBuffer arr = new GXByteBuffer(e.Value as byte[]);
             if (arr.GetUInt8(0) == 0x60)
             {
                 AuthenticationMechanismName.JointIsoCtt = 0;
                 ++arr.Position;
                 AuthenticationMechanismName.Country = 0;
                 ++arr.Position;
                 AuthenticationMechanismName.CountryName = 0;
                 ++arr.Position;
                 AuthenticationMechanismName.IdentifiedOrganization = arr.GetUInt8();
                 AuthenticationMechanismName.DlmsUA = arr.GetUInt8();
                 AuthenticationMechanismName.AuthenticationMechanismName = arr.GetUInt8();
                 AuthenticationMechanismName.MechanismId = (Authentication)arr.GetUInt8();
             }
             else
             {
                 //Get Tag and Len.
                 if (arr.GetUInt8() != (int)BerType.Integer && arr.GetUInt8() != 7)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.JointIsoCtt = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.Country = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x12)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.CountryName = arr.GetUInt16();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.IdentifiedOrganization = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.DlmsUA = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.AuthenticationMechanismName = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.MechanismId = (Authentication)arr.GetUInt8();
             }
         }
         else if (e.Value != null)
         {
             Object[] arr = (Object[])e.Value;
             AuthenticationMechanismName.JointIsoCtt            = Convert.ToByte(arr[0]);
             AuthenticationMechanismName.Country                = Convert.ToByte(arr[1]);
             AuthenticationMechanismName.CountryName            = Convert.ToUInt16(arr[2]);
             AuthenticationMechanismName.IdentifiedOrganization = Convert.ToByte(arr[3]);
             AuthenticationMechanismName.DlmsUA = Convert.ToByte(arr[4]);
             AuthenticationMechanismName.AuthenticationMechanismName = Convert.ToByte(arr[5]);
             AuthenticationMechanismName.MechanismId = (Authentication)Convert.ToByte(arr[6]);
         }
     }
     else if (e.Index == 7)
     {
         Secret = (byte[])e.Value;
     }
     else if (e.Index == 8)
     {
         if (e.Value == null)
         {
             AssociationStatus = AssociationStatus.NonAssociated;
         }
         else
         {
             AssociationStatus = (AssociationStatus)Convert.ToInt32(e.Value);
         }
     }
     else if (e.Index == 9)
     {
         SecuritySetupReference = GXDLMSClient.ChangeType((byte[])e.Value, DataType.OctetString, false).ToString();
     }
     else
     {
         e.Error = ErrorCode.ReadWriteDenied;
     }
 }
Beispiel #6
0
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
 {
     if (e.Index == 1)
     {
         if (e.Value is string)
         {
             LogicalName = e.Value.ToString();
         }
         else
         {
             LogicalName = GXDLMSClient.ChangeType((byte[])e.Value, DataType.OctetString).ToString();
         }
     }
     else if (e.Index == 2)
     {
         ObjectList.Clear();
         if (e.Value != null)
         {
             foreach (Object[] item in (Object[])e.Value)
             {
                 ushort       sn      = (ushort)(Convert.ToInt32(item[0]) & 0xFFFF);
                 ObjectType   type    = (ObjectType)Convert.ToInt32(item[1]);
                 int          version = Convert.ToInt32(item[2]);
                 String       ln      = GXDLMSObject.ToLogicalName((byte[])item[3]);
                 GXDLMSObject obj     = null;
                 if (settings.Objects != null)
                 {
                     obj = settings.Objects.FindBySN(sn);
                 }
                 if (obj == null)
                 {
                     obj = Gurux.DLMS.GXDLMSClient.CreateObject(type);
                     if (obj != null)
                     {
                         obj.LogicalName = ln;
                         obj.ShortName   = sn;
                         obj.Version     = version;
                     }
                 }
                 //Unknown objects are not shown.
                 if (obj is IGXDLMSBase)
                 {
                     ObjectList.Add(obj);
                 }
             }
         }
     }
     else if (e.Index == 3)
     {
         if (e.Value == null)
         {
             foreach (GXDLMSObject it in ObjectList)
             {
                 for (int pos = 1; pos != (it as IGXDLMSBase).GetAttributeCount(); ++pos)
                 {
                     it.SetAccess(pos, AccessMode.NoAccess);
                 }
             }
         }
         else
         {
             UpdateAccessRights((Object[])e.Value);
         }
     }
     else if (e.Index == 4)
     {
         if (e.Value is string)
         {
             SecuritySetupReference = e.Value.ToString();
         }
         else
         {
             SecuritySetupReference = GXDLMSClient.ChangeType(e.Value as byte[], DataType.OctetString).ToString();
         }
     }
     else
     {
         e.Error = ErrorCode.ReadWriteDenied;
     }
 }
        void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
        {
            if (e.Index == 1)
            {
                if (e.Value is string)
                {
                    LogicalName = e.Value.ToString();
                }
                else
                {
                    LogicalName = GXDLMSClient.ChangeType((byte[])e.Value, DataType.OctetString, settings.UseUtc2NormalTime).ToString();
                }
            }
            else if (e.Index == 2)
            {
                SetBuffer(settings, e);
            }
            else if (e.Index == 3)
            {
                Reset();
                CaptureObjects.Clear();
                GXDLMSObjectCollection objects = new GXDLMSObjectCollection();
                if (e.Value != null)
                {
                    foreach (object it in e.Value as object[])
                    {
                        object[] tmp = it as object[];
                        if (tmp.Length != 4)
                        {
                            throw new GXDLMSException("Invalid structure format.");
                        }
                        ObjectType   type           = (ObjectType)Convert.ToInt16(tmp[0]);
                        string       ln             = GXDLMSObject.ToLogicalName((byte[])tmp[1]);
                        int          attributeIndex = Convert.ToInt16(tmp[2]);
                        int          dataIndex      = Convert.ToInt16(tmp[3]);
                        GXDLMSObject obj            = null;
                        if (settings != null && settings.Objects != null)
                        {
                            obj = settings.Objects.FindByLN(type, ln);
                        }
                        if (obj == null)
                        {
                            obj = GXDLMSClient.CreateDLMSObject((int)type, null, 0, ln, 0);
                        }
                        CaptureObjects.Add(new GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(attributeIndex, dataIndex)));
                        objects.Add(obj);
                    }
                }
            }
            else if (e.Index == 4)
            {
                //Any write access to one of the attributes will automatically call a reset
                //and this call will propagate to all other profiles capturing this profile.
                if (settings.IsServer)
                {
                    Reset();
                }
                CapturePeriod = Convert.ToInt32(e.Value);
            }
            else if (e.Index == 5)
            {
                //Any write access to one of the attributes will automatically call a reset
                //and this call will propagate to all other profiles capturing this profile.
                if (settings.IsServer)
                {
                    Reset();
                }
                SortMethod = (SortMethod)Convert.ToInt32(e.Value);
            }
            else if (e.Index == 6)
            {
                //Any write access to one of the attributes will automatically call a reset
                //and this call will propagate to all other profiles capturing this profile.
                if (settings.IsServer)
                {
                    Reset();
                }

                if (e.Value != null)
                {
                    object[] tmp = e.Value as object[];
                    if (tmp.Length != 4)
                    {
                        throw new GXDLMSException("Invalid structure format.");
                    }
                    ObjectType type = (ObjectType)Convert.ToInt16(tmp[0]);
                    string     ln   = GXDLMSObject.ToLogicalName((byte[])tmp[1]);
                    SortAttributeIndex = Convert.ToInt16(tmp[2]);
                    SortDataIndex      = Convert.ToInt16(tmp[3]);
                    SortObject         = null;
                    foreach (var it in CaptureObjects)
                    {
                        if (it.Key.ObjectType == type && it.Key.LogicalName == ln)
                        {
                            SortObject = it.Key;
                            break;
                        }
                    }
                    if (SortObject == null)
                    {
                        SortObject             = GXDLMSClient.CreateObject(type);
                        SortObject.LogicalName = ln;
                    }
                }
                else
                {
                    SortObject = null;
                }
            }
            else if (e.Index == 7)
            {
                EntriesInUse = Convert.ToInt32(e.Value);
            }
            else if (e.Index == 8)
            {
                //Any write access to one of the attributes will automatically call a reset
                //and this call will propagate to all other profiles capturing this profile.
                if (settings.IsServer)
                {
                    Reset();
                }
                ProfileEntries = Convert.ToInt32(e.Value);
            }
            else
            {
                e.Error = ErrorCode.ReadWriteDenied;
            }
        }