示例#1
0
        public void UpdateManufactureSettings(string id)
        {
            if (Manufacturer != null && string.Compare(Manufacturer.Identification, id, true) != 0)
            {
                throw new Exception(string.Format("Manufacturer type does not match. Manufacturer is {0} and it should be {1}.", id, Manufacturer.Identification));
            }
            m_Parser.InterfaceType             = InterfaceType.General;
            m_Parser.UseLogicalNameReferencing = Manufacturer.UseLN;
            //If network media is used check is manufacturer supporting IEC 62056-47
            GXServerAddress server = Manufacturer.GetServer(HDLCAddressing);

            if (this.Media is GXNet && Manufacturer.UseIEC47)
            {
                m_Parser.InterfaceType = InterfaceType.Net;
                m_Parser.ClientID      = Convert.ToUInt16(Manufacturer.GetAuthentication(m_Parser.Authentication).ClientID);
                m_Parser.ServerID      = Convert.ToUInt16(server.PhysicalAddress);
            }
            else
            {
                if (HDLCAddressing == HDLCAddressType.Custom)
                {
                    m_Parser.ClientID = Manufacturer.GetAuthentication(m_Parser.Authentication).ClientID;
                }
                else
                {
                    m_Parser.ClientID = (byte)(Convert.ToByte(Manufacturer.GetAuthentication(m_Parser.Authentication).ClientID) << 1 | 0x1);
                }
                m_Parser.ServerID = GXManufacturer.CountServerAddress(HDLCAddressing, server.Formula, server.PhysicalAddress, server.LogicalAddress);
            }
        }
示例#2
0
        public void UpdateManufactureSettings(string id)
        {
            if (Manufacturer != null && string.Compare(Manufacturer.Identification, id, true) != 0)
            {
                throw new Exception(string.Format("Manufacturer type does not match. Manufacturer is {0} and it should be {1}.", id, Manufacturer.Identification));
            }
            if (this.Media is GXNet && Manufacturer.UseIEC47)
            {
                Client.InterfaceType = InterfaceType.WRAPPER;
            }
            else
            {
                Client.InterfaceType = InterfaceType.HDLC;
            }
            Client.UseLogicalNameReferencing = Manufacturer.UseLogicalNameReferencing;
            //If network media is used check is manufacturer supporting IEC 62056-47
            GXServerAddress server = Manufacturer.GetServer(HDLCAddressing);

            Client.ClientAddress = Manufacturer.GetAuthentication(Client.Authentication).ClientAddress;
            if (HDLCAddressing == HDLCAddressType.SerialNumber)
            {
                Client.ServerAddress = GXDLMSClient.GetServerAddress(server.PhysicalAddress, server.Formula);
            }
            else
            {
                Client.ServerAddress = GXDLMSClient.GetServerAddress(server.LogicalAddress, server.PhysicalAddress);
            }
        }