/// <summary> /// Initializes a new instance of the <see cref="ModbusController"/> class. /// </summary> /// <param name="client">The Modbus client instance.</param> /// <param name="options">The application options.</param> /// <param name="logger">The application _logger.</param> public ModbusController(IRtuClient client, IOptions <AppSettings> options, ILogger <ModbusController> logger) : base(logger, options) { _client = client; }
/// <summary> /// Initializes a new instance of the <see cref="RtuCommand"/> class. /// Selected properties are initialized with data from the AppSettings instance. /// </summary> /// <param name="client">The Modbus client instance.</param> /// <param name="logger">The logger instance.</param> /// <param name="options">The setting options instance.</param> /// <param name="environment">The hosting environment instance.</param> public RtuCommand(IRtuClient client, ILogger <RtuCommand> logger, IOptions <AppSettings> options, IHostingEnvironment environment) : base(logger, options, environment) { _logger.LogDebug("RtuCommand()"); SerialPort = _settings.RtuMaster.SerialPort; Baudrate = _settings.RtuMaster.Baudrate; Parity = _settings.RtuMaster.Parity; DataBits = _settings.RtuMaster.DataBits; StopBits = _settings.RtuMaster.StopBits; ReadTimeout = _settings.RtuMaster.ReadTimeout; WriteTimeout = _settings.RtuMaster.WriteTimeout; SlaveID = _settings.RtuSlave.ID; // Setting the RTU client instance. _client = client; }
/// <summary> /// Initializes a new instance of the <see cref="ROSingleController"/> class. /// </summary> /// <param name="client">The Modbus client instance.</param> /// <param name="options">The application options.</param> /// <param name="logger">The application logger.</param> public ROSingleController(IRtuClient client, IOptions <AppSettings> options, ILogger <CoilController> logger) : base(client, options, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="InputRegistersController"/> class. /// </summary> /// <param name="client">The Modbus client instance.</param> /// <param name="options">The application options.</param> /// <param name="logger">The application logger.</param> public InputRegistersController(IRtuClient client, IOptions <AppSettings> options, ILogger <CoilController> logger) : base(client, options, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="DiscreteInputsController"/> class. /// </summary> /// <param name="client">The Modbus client instance.</param> /// <param name="options">The application options.</param> /// <param name="logger">The application logger.</param> public DiscreteInputsController(IRtuClient client, IOptions <AppSettings> options, ILogger <CoilController> logger) : base(client, options, logger) { }