/// <summary> /// initialize config /// </summary> private void InitializeConfiguration() { config = new PLCDeviceMonitor.DeviceMonitorConfig(); config.LogicalStationNum = Properties.Settings.Default.LogicalStationNum; config.MonitorInterval = Properties.Settings.Default.MoniterInterval; config.RecordConfigFilename = Properties.Settings.Default.RecordConfigFilename; config.BackupFilename = Properties.Settings.Default.BackupFilename; config.DBConnectionString = Properties.Settings.Default.OracleDB; config.DBRetryInterval = Properties.Settings.Default.DBRetryInterval; config.DBRetryTimes = Properties.Settings.Default.DBRetryTimes; config.MsgFormatter = Properties.Settings.Default.MsgFormatter; config.ValidatePlateCode = Properties.Settings.Default.ValidatePlateCode; config.ValidateBoxCode = Properties.Settings.Default.ValidateBoxCode; config.ValidateRecordNum = Properties.Settings.Default.ValidateRecordNum; config.LogFilename = Properties.Settings.Default.LogFilename; config.LogFormatter = Properties.Settings.Default.LogFormatter; }
/// <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); }
/// <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; }
/// <summary> /// initialize config /// </summary> private void InitializeConfiguration() { config = new PLCDeviceMonitor.DeviceMonitorConfig(); config.LogicalStationNum = Properties.Settings.Default.LogicalStationNum; config.MonitorInterval = Properties.Settings.Default.MoniterInterval; config.RecordConfigFilename = Properties.Settings.Default.RecordConfigFilename; config.BackupFilename = Properties.Settings.Default.BackupFilename; config.DBConnectionString = Properties.Settings.Default.OracleDB; config.DBRetryInterval = Properties.Settings.Default.DBRetryInterval; config.DBRetryTimes = Properties.Settings.Default.DBRetryTimes; config.MsgFormatter = Properties.Settings.Default.MsgFormatter; config.ValidatePlateCode = Properties.Settings.Default.ValidatePlateCode; config.ValidateBoxCode = Properties.Settings.Default.ValidateBoxCode; config.ValidateRecordNum = Properties.Settings.Default.ValidateRecordNum; config.LogFilename = Properties.Settings.Default.LogFilename; config.LogFormatter = Properties.Settings.Default.LogFormatter; }