|
|
@@ -68,11 +68,20 @@ namespace HKControl |
|
|
|
{ |
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
|
{ |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.IsSwipe = SiemensDicitonary[item.DeviceNum].Read<bool>("M0.0"); |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.Complete = SiemensDicitonary[item.DeviceNum].Read<bool>("M0.0"); |
|
|
|
var res = SiemensDicitonary[item.DeviceNum].Read<byte>("MB7"); |
|
|
|
|
|
|
|
DataModels[item.DeviceNum].RightWindowData.IsSwipe = SiemensDicitonary[item.DeviceNum].Read<bool>("M0.0"); |
|
|
|
DataModels[item.DeviceNum].RightWindowData.Complete = SiemensDicitonary[item.DeviceNum].Read<bool>("M0.0"); |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.IsSwipe = Get8bitValue(res, 1); |
|
|
|
DataModels[item.DeviceNum].LeftWindowData.Complete = Get8bitValue(res, 2); |
|
|
|
|
|
|
|
DataModels[item.DeviceNum].RightWindowData.IsSwipe = Get8bitValue(res, 3); |
|
|
|
DataModels[item.DeviceNum].RightWindowData.Complete = Get8bitValue(res, 4); |
|
|
|
|
|
|
|
|
|
|
|
//DataModels[item.DeviceNum].LeftWindowData.IsSwipe = SiemensDicitonary[item.DeviceNum].Read<bool>("M7.0"); |
|
|
|
//DataModels[item.DeviceNum].LeftWindowData.Complete = SiemensDicitonary[item.DeviceNum].Read<bool>("M7.1"); |
|
|
|
|
|
|
|
//DataModels[item.DeviceNum].RightWindowData.IsSwipe = SiemensDicitonary[item.DeviceNum].Read<bool>("M7.2"); |
|
|
|
//DataModels[item.DeviceNum].RightWindowData.Complete = SiemensDicitonary[item.DeviceNum].Read<bool>("M7.3"); |
|
|
|
|
|
|
|
Thread.Sleep(100); |
|
|
|
}), $"{item.DeviceNum} 号设备监听"); |
|
|
@@ -94,18 +103,22 @@ namespace HKControl |
|
|
|
switch (carNum) |
|
|
|
{ |
|
|
|
case 1: |
|
|
|
SiemensDicitonary[1].Write("M6.0", true); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
SiemensDicitonary[1].Write("M0.0", true); |
|
|
|
SiemensDicitonary[1].Write("M6.1", true); |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
SiemensDicitonary[2].Write("M6.0", true); |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
SiemensDicitonary[2].Write("M0.0", true); |
|
|
|
SiemensDicitonary[2].Write("M6.1", true); |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
SiemensDicitonary[3].Write("M6.0", true); |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
SiemensDicitonary[3].Write("M0.0", true); |
|
|
|
SiemensDicitonary[3].Write("M6.1", true); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
@@ -145,5 +158,17 @@ namespace HKControl |
|
|
|
Json<CommunicationPar>.Save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 获取字节中指定位的值 |
|
|
|
/// </summary> |
|
|
|
/// <param name="data">要获取的整数</param> |
|
|
|
/// <param name="offset">偏移量 范围(1-8)</param> |
|
|
|
/// <returns></returns> |
|
|
|
public bool Get8bitValue(byte data, byte offset) |
|
|
|
{ |
|
|
|
if (offset > 8 || offset < 1) return false; |
|
|
|
return (data & 1 << offset - 1) == 0 ? false : true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |