Пример #1
0
        public OBISCodeForm(GXDLMSConverter c, GXDLMSObjectCollection objs, GXObisCodeCollection collection, GXObisCode item)
        {
            InitializeComponent();
            converter = c;
            objects   = objs;
            if (c == null)
            {
                converter = new GXDLMSConverter();
            }
            OriginalTarget = item;
            //Create clone from original items.
            MemoryStream    ms = new MemoryStream();
            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(ms, item);
            ms.Position = 0;
            Target      = (GXObisCode)bf.Deserialize(ms);
            ms.Close();
            ObisCodeCollection = collection;
            ShowInterfaces();
            if (Target.ObjectType == ObjectType.None)
            {
                InterfaceCB.SelectedIndex = 0;
            }
            else
            {
                InterfaceCB.SelectedItem = Target.ObjectType;
            }
            UpdateTarget();
        }
Пример #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public GXManufacturer()
 {
     InactivityMode = InactivityMode.KeepAlive;
     StartProtocol = StartProtocolType.IEC;
     ObisCodes = new GXObisCodeCollection();
     Settings = new List<GXAuthentication>();
     ServerSettings = new List<GXServerAddress>();
     KeepAliveInterval = 40000;
 }
Пример #3
0
        void ShowOBISCOdes(GXObisCodeCollection collection, ObjectType Interface, string selectedLN)
        {
            Items.Clear();
            this.OBISCodesList.Items.Clear();
            if (collection != null)
            {
                List <KeyValuePair <string, GXObisCode> > list = new List <KeyValuePair <string, GXObisCode> >();
                foreach (GXObisCode it in collection)
                {
                    if (!string.IsNullOrEmpty(it.LogicalName))
                    {
                        list.Add(new KeyValuePair <string, GXObisCode>(it.LogicalName, it));
                    }
                }
                try
                {
                    list.Sort(CompareOBISKeys);
                }
                catch
                {
                    //This fails if there is empty key. Remove key.
                }
                bool bSelected = false;
                if (collection != null)
                {
                    foreach (KeyValuePair <string, GXObisCode> it in list)
                    {
                        ListViewItem item = AddItem(it.Value);
                        if (!bSelected && Interface == it.Value.ObjectType && it.Value.LogicalName == selectedLN)
                        {
                            bSelected = item.Selected = true;
                        }
                    }
                }

                bool bEnabled = this.OBISCodesList.Items.Count != 0;
                EditBtn.Enabled = RemoveBtn.Enabled = bEnabled;
                if (!bSelected && bEnabled)
                {
                    this.OBISCodesList.Items[0].Selected = true;
                }
            }
            this.OBISCodesList.Select();
        }
Пример #4
0
 public OBISCodeForm(GXObisCodeCollection collection, GXObisCode item)
 {
     InitializeComponent();
     OriginalTarget = item;
     //Create clone from original items.
     MemoryStream ms = new MemoryStream();
     BinaryFormatter bf = new BinaryFormatter();
     bf.Serialize(ms, item);
     ms.Position = 0;
     Target = (GXObisCode)bf.Deserialize(ms);
     ms.Close();
     ObisCodeCollection = collection;
     ShowInterfaces();
     if (Target.ObjectType == ObjectType.None)
     {
         InterfaceCB.SelectedIndex = 0;
     }
     else
     {
         InterfaceCB.SelectedItem = Target.ObjectType;
     }
     UpdateTarget();
 }
Пример #5
0
        void ShowOBISCOdes(GXObisCodeCollection collection, ObjectType Interface, string selectedLN)
        {
            Items.Clear();
            this.OBISCodesList.Items.Clear();
            if (collection != null)
            {
            List<KeyValuePair<string, GXObisCode>> list = new List<KeyValuePair<string, GXObisCode>>();
            foreach (GXObisCode it in collection)
            {
                if (!string.IsNullOrEmpty(it.LogicalName))
                {
                    list.Add(new KeyValuePair<string, GXObisCode>(it.LogicalName, it));
                }
            }
            try
            {
                list.Sort(CompareOBISKeys);
            }
            catch
            {
                //This fails if there is empty key. Remove key.
            }
            bool bSelected = false;
            if (collection != null)
            {
                foreach (KeyValuePair<string, GXObisCode> it in list)
                {
                    ListViewItem item = AddItem(it.Value);
                    if (!bSelected && Interface == it.Value.ObjectType && it.Value.LogicalName == selectedLN)
                    {
                        bSelected = item.Selected = true;
                    }
                }
            }

            bool bEnabled = this.OBISCodesList.Items.Count != 0;
            EditBtn.Enabled = RemoveBtn.Enabled = bEnabled;
            if (!bSelected && bEnabled)
            {
                this.OBISCodesList.Items[0].Selected = true;
            }
            }
            this.OBISCodesList.Select();
        }
Пример #6
0
        private static List <GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> > GetColumns(GXDLMSObjectCollection objects, GXObisCodeCollection obisCodes, string ln, int type)
        {
            List <GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> > list = new List <GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> >();

            //Event Logbook
            if (ln == "7.0.99.98.0.255")
            {
                //If meter.
                if (type == 2)
                {
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.15.2.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.11.2.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.1.96.5.1.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.AssociationLogicalName, "0.0.40.0.0.255", 11));
                }
                else
                {
                    //If concentrator.
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.15.2.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.11.2.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.AssociationLogicalName, "0.0.40.0.0.255", 11));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.GSMDiagnostic, "0.0.25.6.0.255", 5));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.GSMDiagnostic, "0.0.25.6.0.255", 6));
                }
            }
            else if (ln == "7.0.99.99.3.255")
            {
                //If meter.
                if (type == 2)
                {
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.1.96.5.1.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.13.2.0.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.12.2.0.255", 2));
                }
                else
                {
                    //If concentrator.
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                    list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.1.96.5.1.255", 2));
                }
            }
            else if (ln == "7.0.99.98.1.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.11.1.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.15.1.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.AssociationLogicalName, "0.0.40.0.0.255", 11));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.13.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.1.96.5.1.255", 2));
            }
            else if (ln == "7.0.99.98.6.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.15.3.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.0.96.5.1.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.5.4.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.24.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.23.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.13.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.15.255", 2));
            }
            else if (ln == "7.0.99.16.0.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.15.1.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.ParameterMonitor, "0.0.16.2.0.255", 2));
            }
            else if (ln == "7.0.98.11.0.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.0.96.5.1.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.0.96.10.2.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "7.0.0.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.13.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.13.2.1.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.13.2.2.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.13.2.3.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Register, "7.0.12.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.ExtendedRegister, "7.0.43.45.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.ExtendedRegister, "7.0.43.45.0.255", 5));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.TariffPlan, "0.0.94.39.21.255", 2));
            }
            //Not Enrolled Detected List
            else if (ln == "0.0.21.0.1.255" ||
                     //Enrolled Detected List
                     ln == "0.1.21.0.1.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.36.255", 2, DataType.DateTime));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.35.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.23.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.34.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.38.255", 2));
            }
            // White list
            else if (ln == "0.0.21.0.2.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.13.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.15.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.39.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
            }
            // Bloack list
            else if (ln == "0.0.21.0.3.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
            }
            // Command Queue
            else if (ln == "0.0.21.0.10.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.45.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.27.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.50.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.28.255", 2));
            }
            // Directory event logbook
            else if (ln == "7.0.99.98.3.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.15.4.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.96.11.4.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.1.25.2.0.255", 2));
            }
            //Push Data Queue.
            else if (ln == "0.0.98.1.0.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.50.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.23.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.24.255", 2));
            }
            //Response Queue
            else if (ln == "0.0.21.0.11.255")
            {
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.1.1.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.MacAddressSetup, "0.1.25.2.0.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.27.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.29.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.50.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.23.255", 2));
                list.Add(CreateColumn(objects, obisCodes, ObjectType.Data, "0.0.94.39.24.255", 2));
            }
            return(list);
        }
Пример #7
0
        private static GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> CreateColumn(GXDLMSObjectCollection objects, GXObisCodeCollection obisCodes, ObjectType ot, string ln, int index, DataType dt)
        {
            GXDLMSObject obj = objects.FindByLN(ot, ln);

            if (obj == null)
            {
                GXObisCode code = obisCodes.FindByLN(ot, ln, null);
                obj             = GXDLMSClient.CreateObject(ot);
                obj.LogicalName = ln;
                if (code != null)
                {
                    GXDLMSAttributeSettings s = code.Attributes.Find(index);
                    if (s != null)
                    {
                        obj.SetDataType(index, s.Type);
                        obj.SetUIDataType(index, s.UIType);
                        obj.SetValues(index, s.Values);
                    }
                }
                else
                {
                    obj.SetUIDataType(index, dt);
                }
            }
            return(new GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(index, 0)));
        }
Пример #8
0
 private static GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> CreateColumn(GXDLMSObjectCollection objects, GXObisCodeCollection obisCodes, ObjectType ot, string ln, int index)
 {
     return(CreateColumn(objects, obisCodes, ot, ln, index, DataType.None));
 }