IModbusTcpSlaverService.cs 870 B

12345678910111213141516171819202122232425262728
  1. using NModbus;
  2. using System;
  3. using Team.Utility;
  4. namespace Team.Communicate.Modbus
  5. {
  6. public interface IModbusTcpSlaverService:IDisposable
  7. {
  8. /// <summary>
  9. /// create and start the TCP slave
  10. /// 默认创建所有监听所有网卡ip地址和localhost
  11. /// 默认端口号为502
  12. /// 默认slaveId为1
  13. /// </summary>
  14. void CreateModbusTcpSlave(string ip = default, byte slaveId = 1, int port = 502);
  15. IModbusSlave GetModbusSlaveByIp();
  16. void WriteParameter(ushort startAddress, ushort value);
  17. void WriteParameter(ushort startAddress, short value);
  18. event EventHandler<StorageEventArgs<bool>> CoilDiscretesHandler;
  19. event EventHandler<StorageEventArgs<ushort>> InputRegistersHandler;
  20. event EventHandler<StorageEventArgs<ushort>> HoldeRegistersHandler;
  21. }
  22. }