|
|
|
@ -27,8 +27,9 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
WordSeq= EndingConst.WordSeq.CD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BatchRead(ModbusTcpMaster master)
|
|
|
|
|
private bool BatchRead(ModbusTcpMaster master)
|
|
|
|
|
{
|
|
|
|
|
bool connectResult = false;
|
|
|
|
|
//1电表
|
|
|
|
|
//2消防
|
|
|
|
|
//3温湿度
|
|
|
|
@ -39,6 +40,7 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
var readPowerValue = master.Read("x=3;39424", 2).Content;
|
|
|
|
|
if (readPowerValue != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
Array.Reverse(readPowerValue);
|
|
|
|
|
//ModbusDecoder.Decode<PowerValue>(readPowerValue, FireControlMgr.PowerValue, EndingConst.ByteSeq.BA, EndingConst.WordSeq.DC);
|
|
|
|
|
FireControlMgr.PowerValue.FPowerValue.Value=BitConverter.ToSingle(readPowerValue, 0);
|
|
|
|
@ -51,6 +53,7 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
var readTem = master.Read("s=3;x=3;0", 2).Content;
|
|
|
|
|
if (readTem!=null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
ModbusDecoder.Decode<TemperatureHumidity>(readTem, FireControlMgr.TemperatureHumidity, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -67,6 +70,7 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
var bytesAdd2 = master.Read("s=2;x=4;3048", 1048).Content;//0x04 可以
|
|
|
|
|
if (bytesAdd1 != null && bytesAdd2 != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
bytes06.AddRange(bytesAdd1);
|
|
|
|
|
bytes06.AddRange(bytesAdd2);
|
|
|
|
|
}
|
|
|
|
@ -79,6 +83,7 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
if (bytes02 != null)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("fire read bytes02 success");
|
|
|
|
|
connectResult = true;
|
|
|
|
|
FireControlMgr.Subzone2.GiveAnAlarm.Value = bytes02[0];
|
|
|
|
|
FireControlMgr.Subzone2.NumberOfFailures.Value = bytes02[1];
|
|
|
|
|
FireControlMgr.Subzone2.SoundSuppression.Value = bytes02[2];
|
|
|
|
@ -100,11 +105,13 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
|
|
|
|
|
if (bytes03 != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
ModbusDecoder.Decode<Subzone3>(bytes03, FireControlMgr.Subzone3, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bytes04 != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
ModbusDecoder.Decode<Subzone4>(bytes04, FireControlMgr.Subzone4, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
List<string> faultList = new List<string>()
|
|
|
|
|
{
|
|
|
|
@ -144,16 +151,19 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
|
|
|
|
|
if (bytes05 != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
ModbusDecoder.Decode<Subzone5>(bytes05, FireControlMgr.Subzone5, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bytes06 != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
ModbusDecoder.Decode<Subzone6>(bytes06.ToArray(), FireControlMgr.Subzone6, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bytes07 != null)
|
|
|
|
|
{
|
|
|
|
|
connectResult = true;
|
|
|
|
|
ModbusDecoder.Decode<Subzone7>(bytes07, FireControlMgr.Subzone7, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -167,6 +177,7 @@ public class FireControlClient: ModbusTcpMaster
|
|
|
|
|
ModbusDecoder.Decode<Subzone9>(bytes09, FireControlMgr.Subzone9, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
return connectResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SaveAlarmInfo(List<string> lstAlarm)
|
|
|
|
|