示例#1
0
        /// <summary>
        /// Set Parameters, it will initialize the connection
        /// </summary>
        /// <param name="cfg"></param>
        public void SetParameters(DeviceConfig cfg)
        {
            if (cfg.UsingComPort)       // use tcp ip only
            {
                throw new Exception("Wrong Configuration Data");
            }
            bool portOpen = IsOpen;

            if (portOpen)
            {
                Close();
            }
            mIp   = cfg.Network.IPAddress;
            mPort = cfg.Network.NetworkPort;
            if (portOpen)
            {
                Open();
            }
        }
示例#2
0
        /// <summary>
        /// Set Parameters, it will initialize the connection
        /// </summary>
        /// <param name="cfg"></param>
        public void SetParameters(DeviceConfig cfg)
        {
            if (!cfg.UsingComPort)
            {
                throw new Exception("Wrong Configuration Data");
            }
            bool portOpen = IsOpen;

            if (portOpen)
            {
                Close();
            }
            mPort.PortName = cfg.PortData.portName;
            mPort.BaudRate = cfg.PortData.baudRate;
            if (portOpen)
            {
                Open();
            }
        }
示例#3
0
        /// <summary>
        /// Set Parameters, it will initialize the connection
        /// </summary>
        /// <param name="cfg"></param>
        public void SetParameters(DeviceConfig cfg)
        {
            if (mCom != null)
            {
                mCom.Close();
            }

            if (cfg.UsingComPort)
            {
                mCom = new ComPortWrapper();
            }
            else
            {
                mCom = new TcpWrapper();
            }

            mCom.SetParameters(cfg);
            mCom.OnConnectStatusChange += new UpdateMessageHandler(OnConnectionStatusChanged);
        }
示例#4
0
 /// <summary>
 /// Set Parameters, it will initialize the connection
 /// </summary>
 /// <param name="cfg"></param>
 public void SetParameters(DeviceConfig cfg)
 {
     if (cfg.UsingComPort)       // use tcp ip only
     {
         throw new Exception("Wrong Configuration Data");
     }
     bool portOpen = IsOpen;
     if (portOpen)
     {
         Close();
     }
     mIp  = cfg.Network.IPAddress;
     mPort = cfg.Network.NetworkPort;
     if (portOpen)
     {
         Open();
     }
 }
 public DeviceConfig Clone()
 {
     DeviceConfig cfg = new DeviceConfig();
     cfg.PortData.baudRate = PortData.baudRate;
     cfg.PortData.portName = PortData.portName;
     cfg.Network.IPAddress = Network.IPAddress;
     cfg.Network.NetworkPort = Network.NetworkPort;
     cfg.UsingComPort = UsingComPort;
     return cfg;
 }
 /// <summary>
 /// Set Parameters, it will initialize the connection
 /// </summary>
 /// <param name="cfg"></param>
 public void SetParameters(DeviceConfig cfg)
 {
     if (!cfg.UsingComPort)
     {
         throw new Exception("Wrong Configuration Data");
     }
     bool portOpen = IsOpen;
     if (portOpen)
     {
         Close();
     }
     mPort.PortName = cfg.PortData.portName;
     mPort.BaudRate = cfg.PortData.baudRate;
     if (portOpen)
     {
         Open();
     }
 }
        /// <summary>
        /// Set Parameters, it will initialize the connection
        /// </summary>
        /// <param name="cfg"></param>
        public void SetParameters(DeviceConfig cfg)
        {
            if (mCom != null)
            {
                mCom.Close();
            }

            if (cfg.UsingComPort)
            {
                mCom = new ComPortWrapper();
            }
            else
            {
                mCom = new TcpWrapper();
            }

            mCom.SetParameters(cfg);
            mCom.OnConnectStatusChange += new UpdateMessageHandler(OnConnectionStatusChanged);
        }