public DeviceIoDriver(ISurveySettingsProvider surveySettings) { this.port = new SerialPort(surveySettings.ConnectionString) { BaudRate = 9600, DataBits = 8, Parity = Parity.None, StopBits = StopBits.One }; this.modbusMaster = ModbusSerialMaster.CreateRtu(new SerialAdapter(this.port)); this.modbusMaster.Transport.ReadTimeout = 3000; this.modbusMaster.Transport.WriteTimeout = 3000; }
public SurveyService( IDeviceIoDriver ioDriver, IDevicesConfigurationProvider configurationProvider, ISurveySettingsProvider surveySettingsProvider, ILogger logger) { this.ioDriver = ioDriver; this.configurationProvider = configurationProvider; this.surveySettingsProvider = surveySettingsProvider; this.logger = logger; this.writeQueue = new Queue <Tuple <RegisterWriteRequest, Action <bool> > >(); this.surveyStarted = false; this.surveyCompleted = true; this.writeOperationRequested = false; this.forceSurveyEvent = new ManualResetEvent(false); }
public SettingsViewModel(ISurveyService surveyService, ISurveySettingsProvider surveySettingsProvider, IDataManager dataManager, IDevicesConfigurationProvider configurationProvider) { this.surveyService = surveyService; this.surveySettingsProvider = surveySettingsProvider; this.dataManager = dataManager; this.configurationProvider = configurationProvider; surveyService.SurveyStarted = surveySettingsProvider.SurveyEnabled; this.surveyEnabled = surveySettingsProvider.SurveyEnabled; this.surveyPeriod = surveySettingsProvider.SurveyPeriodSeconds; this.portName = surveySettingsProvider.ConnectionString; this.ServerUrl = Settings.Default.SeverURL; this.UserName = Settings.Default.UserName; this.Password = Settings.Default.Password; this.mappers = new ObservableCollection <DeviceMapper>(this.configurationProvider.Mappers); this.SetWebTransfer(); }