コード例 #1
0
 private void Init(DeviceConfigurationAdapter deviceConfig)
 {
     _deviceProxy     = new DeviceProxy(deviceConfig);
     _udpListener     = new UdpListener(deviceConfig.UdpPort, SendMessage);
     _webSocketClient = new WebSocketClient(deviceConfig.WebSocketClientConfig.ServerUrl, ReceiveMessage);
     _healthThread    = new HealthThread(CheckServerConnection, ReopenServerConnection);
 }
コード例 #2
0
 public DeviceProxy(DeviceConfigurationAdapter deviceConfig)
 {
     Device = new Device()
     {
         DN                = deviceConfig.DeviceId,
         Password          = deviceConfig.Password,
         Model             = deviceConfig.DeviceModel,
         ConnectionModel   = deviceConfig.ConnectionModel,
         CommunicationType = CommunicationType.Tcp,
         IpAddress         = deviceConfig.TcpAddress,
         IpPort            = deviceConfig.TcpPort,
     };
 }
コード例 #3
0
        public static DeviceConfigurationAdapter CreateConfiguration()
        {
            var config = new DeviceConfigurationAdapter()
            {
                DeviceId              = ConfigurationManager.AppSettings["DeviceId"].ToInt32(),
                Password              = ConfigurationManager.AppSettings["Password"],
                DeviceModel           = "ZDC2911",
                ConnectionModel       = 5,
                DeviceName            = "",
                TcpPort               = ConfigurationManager.AppSettings["TcpPort"].ToInt32(),
                TcpAddress            = ConfigurationManager.AppSettings["TcpAddress"],
                UdpPort               = ConfigurationManager.AppSettings["UdpPort"].ToInt32(),
                WebSocketClientConfig = new WebSocketClientConfig()
                {
                    ServerUrl = ConfigurationManager.AppSettings["WebSocketServerUrl"]
                },
            };

            return(config);
        }