using InnovEnergy.Lib.Protocols.Modbus.Channels; using InnovEnergy.Lib.Protocols.Modbus.Clients; /*namespace InnovEnergy.Lib.Protocols.Modbus.Slaves; public static class ModbusSlave { public static Func ModbusTcp(this Channel channel) { ModbusTcpClient SlaveId(Byte slaveId) => new ModbusTcpClient(channel, slaveId); return SlaveId; } public static Func ModbusRtu(this Channel channel) { ModbusRtuClient SlaveId(Byte slaveId) => new ModbusRtuClient(channel, slaveId); return SlaveId; } public static Func ModbusTcp(this Channel channel) where R : notnull, new() { ModbusTcpClient SlaveId(Byte slaveId) { return new ModbusTcpClient(channel, slaveId); } return SlaveId; } public static Func ModbusRtu(this Channel channel) where R : notnull, new() { ModbusRtuClient SlaveId(Byte slaveId) => new ModbusRtuClient(channel, slaveId); return SlaveId; } public static ModbusDevice TcpSlave(this Channel channel, Byte slaveId) where T : notnull, new() { var client = new ModbusTcpClient(channel, slaveId); return new ModbusDevice(client); } public static ModbusDevice RtuSlave(this Channel channel, Byte slaveId) where T : notnull, new() { var client = new ModbusRtuClient(channel, slaveId); return new ModbusDevice(client); } public static ModbusDevice Slave(this ModbusClient modbusClient) where T : notnull, new() { return new ModbusDevice(modbusClient); } }*/ using InnovEnergy.Lib.Protocols.Modbus.Channels; using InnovEnergy.Lib.Protocols.Modbus.Clients; namespace InnovEnergy.Lib.Protocols.Modbus.Slaves { public static class ModbusSlave { public static Func ModbusTcp(this Channel channel) { ModbusTcpClient SlaveId(byte slaveId) => new ModbusTcpClient((TcpChannel)channel, slaveId); return SlaveId; } public static Func ModbusRtu(this Channel channel) { ModbusRtuClient SlaveId(byte slaveId) => new ModbusRtuClient(channel, slaveId); return SlaveId; } public static Func ModbusTcp(this Channel channel) where R : notnull, new() { ModbusTcpClient SlaveId(byte slaveId) { return new ModbusTcpClient((TcpChannel)channel, slaveId); } return SlaveId; } public static Func ModbusRtu(this Channel channel) where R : notnull, new() { ModbusRtuClient SlaveId(byte slaveId) => new ModbusRtuClient(channel, slaveId); return SlaveId; } public static ModbusDevice TcpSlave(this Channel channel, byte slaveId) where T : notnull, new() { var client = new ModbusTcpClient((TcpChannel)channel, slaveId); return new ModbusDevice(client); } public static ModbusDevice RtuSlave(this Channel channel, byte slaveId) where T : notnull, new() { var client = new ModbusRtuClient(channel, slaveId); return new ModbusDevice(client); } public static ModbusDevice Slave(this ModbusClient modbusClient) where T : notnull, new() { return new ModbusDevice(modbusClient); } } }