public void OnValueChanged(int index, object value, bool user, bool connected)
        {
            GXDLMSCompactData target = Target as GXDLMSCompactData;

            if (index == 2)
            {
                if (!user)
                {
                    UpdateCaptureObjects();
                }
                BufferTb.Text = GXDLMSTranslator.ToHex(target.Buffer);
                DataTable dt = ProfileGenericView.DataSource as DataTable;
                if (dt != null)
                {
                    dt.Rows.Clear();
                    UpdateData(dt);
                }
                ProfileGenericView.Refresh();
            }
            else if (index == 3)
            {
                CaptureObjectsLv.Items.Clear();
                foreach (var it in target.CaptureObjects)
                {
                    ListViewItem li = CaptureObjectsLv.Items.Add(it.Key.ObjectType.ToString());
                    li.SubItems.Add(it.Key.LogicalName);
                    li.SubItems.Add(it.Value.AttributeIndex.ToString());
                    li.Tag = it;
                }
            }
            else if (index == 5)
            {
                List <object> types = GXDLMSCompactData.GetDataTypes(target.TemplateDescription);
                StringBuilder sb    = new StringBuilder();
                AppendDataType(sb, types);
                TemplateDescriptionTb.Text = sb.ToString();
            }
            else
            {
                throw new IndexOutOfRangeException("index");
            }
        }
        private void UpdateCaptureObjects()
        {
            List <object> types = GXDLMSCompactData.GetDataTypes(target.TemplateDescription);
            int           pos, index = 0;
            DataTable     table = ProfileGenericView.DataSource as DataTable;

            ProfileGenericView.DataSource = null;
            ProfileGenericView.Columns.Clear();
            DataTable  dt = new DataTable();
            DataColumn dc;

            foreach (var it in target.CaptureObjects)
            {
                string[] columns = ((IGXDLMSBase)it.Key).GetNames();
                if (it.Value.AttributeIndex == 0)
                {
                    structures = true;
                    for (int a = 0; a != ((IGXDLMSBase)it.Key).GetAttributeCount(); ++a)
                    {
                        dc         = dt.Columns.Add(index.ToString());
                        dc.Caption = it.Key.LogicalName + Environment.NewLine + columns[a];
                        pos        = ProfileGenericView.Columns.Add(index.ToString(), dc.Caption);
                        ProfileGenericView.Columns[pos].DataPropertyName = index.ToString();
                        ++index;
                    }
                }
                else
                {
                    if (it.Value.DataIndex == 0 && types != null && index < types.Count)
                    {
                        dc         = dt.Columns.Add(index.ToString());
                        dc.Caption = it.Key.LogicalName + Environment.NewLine + columns[it.Value.AttributeIndex - 1];
                        pos        = ProfileGenericView.Columns.Add(index.ToString(), dc.Caption);
                        ProfileGenericView.Columns[pos].DataPropertyName = index.ToString();
                    }
                    else
                    {
                        dc = dt.Columns.Add(index.ToString());
                        string str = it.Key.LogicalName;
                        if (it.Value.AttributeIndex < columns.Length)
                        {
                            str += Environment.NewLine + columns[it.Value.AttributeIndex - 1];
                        }
                        if (!string.IsNullOrEmpty(it.Key.Description))
                        {
                            str += Environment.NewLine + it.Key.Description;
                        }
                        //In Indian standard register scalers are saved to table.
                        if (it.Key is GXDLMSRegister && it.Value.AttributeIndex == 3)
                        {
                            structures = true;
                        }
                        dc.Caption = str;
                        pos        = ProfileGenericView.Columns.Add(index.ToString(), dc.Caption);
                        ProfileGenericView.Columns[pos].DataPropertyName = index.ToString();
                    }
                    ++index;
                }
            }
            UpdateData(dt);
            ProfileGenericView.DataSource = dt;
        }