Ejemplo n.º 1
0
 public void TestConfig()
 {
     try
     {
         PLCDeviceMonitor.DeviceMonitor monitor = PLCDeviceMonitor.DeviceMonitor.GetPLCDeviceMonitor(config);
     }
     catch (System.Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// initialize monitor
        /// </summary>
        private void InitializeMonitor(object sender, DoWorkEventArgs e)
        {
            Thread.CurrentThread.Name = "Main";

            InitializeLogger();
            Log.Info("初始化日志系统成功.");

            InitializeConfiguration();
            Log.Info("初始化配置对象成功.");

            monitor = DeviceMonitor.GetPLCDeviceMonitor(config);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// get device monitor object by given configuration
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static DeviceMonitor GetPLCDeviceMonitor(DeviceMonitorConfig config)
        {
            if (null == config)
            {
                throw new Exception("配置对象为空.");
            }

            DeviceMonitor monitor = new DeviceMonitor();

            monitor.InitializeCommComponent(config.LogicalStationNum);
            monitor.InitializeMonitorInterval(config.MonitorInterval);
            monitor.InitializeRecordLines(config.RecordConfigFilename);
            monitor.InitializeDataProcessor(
                config.BackupFilename,
                config.DBConnectionString,
                config.MsgFormatter,
                config.ValidatePlateCode,
                config.ValidateBoxCode,
                config.ValidateRecordNum,
                config.DBRetryInterval,
                config.DBRetryTimes);

            return(monitor);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// get device monitor object by given configuration
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static DeviceMonitor GetPLCDeviceMonitor(DeviceMonitorConfig config)
        {
            if (null == config)
                throw new Exception("配置对象为空.");

            DeviceMonitor monitor = new DeviceMonitor();

            monitor.InitializeCommComponent(config.LogicalStationNum);
            monitor.InitializeMonitorInterval(config.MonitorInterval);
            monitor.InitializeRecordLines(config.RecordConfigFilename);
            monitor.InitializeDataProcessor(
                config.BackupFilename,
                config.DBConnectionString,
                config.MsgFormatter,
                config.ValidatePlateCode,
                config.ValidateBoxCode,
                config.ValidateRecordNum,
                config.DBRetryInterval,
                config.DBRetryTimes);

            return monitor;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// initialize monitor
        /// </summary>
        private void InitializeMonitor(object sender, DoWorkEventArgs e)
        {
            Thread.CurrentThread.Name = "Main";

            InitializeLogger();
            Log.Info("初始化日志系统成功.");

            InitializeConfiguration();
            Log.Info("初始化配置对象成功.");

            monitor = DeviceMonitor.GetPLCDeviceMonitor(config);
        }