Hi Martin, first, thanks for your work and in-depth analysis. Unfortunetly, the original Author of the ADS driver (Sebastian) is currently pretty busy and thus mostly unavailable.
Generally speaking, if you're able to write a fixed version of the code you can issue a pull request (but we should nonetheless file a bug for that in jira). Perhaps we should contact the Beckhoff guys... Christofer Dutz has a good contact there, or chris? Otherwise perhaps we should add a switch to enable that (possibly intentionally wrong) behavior? What do others think? Julian Am 21.06.19, 11:42 schrieb "Martin Illecker" <martin.illec...@gmail.com>: Hello, I was able to find the real issue. For some reason the response of the PLC seems not to be in *LITTLE_ENDIAN* format. Therefore, the Byte to Integer conversion in [1] results in a negative number. It occurs during the *symbolHandle *creation in [2]. I had also a look at the ADS specification and the response should be in *LITTLE_ENDIAN* format. So how can I fix this behavior or is it possible to support also the Big-Endian-Format? Thanks! Best regards Martin [1] https://github.com/apache/plc4x/blob/develop/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java#L39 [2] https://github.com/apache/plc4x/blob/develop/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java#L187 [3] https://infosys.beckhoff.com/index.php?content=../content/1031/tcplclibutilities/html/TcPlcLibUtilities_AddOn_ByteOrder.htm&id= Am Mi., 19. Juni 2019 um 15:06 Uhr schrieb Martin Illecker < martin.illec...@gmail.com>: > Hello, > > I was trying to read a value from ADS, but I got stuck with the following > error message: > > Exception in thread "main" java.lang.IllegalArgumentException: Value must > between 0 and 4.294967296E9. Was -830472190 > at > org.apache.plc4x.java.ads.api.util.ByteValue.checkUnsignedBounds(ByteValue.java:52) > at > org.apache.plc4x.java.ads.model.DirectAdsField.<init>(DirectAdsField.java:47) > at > org.apache.plc4x.java.ads.model.DirectAdsField.of(DirectAdsField.java:57) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.lambda$mapFields$3(AdsAbstractPlcConnection.java:188) > at > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.mapFields(AdsAbstractPlcConnection.java:163) > at > java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) > at > java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) > at > java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) > at > java.base/java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1239) > at > java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) > at > java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290) > at > java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746) > at > java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) > at > java.base/java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:408) > at > java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:736) > at > java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159) > at > java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173) > at > java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) > at > java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.mapFields(AdsAbstractPlcConnection.java:157) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.read(AdsAbstractPlcConnection.java:103) > at > org.apache.plc4x.java.base.messages.DefaultPlcReadRequest.execute(DefaultPlcReadRequest.java:44) > at plc4x.HelloADS.main(HelloADS.java:43) > > Please find attached my Java source code and debug screenshots. > > Best regards > Martin > >