You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2018/01/08 03:17:57 UTC
[incubator-plc4x] 01/06: mask slot number
This is an automated email from the ASF dual-hosted git repository.
jmclean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 74617fc50da51dca38bda4b4bdce890d7c113669
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Mon Jan 8 11:13:13 2018 +1100
mask slot number
---
.../java/org/apache/plc4x/java/isotp/netty/IsoTPProtocol.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocol.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocol.java
index bdaa722..7033777 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocol.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocol.java
@@ -270,8 +270,7 @@ public class IsoTPProtocol extends MessageToMessageCodec<IsoOnTcpMessage, Tpdu>
case CALLING_TSAP:
TsapParameter tsap = (TsapParameter) parameter;
out.writeByte(tsap.getDeviceGroup().getCode());
- out.writeByte((byte)
- ((tsap.getRackNumber() << 4) | (tsap.getSlotNumber())));
+ out.writeByte((byte) ((tsap.getRackNumber() << 4) | (tsap.getSlotNumber() & 0x0F)));
break;
case CHECKSUM:
ChecksumParameter checksum = (ChecksumParameter) parameter;
@@ -392,9 +391,9 @@ public class IsoTPProtocol extends MessageToMessageCodec<IsoOnTcpMessage, Tpdu>
private Parameter parseCallParameter(ByteBuf out, ParameterCode parameterCode) {
DeviceGroup deviceGroup = DeviceGroup.valueOf(out.readByte());
- byte tmp = out.readByte();
- byte rackId = (byte) ((tmp & 0xF0) >> 4);
- byte slotId = (byte) (tmp & 0x0F);
+ byte rackAndSlot = out.readByte();
+ byte rackId = (byte) ((rackAndSlot & 0xF0) >> 4);
+ byte slotId = (byte) (rackAndSlot & 0x0F);
switch (parameterCode) {
case CALLING_TSAP:
return new CallingTsapParameter(deviceGroup, rackId, slotId);
--
To stop receiving notification emails like this one, please contact
"commits@plc4x.apache.org" <co...@plc4x.apache.org>.