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.
|
|
|
|
using HybirdFrameworkCore.Const;
|
|
|
|
|
using HybirdFrameworkDriver.ModbusTcpMaster;
|
|
|
|
|
using Service.Humiture;
|
|
|
|
|
using Service.Humiture.Client;
|
|
|
|
|
using Service.Ups.UpsMsg;
|
|
|
|
|
|
|
|
|
|
namespace Service.Ups.Client;
|
|
|
|
|
|
|
|
|
|
public class UpsClient:ModbusTcpMaster
|
|
|
|
|
{
|
|
|
|
|
public UpsClient()
|
|
|
|
|
{
|
|
|
|
|
ReadAction = BatchRead;
|
|
|
|
|
Ip = "172.0.20.66";
|
|
|
|
|
Port = 502;
|
|
|
|
|
Duration = 1000;
|
|
|
|
|
AutoReConnect = true;
|
|
|
|
|
ByteSeq = EndingConst.ByteSeq.BA;
|
|
|
|
|
WordSeq= EndingConst.WordSeq.CD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BatchRead(ModbusTcpMaster master)
|
|
|
|
|
{
|
|
|
|
|
var bytes01 = master.BatchReadHolderRegister(0, 32);
|
|
|
|
|
if (bytes01 != null)
|
|
|
|
|
{
|
|
|
|
|
ModbusDecoder.Decode<UpsInfoMsg>(bytes01, UpsMgr.UpsInfoMsg, EndingConst.ByteSeq.AB,
|
|
|
|
|
EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|