Re: AW: AW: How to compose Read requests for ADS Protocol with PLC4X?

2020-07-30 Thread Łukasz Dywicki
I believe so, it also gives you possiblity to run under linux and other
embedded devices in secure fashion. :-)

If you can use wireshark take a look if your requests are coming out.
For me they were sent but they never got an answer. This is clear
indication that you are missing an ADS route.

Cheers,
Łukasz

On 30.07.2020 23:22, Hillenbrand, Jonas (wbk) wrote:
> Thanks Lukasz,
> 
> 
> I will test your code...
> 
> 
> Meanwhile I got sth. working with a ADS-TCP-Bridge from C# to Java for 
> logging data from my Beckhoff CPU (using the .NET Api dll from Beckhoff), but 
> PLC4X is the better choice if I can make it work in plane Java!
> 
> 
> Greets
> 
> Jonas
> 
> 
> Von: Łukasz Dywicki 
> Gesendet: Donnerstag, 30. Juli 2020 22:53:07
> An: dev@plc4x.apache.org; Hillenbrand, Jonas (wbk)
> Betreff: Re: AW: How to compose Read requests for ADS Protocol with PLC4X?
> 
> I used to test PLC4X-ADS with below code:
> https://gist.github.com/splatch/7a886f76ee2482a77b501cb07fd238ae
> 
> If you have ADS device then you need to setup ADS routes first. I did it
> with Beckhoff tools. It doesn't work with linux out of the box, hence
> you can also test pyads in above gist.
> 
> Cheers,
> Łukasz
> 
> 
> On 30.07.2020 10:58, Hillenbrand, Jonas (wbk) wrote:
>> Thanks Chris,
>>
>> I'm working with PLC4X 0.6.0.
>>
>> If you need any other information just let me know.
>>
>> Thanks in advance for your efforts.
>>
>> Kind Regards
>> Jonas
>>
>> -Ursprüngliche Nachricht-
>> Von: Christofer Dutz [mailto:christofer.d...@c-ware.de]
>> Gesendet: Mittwoch, 29. Juli 2020 11:33
>> An: dev@plc4x.apache.org
>> Betreff: Re: How to compose Read requests for ADS Protocol with PLC4X?
>>
>> Hi Jonas and welcome to the PLC4X project :-)
>>
>> I’ll do my best to help you with your setup … first … please let me ask you 
>> which version of PLC4X you are using?
>> I’m asking cause we deleted and replaced ALL drivers from 0.6.0 and replaced 
>> them in 0.7.0 and beyond with ones generated by our in-house framework.
>>
>> Unfortunately I have seen that the migration of the Beckhoff drivers was 
>> never finished, but the person doing it disappeared.
>>
>> I will do my best to pick up the ball and finish this asap … even if I 
>> actually don’t have the time to do it, the feeling of having this important 
>> driver un-finished is worse than keeping my deadlines ;-)
>>
>> Chris
>>
>>
>> Von: "Hillenbrand, Jonas (wbk)"  Antworten an: 
>> 
>> Datum: Mittwoch, 29. Juli 2020 um 11:25
>> An: "dev@plc4x.apache.org" 
>> Betreff: How to compose Read requests for ADS Protocol with PLC4X?
>>
>> Hi there,
>>
>> I’m working on using the PLC4X framework within my research projects 
>> involving datalogging from Beckhoff PLC via ADS protocol.
>>
>> I was able to connect with the PLC using the following code, but it fails on 
>> the line where the read request is executed:
>>
>> PlcConnection plcConnection = null;
>> String connectionStr = " 
>> ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835”;
>> try {
>> plcConnection = new 
>> PlcDriverManager().getConnection(connectionStr);
>> if (this.plcConnection.isConnected()){
>> if (!this.isAdsReadable() || 
>> !this.isAdsWritable() || !this.isAdsSubscribable()) {
>>return false;
>>}
>>this.logger.log("Connected successfully 
>> with " + connectionStr);
>>return true;
>> } else {
>>this.logger.log(Level.ERROR, "Could not 
>> connect with " + connectionStr);
>>return false;
>> }
>> } catch (PlcConnectionException e) {
>> // TODO Auto-generated catch block
>> this.logger.log(e);
>> return false;
>> }
>> PlcReadRequest.Builder builder 
>> =plcConnection.readRequestBuilder();
>> builder.addItem(“BOOL1”, "BOOL1:BOOL");  // 
>> Boolean variable in GVL (global) list of SPS Project
>> PlcReadRequest readRequest = builder.build();
>> PlcReadResponse response = null;
>> try {
>> response = readRequest.execute().get();  
>>// CODE FAILS HERE
>> } catch (InterruptedException e) {
>> // TODO Auto-generated catch block
>> this.logger.log(e);
>> } catch (ExecutionException e) {
>> // TODO Auto-generated catch block
>> this.logger.log(e);
>> }
>>
>> Console Output:
>> Connected successfully with 
>> ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835

AW: AW: How to compose Read requests for ADS Protocol with PLC4X?

2020-07-30 Thread Hillenbrand, Jonas (wbk)
Thanks Lukasz,


I will test your code...


Meanwhile I got sth. working with a ADS-TCP-Bridge from C# to Java for logging 
data from my Beckhoff CPU (using the .NET Api dll from Beckhoff), but PLC4X is 
the better choice if I can make it work in plane Java!


Greets

Jonas


Von: Łukasz Dywicki 
Gesendet: Donnerstag, 30. Juli 2020 22:53:07
An: dev@plc4x.apache.org; Hillenbrand, Jonas (wbk)
Betreff: Re: AW: How to compose Read requests for ADS Protocol with PLC4X?

I used to test PLC4X-ADS with below code:
https://gist.github.com/splatch/7a886f76ee2482a77b501cb07fd238ae

If you have ADS device then you need to setup ADS routes first. I did it
with Beckhoff tools. It doesn't work with linux out of the box, hence
you can also test pyads in above gist.

Cheers,
Łukasz


On 30.07.2020 10:58, Hillenbrand, Jonas (wbk) wrote:
> Thanks Chris,
>
> I'm working with PLC4X 0.6.0.
>
> If you need any other information just let me know.
>
> Thanks in advance for your efforts.
>
> Kind Regards
> Jonas
>
> -Ursprüngliche Nachricht-
> Von: Christofer Dutz [mailto:christofer.d...@c-ware.de]
> Gesendet: Mittwoch, 29. Juli 2020 11:33
> An: dev@plc4x.apache.org
> Betreff: Re: How to compose Read requests for ADS Protocol with PLC4X?
>
> Hi Jonas and welcome to the PLC4X project :-)
>
> I’ll do my best to help you with your setup … first … please let me ask you 
> which version of PLC4X you are using?
> I’m asking cause we deleted and replaced ALL drivers from 0.6.0 and replaced 
> them in 0.7.0 and beyond with ones generated by our in-house framework.
>
> Unfortunately I have seen that the migration of the Beckhoff drivers was 
> never finished, but the person doing it disappeared.
>
> I will do my best to pick up the ball and finish this asap … even if I 
> actually don’t have the time to do it, the feeling of having this important 
> driver un-finished is worse than keeping my deadlines ;-)
>
> Chris
>
>
> Von: "Hillenbrand, Jonas (wbk)"  Antworten an: 
> 
> Datum: Mittwoch, 29. Juli 2020 um 11:25
> An: "dev@plc4x.apache.org" 
> Betreff: How to compose Read requests for ADS Protocol with PLC4X?
>
> Hi there,
>
> I’m working on using the PLC4X framework within my research projects 
> involving datalogging from Beckhoff PLC via ADS protocol.
>
> I was able to connect with the PLC using the following code, but it fails on 
> the line where the read request is executed:
>
> PlcConnection plcConnection = null;
> String connectionStr = " 
> ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835”;
> try {
> plcConnection = new 
> PlcDriverManager().getConnection(connectionStr);
> if (this.plcConnection.isConnected()){
> if (!this.isAdsReadable() || 
> !this.isAdsWritable() || !this.isAdsSubscribable()) {
>return false;
>}
>this.logger.log("Connected successfully 
> with " + connectionStr);
>return true;
> } else {
>this.logger.log(Level.ERROR, "Could not 
> connect with " + connectionStr);
>return false;
> }
> } catch (PlcConnectionException e) {
> // TODO Auto-generated catch block
> this.logger.log(e);
> return false;
> }
> PlcReadRequest.Builder builder 
> =plcConnection.readRequestBuilder();
> builder.addItem(“BOOL1”, "BOOL1:BOOL");  // 
> Boolean variable in GVL (global) list of SPS Project
> PlcReadRequest readRequest = builder.build();
> PlcReadResponse response = null;
> try {
> response = readRequest.execute().get();   
>   // CODE FAILS HERE
> } catch (InterruptedException e) {
> // TODO Auto-generated catch block
> this.logger.log(e);
> } catch (ExecutionException e) {
> // TODO Auto-generated catch block
> this.logger.log(e);
> }
>
> Console Output:
> Connected successfully with 
> ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835
>
> Exception in thread "main" 
> org.apache.plc4x.java.api.exceptions.PlcRuntimeException: Non error code 
> received Result{AdsReturnCode{hex=0x0710, dec=1808, description='symbol not 
> found', possibleCauses='', solution=''}}
> at 
> org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.lambda$mapFields$3(AdsAbstractPlcConnection.java:184)
> at 
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> at 
> 

Re: AW: How to compose Read requests for ADS Protocol with PLC4X?

2020-07-30 Thread Łukasz Dywicki
I used to test PLC4X-ADS with below code:
https://gist.github.com/splatch/7a886f76ee2482a77b501cb07fd238ae

If you have ADS device then you need to setup ADS routes first. I did it
with Beckhoff tools. It doesn't work with linux out of the box, hence
you can also test pyads in above gist.

Cheers,
Łukasz


On 30.07.2020 10:58, Hillenbrand, Jonas (wbk) wrote:
> Thanks Chris,
> 
> I'm working with PLC4X 0.6.0.
> 
> If you need any other information just let me know.
> 
> Thanks in advance for your efforts.
> 
> Kind Regards
> Jonas
> 
> -Ursprüngliche Nachricht-
> Von: Christofer Dutz [mailto:christofer.d...@c-ware.de] 
> Gesendet: Mittwoch, 29. Juli 2020 11:33
> An: dev@plc4x.apache.org
> Betreff: Re: How to compose Read requests for ADS Protocol with PLC4X?
> 
> Hi Jonas and welcome to the PLC4X project :-)
> 
> I’ll do my best to help you with your setup … first … please let me ask you 
> which version of PLC4X you are using?
> I’m asking cause we deleted and replaced ALL drivers from 0.6.0 and replaced 
> them in 0.7.0 and beyond with ones generated by our in-house framework.
> 
> Unfortunately I have seen that the migration of the Beckhoff drivers was 
> never finished, but the person doing it disappeared.
> 
> I will do my best to pick up the ball and finish this asap … even if I 
> actually don’t have the time to do it, the feeling of having this important 
> driver un-finished is worse than keeping my deadlines ;-)
> 
> Chris
> 
> 
> Von: "Hillenbrand, Jonas (wbk)"  Antworten an: 
> 
> Datum: Mittwoch, 29. Juli 2020 um 11:25
> An: "dev@plc4x.apache.org" 
> Betreff: How to compose Read requests for ADS Protocol with PLC4X?
> 
> Hi there,
> 
> I’m working on using the PLC4X framework within my research projects 
> involving datalogging from Beckhoff PLC via ADS protocol.
> 
> I was able to connect with the PLC using the following code, but it fails on 
> the line where the read request is executed:
> 
> PlcConnection plcConnection = null;
> String connectionStr = " 
> ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835”;
> try {
> plcConnection = new 
> PlcDriverManager().getConnection(connectionStr);
> if (this.plcConnection.isConnected()){
> if (!this.isAdsReadable() || 
> !this.isAdsWritable() || !this.isAdsSubscribable()) {
>return false;
>}
>this.logger.log("Connected successfully 
> with " + connectionStr);
>return true;
> } else {
>this.logger.log(Level.ERROR, "Could not 
> connect with " + connectionStr);
>return false;
> }
> } catch (PlcConnectionException e) {
> // TODO Auto-generated catch block
> this.logger.log(e);
> return false;
> }
> PlcReadRequest.Builder builder 
> =plcConnection.readRequestBuilder();
> builder.addItem(“BOOL1”, "BOOL1:BOOL");  // 
> Boolean variable in GVL (global) list of SPS Project
> PlcReadRequest readRequest = builder.build();
> PlcReadResponse response = null;
> try {
> response = readRequest.execute().get();   
>   // CODE FAILS HERE
> } catch (InterruptedException e) {
> // TODO Auto-generated catch block
> this.logger.log(e);
> } catch (ExecutionException e) {
> // TODO Auto-generated catch block
> this.logger.log(e);
> }
> 
> Console Output:
> Connected successfully with 
> ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835
> 
> Exception in thread "main" 
> org.apache.plc4x.java.api.exceptions.PlcRuntimeException: Non error code 
> received Result{AdsReturnCode{hex=0x0710, dec=1808, description='symbol not 
> found', possibleCauses='', solution=''}}
> at 
> org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.lambda$mapFields$3(AdsAbstractPlcConnection.java:184)
> at 
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> 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:1242)
> at 

Re: Reading Array of Int

2020-07-30 Thread Cesar Garcia
Hi Stefano,

I have made several modifications to the branch for a 0.6.1 revision.

If you have the time to try it you can download it from here

https://github.com/glcj/plc4x/tree/s7alarm

and a number of examples here,

https://github.com/glcj/PLC4XS7Examples

What version of PLC do you have?

Like the rest of the team, I will order to help you if you find any problem.

Best regards,

El mié., 29 jul. 2020 a las 6:32, Stefano Bossi ()
escribió:

> Thanks Chris,
>
> yes definitely this is a workaround, I am experimenting and learning.
>
> I really appreciate your time on the investigation of the issue.
>
> Thanks,
> Stefano Bossi
>
>
>
> On 29/07/2020 12:08, Christofer Dutz wrote:
>
> Well that’s a workaround, but not a fix …
>
> We should focus on fixing this.
>
> I’ll investigate the issue as soon as I’m done with the Beckhoff ADS/AMS 
> stuff …
>
> Perhaps Julian could find some time to investigate?
>
> Chris
>
>
>
> Von: Stefano Bossi  
> Antworten an:  
> Datum: Mittwoch, 29. Juli 2020 um 11:41
> An:  
> Betreff: Re: Reading Array of Int
>
>
> I have adopted a workaround reading all the INT variable separated.
>
> --connection-string 's7:tcp://192.168.1.192?controller-type=S7_1200' 
> --field-addresses '%DB1:274.0:INT' '%DB1:276.0:INT' '%DB1:278.0:INT' 
> '%DB1:280.0:INT'
>
> In this way on the wire you have:
> the query:
>
> Frame 296: 111 bytes on wire (888 bits), 111 bytes captured (888 bits) on 
> interface utun2, id 0
>
> Null/Loopback
>
> Internet Protocol Version 4, Src: 192.168.100.4, Dst: 192.168.1.192
>
> Transmission Control Protocol, Src Port: 57188, Dst Port: 102, Seq: 48, Ack: 
> 50, Len: 67
>
> TPKT, Version: 3, Length: 67
>
> ISO 8073/X.224 COTP Connection-Oriented Transport Protocol
>
> S7 Communication
>
> Header: (Job)
>
> Parameter: (Read Var)
>
> Function: Read Var (0x04)
>
> Item count: 4
>
> Item [1]: (DB 1.DBX 274.0 INT 1)
>
> Item [2]: (DB 1.DBX 276.0 INT 1)
>
> Item [3]: (DB 1.DBX 278.0 INT 1)
>
> Item [4]: (DB 1.DBX 280.0 INT 1)
>
> the answer:
>
> Frame 297: 89 bytes on wire (712 bits), 89 bytes captured (712 bits) on 
> interface utun2, id 0
>
> Null/Loopback
>
> Internet Protocol Version 4, Src: 192.168.1.192, Dst: 192.168.100.4
>
> Transmission Control Protocol, Src Port: 102, Dst Port: 57188, Seq: 50, Ack: 
> 115, Len: 45
>
> TPKT, Version: 3, Length: 45
>
> ISO 8073/X.224 COTP Connection-Oriented Transport Protocol
>
> S7 Communication
>
> Header: (Ack_Data)
>
> Parameter: (Read Var)
>
> Function: Read Var (0x04)
>
> Item count: 4
>
> Data
>
> Item [1]: (Success)
>
> Item [2]: (Success)
>
> Item [3]: (Success)
>
> Item [4]: (Success)
>
> [INFO ] 10:15:44.727 it.fox.datapicker.HelloPlc4x.printResponse() - 
> Value[value-0]: 10
>
> [INFO ] 10:15:44.733 it.fox.datapicker.HelloPlc4x.printResponse() - 
> Value[value-1]: 11
>
> [INFO ] 10:15:44.737 it.fox.datapicker.HelloPlc4x.printResponse() - 
> Value[value-2]: 12
>
> [INFO ] 10:15:44.741 it.fox.datapicker.HelloPlc4x.printResponse() - 
> Value[value-3]: 13
>
> Unfortunately my java knowledge are not so advanced to fix the bug in reading 
> the array in a single command, anyway there’s a workaround.
>
> Hope this mail help some newbies like me to find the right way to read data 
> from the PLC.
>
> Regards,
> Stefano
>
> On 28/07/2020 11:38, Stefano Bossi wrote:
>
> Dear plc4x forum,
>
> I have found a possible problem in reading an array of INT.
> I am using the HelloPlc4x app for testing and I am trying to read the field 
> address: '%DB1:274.0:INT[3]'
>
> In the request, captured via wireShark I can see the query:
>
> Frame 3: 75 bytes on wire (600 bits), 75 bytes captured (600 bits) on 
> interface utun2, id 0
>
> Null/Loopback
>
> Internet Protocol Version 4, Src: 192.168.100.4, Dst: 192.168.1.192
>
> Transmission Control Protocol, Src Port: 54543, Dst Port: 102, Seq: 1, Ack: 
> 1, Len: 31
>
> TPKT, Version: 3, Length: 31
>
> ISO 8073/X.224 COTP Connection-Oriented Transport Protocol
>
> S7 Communication
>
> Header: (Job)
>
> Parameter: (Read Var)
>
> Function: Read Var (0x04)
>
> Item count: 1
>
> Item [1]: (DB 1.DBX 274.0 INT 3)
>
> Variable specification: 0x12
>
> Length of following address specification: 10
>
> Syntax Id: S7ANY (0x10)
>
> Transport size: INT (5)
>
> Length: 3
>
> DB number: 1
>
> Area: Data blocks (DB) (0x84)
>
> Address: 0x000890
>
> and the response:
>
> Frame 4: 75 bytes on wire (600 bits), 75 bytes captured (600 bits) on 
> interface utun2, id 0
>
> Null/Loopback
>
> Internet Protocol Version 4, Src: 192.168.1.192, Dst: 192.168.100.4
>
> Transmission Control Protocol, Src Port: 102, Dst Port: 54543, Seq: 1, Ack: 
> 32, Len: 31
>
> TPKT, Version: 3, Length: 31
>
> ISO 8073/X.224 COTP Connection-Oriented Transport Protocol
>
> S7 Communication
>
> 

Re: Contributions with Access to PLC's

2020-07-30 Thread Lukas Ott
Hi Ryan,

A warm welcome to PLC4X project.

There are several ways to contribute to PLC4X project.

If you are a developer checkout here:
https://plc4x.apache.org/developers/contributing.html

If you are a user then you may start here:
https://plc4x.apache.org/users/plc4j/gettingstarted.html and start
accessing you PLCs.
-> If you get errors please add Wireshark dumps to you issue and hand it in
here -> https://issues.apache.org/jira/projects/PLC4X/issues/

-> A good way to contribute is to improve the documentation for users e.g.
writing and helping to improve getting started etc.
-> We also have a Hands on Webinar here: https://youtu.be/MIp_0OcDTr4

So start testing and come back to mailing list (open issues, improve
documentation) and enjoy yourself and good Toddy coffee :D.

Again welcome to the PLX4X project.

Kind regards
Lukas


Am Do., 30. Juli 2020 um 15:58 Uhr schrieb Truran, Ryan S :

> What is the best way for me to contribute, I have access to multiple PLC
> Types, Allen Bradley, S7, Wago (Modbus), etc.
>
> Regards,
> Ryan Truran
> Controls Engineer
> Texas Instruments
>


Contributions with Access to PLC's

2020-07-30 Thread Truran, Ryan S
What is the best way for me to contribute, I have access to multiple PLC Types, 
Allen Bradley, S7, Wago (Modbus), etc.

Regards,
Ryan Truran
Controls Engineer
Texas Instruments


AW: How to compose Read requests for ADS Protocol with PLC4X?

2020-07-30 Thread Hillenbrand, Jonas (wbk)
Thanks Chris,

I'm working with PLC4X 0.6.0.

If you need any other information just let me know.

Thanks in advance for your efforts.

Kind Regards
Jonas

-Ursprüngliche Nachricht-
Von: Christofer Dutz [mailto:christofer.d...@c-ware.de] 
Gesendet: Mittwoch, 29. Juli 2020 11:33
An: dev@plc4x.apache.org
Betreff: Re: How to compose Read requests for ADS Protocol with PLC4X?

Hi Jonas and welcome to the PLC4X project :-)

I’ll do my best to help you with your setup … first … please let me ask you 
which version of PLC4X you are using?
I’m asking cause we deleted and replaced ALL drivers from 0.6.0 and replaced 
them in 0.7.0 and beyond with ones generated by our in-house framework.

Unfortunately I have seen that the migration of the Beckhoff drivers was never 
finished, but the person doing it disappeared.

I will do my best to pick up the ball and finish this asap … even if I actually 
don’t have the time to do it, the feeling of having this important driver 
un-finished is worse than keeping my deadlines ;-)

Chris


Von: "Hillenbrand, Jonas (wbk)"  Antworten an: 

Datum: Mittwoch, 29. Juli 2020 um 11:25
An: "dev@plc4x.apache.org" 
Betreff: How to compose Read requests for ADS Protocol with PLC4X?

Hi there,

I’m working on using the PLC4X framework within my research projects involving 
datalogging from Beckhoff PLC via ADS protocol.

I was able to connect with the PLC using the following code, but it fails on 
the line where the read request is executed:

PlcConnection plcConnection = null;
String connectionStr = " 
ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835”;
try {
plcConnection = new 
PlcDriverManager().getConnection(connectionStr);
if (this.plcConnection.isConnected()){
if (!this.isAdsReadable() || 
!this.isAdsWritable() || !this.isAdsSubscribable()) {
   return false;
   }
   this.logger.log("Connected successfully with 
" + connectionStr);
   return true;
} else {
   this.logger.log(Level.ERROR, "Could not 
connect with " + connectionStr);
   return false;
}
} catch (PlcConnectionException e) {
// TODO Auto-generated catch block
this.logger.log(e);
return false;
}
PlcReadRequest.Builder builder =plcConnection.readRequestBuilder();
builder.addItem(“BOOL1”, "BOOL1:BOOL");  // 
Boolean variable in GVL (global) list of SPS Project
PlcReadRequest readRequest = builder.build();
PlcReadResponse response = null;
try {
response = readRequest.execute().get(); 
// CODE FAILS HERE
} catch (InterruptedException e) {
// TODO Auto-generated catch block
this.logger.log(e);
} catch (ExecutionException e) {
// TODO Auto-generated catch block
this.logger.log(e);
}

Console Output:
Connected successfully with 
ads:tcp://127.0.0.1:48898/5.23.164.94.1.1:851/129.254.235.187.1.1:32835

Exception in thread "main" 
org.apache.plc4x.java.api.exceptions.PlcRuntimeException: Non error code 
received Result{AdsReturnCode{hex=0x0710, dec=1808, description='symbol not 
found', possibleCauses='', solution=''}}
at 
org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.lambda$mapFields$3(AdsAbstractPlcConnection.java:184)
at 
java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
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:1242)
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 

[GitHub] [plc4x] hutcheb commented on a change in pull request #174: Feature/extended register read

2020-07-30 Thread GitBox


hutcheb commented on a change in pull request #174:
URL: https://github.com/apache/plc4x/pull/174#discussion_r462848986



##
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##
@@ -247,9 +247,9 @@
 ]
 
 [type 'ModbusPDUReadFileRecordResponseItem'
-[implicit   uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+[simple   uint 8 'dataLength']

Review comment:
   Oops sorry about that, I shouldn't assume things.
   
   Your correction works.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [plc4x] chrisdutz commented on a change in pull request #174: Feature/extended register read

2020-07-30 Thread GitBox


chrisdutz commented on a change in pull request #174:
URL: https://github.com/apache/plc4x/pull/174#discussion_r462835926



##
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##
@@ -247,9 +247,9 @@
 ]
 
 [type 'ModbusPDUReadFileRecordResponseItem'
-[implicit   uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+[simple   uint 8 'dataLength']

Review comment:
   No ... it would read the 0x03 as length (When parsing implicits are 
parsed just like simple fields, however they are not stored in a property as 
this information can be calculated by the given expression when serializing) 
... so when parsing the 0x03 would be parsed and would be available to other 
parsing expressions as dataLength (which would be used to know how many 
elements of "data" have to be read). When serializing instead of reading a 
property of the object, it would check how many elements the "data" array has 
and add 1.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [plc4x] chrisdutz commented on a change in pull request #174: Feature/extended register read

2020-07-30 Thread GitBox


chrisdutz commented on a change in pull request #174:
URL: https://github.com/apache/plc4x/pull/174#discussion_r462835926



##
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##
@@ -247,9 +247,9 @@
 ]
 
 [type 'ModbusPDUReadFileRecordResponseItem'
-[implicit   uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+[simple   uint 8 'dataLength']

Review comment:
   No ... it would read the 0x03 as length (When parsing implicits are 
parsed just like simple fields, however they are not stored in a property as 
this information can be calculated by the given expression when serializing) 
... so when parsing the 0x03 would be parsed and would be available to other 
parsing expressions as dataLength (which would be used to know how many 
elements of "data" have to be read). When serializing instead of reading a 
property of the object, it would check how many elements the "data" array has 
and add 1.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [plc4x] hutcheb commented on a change in pull request #174: Feature/extended register read

2020-07-30 Thread GitBox


hutcheb commented on a change in pull request #174:
URL: https://github.com/apache/plc4x/pull/174#discussion_r462815778



##
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##
@@ -247,9 +247,9 @@
 ]
 
 [type 'ModbusPDUReadFileRecordResponseItem'
-[implicit   uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+[simple   uint 8 'dataLength']

Review comment:
   Hi Chris,
   
   Maybe I'm confused by what implicit and simple mean. I take them to mean:-
   Simple - Use the value that is included in the response.
   Implicit - Attempt to calculated the value based on the other fields in the 
response.
   
   As the length of the ModbusPDUReadFileRecordResponseItems is included in the 
response I changed it to simple instead of trying to calculate it from the data 
field.

##
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##
@@ -247,9 +247,9 @@
 ]
 
 [type 'ModbusPDUReadFileRecordResponseItem'
-[implicit   uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+[simple   uint 8 'dataLength']

Review comment:
   Also as the data field has a variable length if you try to infer the 
length of it, it wouldn't know the length of the data field in the first 
ModbusPDUReadFileRecordResponseItem.
   
   So when it starts parsing the first ModbusPDUReadFileRecordResponseItem it 
would receive:-
   0x03 - It would then try to infer this field by using the rest of the 
message. It would end up with 7 instead of 3.
   0x06
   0x00
   0x01
   0x03
   0x06
   0x00
   0x01





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org