/// <summary> /// Modbus RTU master factory method. /// </summary> public static ModbusSerialMaster CreateRtu(ISerialResource serialResource) { if (serialResource == null) throw new ArgumentNullException("serialResource"); InitializeTimeouts(serialResource); return new ModbusSerialMaster(new ModbusRtuTransport(serialResource)); }
/// <summary> /// Initializes a new instance of the <see cref="ModbusSerialTransport"/> class. /// </summary> /// <param name="serialResource">The serial resource.</param> internal ModbusSerialTransport(ISerialResource serialResource) { if (serialResource == null) { throw new ArgumentNullException("serialResource"); } _serialResource = serialResource; }
/// <summary> /// Modbus RTU master factory method. /// </summary> public static ModbusSerialMaster CreateRtu(ISerialResource serialResource) { if (serialResource == null) { throw new ArgumentNullException("serialResource"); } InitializeTimeouts(serialResource); return(new ModbusSerialMaster(new ModbusRtuTransport(serialResource))); }
internal ModbusAsciiTransport(ISerialResource serialResource) : base(serialResource) { serialResource.NewLine = Environment.NewLine; }
public ModbusRtuTransport(ISerialResource serialResource) : base(serialResource) { }
/// <summary> /// Initializes serial port read write timeouts to default value if they have not been overridden already. /// </summary> internal static void InitializeTimeouts(ISerialResource serialResource) { serialResource.WriteTimeout = serialResource.WriteTimeout == serialResource.InfiniteTimeout ? Modbus.DefaultTimeout : serialResource.WriteTimeout; serialResource.ReadTimeout = serialResource.ReadTimeout == serialResource.InfiniteTimeout ? Modbus.DefaultTimeout : serialResource.ReadTimeout; }