You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/02/07 16:08:03 UTC

[incubator-plc4x] branch feature/Beckhoff_ADS_protocol updated: solved a couple of todos and added some new

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch feature/Beckhoff_ADS_protocol
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/feature/Beckhoff_ADS_protocol by this push:
     new 594ec25  solved a couple of todos and added some new
594ec25 is described below

commit 594ec254c1ba9c4801993dfe1c9907ebd489ccd3
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Feb 7 17:07:58 2018 +0100

    solved a couple of todos and added some new
---
 .../apache/plc4x/java/ads/netty/Plc4XADSProtocol.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java
index daa93d2..9e46113 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/Plc4XADSProtocol.java
@@ -21,7 +21,9 @@ package org.apache.plc4x.java.ads.netty;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.MessageToMessageCodec;
 import org.apache.plc4x.java.ads.api.commands.ADSReadRequest;
+import org.apache.plc4x.java.ads.api.commands.ADSReadResponse;
 import org.apache.plc4x.java.ads.api.commands.ADSWriteRequest;
+import org.apache.plc4x.java.ads.api.commands.ADSWriteResponse;
 import org.apache.plc4x.java.ads.api.commands.types.Data;
 import org.apache.plc4x.java.ads.api.commands.types.IndexGroup;
 import org.apache.plc4x.java.ads.api.commands.types.IndexOffset;
@@ -77,7 +79,11 @@ public class Plc4XADSProtocol extends MessageToMessageCodec<AMSTCPPaket, PlcRequ
 
     @Override
     protected void decode(ChannelHandlerContext channelHandlerContext, AMSTCPPaket amstcpPaket, List<Object> out) throws Exception {
-        // TODO: implement me
+        if (amstcpPaket instanceof ADSReadResponse) {
+            // TODO: implement me
+        } else if (amstcpPaket instanceof ADSWriteResponse) {
+            // TODO: implement me
+        }
     }
 
     private void encodeWriteRequest(PlcRequestContainer msg, List<Object> out) throws PlcException {
@@ -91,12 +97,9 @@ public class Plc4XADSProtocol extends MessageToMessageCodec<AMSTCPPaket, PlcRequ
             throw new PlcProtocolException("Address not of type ADSAddress: " + address.getClass());
         }
         ADSAddress adsAddress = (ADSAddress) address;
-        // TODO: we need a long parser her
-        Invoke invokeId = Invoke.of((byte) correlationBuilder.incrementAndGet());
-        // TODO: we need a long parser her
-        IndexGroup indexGroup = IndexGroup.of((byte) adsAddress.getIndexGroup());
-        // TODO: we need a long parser her
-        IndexOffset indexOffset = IndexOffset.of((byte) adsAddress.getIndexOffset());
+        Invoke invokeId = Invoke.of(correlationBuilder.incrementAndGet());
+        IndexGroup indexGroup = IndexGroup.of(adsAddress.getIndexGroup());
+        IndexOffset indexOffset = IndexOffset.of(adsAddress.getIndexOffset());
         // TODO: how to get length and data. Serialization of plc is the problem here
         Length length = Length.of(1);
         Data data = Data.of(new byte[]{0x42});

-- 
To stop receiving notification emails like this one, please contact
sruehl@apache.org.