/// <summary> /// Returns value of property of the component in at position Index. /// </summary> public override object GetValue(object component) { if (_list.Count <= Index) { return(string.Empty); } GXDLMSAttributeSettings a = List[Index]; return(a.Access.ToString() + "[" + a.Type + " / " + a.UIType + "]"); }
public void CopyTo(GXDLMSAttributeSettings target) { target.Name = this.Name; target.Index = Index; target.Type = Type; target.UIType = UIType; target.Access = Access; target.Static = Static; target.Values = Values; target.Order = Order; target.MinimumVersion = MinimumVersion; }
protected GXDLMSAttributeSettings GetAttribute(int index, GXAttributeCollection attributes) { GXDLMSAttributeSettings att = this.Attributes.Find(index); if (att == null) { att = new GXDLMSAttributeSettings(index); //LN is read only. if (index == 1) { att.Access = AccessMode.Read; } if (attributes != null) { attributes.Add(att); } } return att; }
/// <summary> /// Set Method attribute access. /// </summary> /// <param name="index"></param> /// <param name="access"></param> public void SetMethodAccess(int index, MethodAccessMode access) { GXDLMSAttributeSettings att = MethodAttributes.Find(index); if (att == null) { att = new GXDLMSAttributeSettings(index); MethodAttributes.Add(att); } att.MethodAccess = access; }
private void OBISCodesMnu_Click(object sender, EventArgs e) { string ln = null; string selectedManufacturer = null; TreeNode node = this.ObjectTree.SelectedNode; ObjectType Interface = ObjectType.None; GXDLMSDevice dev = null; if (node != null) { if (node.Tag is GXDLMSDevice) { dev = (GXDLMSDevice)node.Tag; selectedManufacturer = dev.Manufacturer; } else if (this.ObjectTree.SelectedNode.Tag is GXDLMSObject) { GXDLMSObject obj = this.ObjectTree.SelectedNode.Tag as GXDLMSObject; dev = obj.Parent.Tag as GXDLMSDevice; selectedManufacturer = dev.Manufacturer; ln = obj.LogicalName; Interface = obj.ObjectType; } } OBISCodesForm dlg = new OBISCodesForm(this.Manufacturers, selectedManufacturer, Interface, ln); if (dlg.ShowDialog(this) == DialogResult.OK) { if (this.ObjectTree.SelectedNode.Tag is GXDLMSObject) { GXDLMSObject obj = this.ObjectTree.SelectedNode.Tag as GXDLMSObject; GXObisCode code = this.Manufacturers.FindByIdentification(selectedManufacturer).ObisCodes.FindByLN(obj.ObjectType, obj.LogicalName, null); obj.Description = code.Description; foreach (GXDLMSAttributeSettings it in code.Attributes) { GXDLMSAttributeSettings att = obj.Attributes.Find(it.Index); if (att == null) { obj.Attributes.Add(it); } else if (att.GetType() == typeof(GXDLMSAttribute)) { obj.Attributes.Remove(it); GXDLMSAttributeSettings tmp = new GXDLMSAttributeSettings(); it.CopyTo(tmp); obj.Attributes.Add(tmp); } else { it.CopyTo(att); } } } } }