You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
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<FireMsg>(bytes02, FireMgr.FireMsg, EndingConst.ByteSeq.AB,
|
|
EndingConst.WordSeq.DC);
|
|
}
|
|
|
|
if (bytes02 != null)
|
|
{
|
|
FireMgr.DataValidityTime = DateTime.Now;
|
|
|
|
//ModbusDecoder.Decode<UpsRemoteComm>(bytes02, UpsMgr.UpsRemoteComm, EndingConst.ByteSeq.AB,
|
|
// EndingConst.WordSeq.DC);
|
|
}
|
|
}
|
|
} |