[incubator-plc4x] branch master updated: - Further updates to the DeltaV POC code ....
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/master by this push: new 3a59b41 - Further updates to the DeltaV POC code 3a59b41 is described below commit 3a59b41ac28327b2d6f9dd193c10287a084d3bfc Author: Christofer Dutz AuthorDate: Wed Oct 10 12:13:28 2018 +0200 - Further updates to the DeltaV POC code --- .../java/org/apache/plc4x/java/deltav/PoC.java | 452 +++-- 1 file changed, 328 insertions(+), 124 deletions(-) diff --git a/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java b/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java index 4c7dd31..723089b 100644 --- a/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java +++ b/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java @@ -1,22 +1,3 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - */ - package org.apache.plc4x.java.deltav; import io.netty.buffer.ByteBuf; @@ -27,7 +8,9 @@ import org.pcap4j.packet.UdpPacket; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; @@ -43,27 +26,37 @@ public class PoC { private PcapHandle receiveHandle; -private PoC() throws Exception { -PcapNetworkInterface nif = null; -for (PcapNetworkInterface dev : Pcaps.findAllDevs()) { -if("en7".equals(dev.getName())) { -nif = dev; -break; +private PoC(String inputPath) throws Exception { +if(inputPath == null) { +PcapNetworkInterface nif = null; +for (PcapNetworkInterface dev : Pcaps.findAllDevs()) { +if ("en7".equals(dev.getName())) { +nif = dev; +break; +} } -} -if(nif == null) { -throw new RuntimeException("Couldn't find network device"); -} +if(nif == null) { +throw new RuntimeException("Couldn't find network device"); +} + +// Setup receiving of packets and redirecting them to the corresponding listeners. +// Filter packets to contain only the ip protocol number of the current protocol. +receiveHandle = nif.openLive(SNAPLEN, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, READ_TIMEOUT); +} else { +File input = new File(inputPath); +if(!input.exists() || !input.isFile()) { +throw new RuntimeException("Couldn't open the pcap file as it doesn't seem to exist."); +} -// Setup receiving of packets and redirecting them to the corresponding listeners. -// Filter packets to contain only the ip protocol number of the current protocol. -receiveHandle = nif.openLive(SNAPLEN, PcapNetworkInterface.PromiscuousMode.PROMISCUOUS, READ_TIMEOUT); +receiveHandle = Pcaps.openOffline(input.getAbsolutePath(), PcapHandle.TimestampPrecision.NANO); +} // Set the filter. String filterString = "udp port 18507"; receiveHandle.setFilter(filterString, BpfProgram.BpfCompileMode.OPTIMIZE); +Map names = new HashMap<>(); Map values = new HashMap<>(); byte[] timeBytes = ByteBuffer.allocate(8).putLong(System.currentTimeMillis()).array(); @@ -102,8 +95,8 @@ public class PoC { // // 02 01 00 00 00 00 00 65 01 de 00 18 00 00 00 00 // 00 00 00 00 -System.out.println("Got 0x" + Hex.encodeHexString(new byte[]{(byte)(payloadType >> 8), (byte)(payloadType & 0xFF)}) + " packet from " + senderId); -outputPacket(buf); +//System.out.println("Got 0x" + Hex.encodeHexString(new byte[]{(byte)(payloadType >> 8), (byte)(payloadType & 0xFF)}) +
[incubator-plc4x] 02/02: PLC4X-61 - Installation fails plc4j-protocoll-ethernetip needs license
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit 8aff258e9d73ca18766abff98ab3ed1ac129c0b4 Author: Christofer Dutz AuthorDate: Wed Oct 10 16:37:54 2018 +0200 PLC4X-61 - Installation fails plc4j-protocoll-ethernetip needs license - Added an exclusion for "*.pcapng" files, even if it should be detected as binary and hereby ignored. --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 6c38b27..63d6ea7 100644 --- a/pom.xml +++ b/pom.xml @@ -374,6 +374,9 @@ **/.idea/** **/*.iml + +**/*.pcapng + **/.asciidoctor/**
[incubator-plc4x] branch master updated (62df682 -> 8aff258)
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. from 62df682 - Added the Apache header back ... new 6a3e8c5 PLC4X-59 - [S7] Reading a UDINT with value 0x and non positive floating point values does not work - Fixed a copy+paste error (I hope) new 8aff258 PLC4X-61 - Installation fails plc4j-protocoll-ethernetip needs license The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/plc4x/java/base/messages/items/DefaultLongFieldItem.java| 2 +- pom.xml| 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
[incubator-plc4x] 01/02: PLC4X-59 - [S7] Reading a UDINT with value 0x00000000 and non positive floating point values does not work - Fixed a copy+paste error (I hope)
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit 6a3e8c5fabba1ad55942ada8879b8563ab594d55 Author: Christofer Dutz AuthorDate: Wed Oct 10 16:34:53 2018 +0200 PLC4X-59 - [S7] Reading a UDINT with value 0x and non positive floating point values does not work - Fixed a copy+paste error (I hope) --- .../org/apache/plc4x/java/base/messages/items/DefaultLongFieldItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/items/DefaultLongFieldItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/items/DefaultLongFieldItem.java index 2fb238c..ff2e5e0 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/items/DefaultLongFieldItem.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/items/DefaultLongFieldItem.java @@ -106,7 +106,7 @@ public class DefaultLongFieldItem extends FieldItem { @Override public Long getLong(int index) { -if (isValidFloat(index)) { +if (isValidLong(index)) { return getValue(index); } return null;
[incubator-plc4x] branch master updated: - Added the Apache header back ...
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/master by this push: new 62df682 - Added the Apache header back ... 62df682 is described below commit 62df6823b1cce97cb7d0337955cb1c9f9c0d2f51 Author: Christofer Dutz AuthorDate: Wed Oct 10 15:54:48 2018 +0200 - Added the Apache header back ... --- .../test/java/org/apache/plc4x/java/deltav/PoC.java| 18 ++ 1 file changed, 18 insertions(+) diff --git a/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java b/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java index 723089b..d08eaa4 100644 --- a/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java +++ b/plc4j/protocols/delta-v/src/test/java/org/apache/plc4x/java/deltav/PoC.java @@ -1,3 +1,21 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ package org.apache.plc4x.java.deltav; import io.netty.buffer.ByteBuf;