终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.1 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace BPASmartClient.MorkCL.Server
  7. {
  8. /// <summary>
  9. /// 压力锅服务类
  10. /// </summary>
  11. internal class PressureCookerServer : PressureCookerSet, IModbus
  12. {
  13. public PressureCookerServer()
  14. {
  15. MyModbus = new ModbusTcp();
  16. }
  17. public void Init(string IP = "", int Port = 502, string PortName = "")
  18. {
  19. MyModbus = new ModbusTcp();
  20. MyModbus.WithModbusTcp(IP, Port).UseConnected(() =>
  21. {
  22. ((ModbusTcp)MyModbus).master.Transport.ReadTimeout = 3000;
  23. ((ModbusTcp)MyModbus).master.Transport.WriteTimeout = 3000;
  24. TaskManage.GetInstance.StartLong(new Action(() =>
  25. {
  26. Thread.Sleep(100);
  27. }), $"压力锅服务-{IP}", true);
  28. });
  29. }
  30. public void WriteValue<T>(string address, T value)
  31. {
  32. throw new NotImplementedException();
  33. }
  34. }
  35. }