using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Const; using HybirdFrameworkDriver.ModbusTcpMaster; using Service.Fire.Msg; namespace Service.Fire.Client; [Scope] public class FireClient: ModbusTcpMaster { public FireClient() { ReadAction = BatchRead; Ip = "192.168.3.100"; Port = 23; Duration = 1000; AutoReConnect = true; ByteSeq = EndingConst.ByteSeq.BA; WordSeq= EndingConst.WordSeq.CD; } private void BatchRead(ModbusTcpMaster master) { bool resul = Connected; var bytes01 = master.Read("x=3;1", 80).Content; var bytes02 = master.Read("x=3;1", 80).Content; if (bytes01 != null) { FireMgr.DataValidityTime = DateTime.Now; ModbusDecoder.Decode(bytes02, FireMgr.FireMsg, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC); } if (bytes02 != null) { FireMgr.DataValidityTime = DateTime.Now; //ModbusDecoder.Decode(bytes02, UpsMgr.UpsRemoteComm, EndingConst.ByteSeq.AB, // EndingConst.WordSeq.DC); } } }