[ 
https://issues.apache.org/jira/browse/PLC4X-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17394077#comment-17394077
 ] 

Maida Baralić edited comment on PLC4X-309 at 8/5/21, 2:52 PM:
--------------------------------------------------------------

Just to make sure I'm doing this right, this is what I changed in the example: 

!image-2021-08-05-16-40-56-113.png!

However on version 0.9.0-SNAPSHOT I get the following exception: 

java.lang.ClassCastException: class [B cannot be cast to class java.lang.String 
([B and java.lang.String are in module java.base of loader 
'bootstrap')java.lang.ClassCastException: class [B cannot be cast to class 
java.lang.String ([B and java.lang.String are in module java.base of loader 
'bootstrap') at org.apache.plc4x.java.spi.values.PlcBYTE.of(PlcBYTE.java:61)

And when I stop in the debugger when PlcBYTE is constructed, this is how it 
looks like: 

!image-2021-08-05-16-42-26-978.png!

In version 0.8.0: 

org.apache.plc4x.java.api.exceptions.PlcUnsupportedDataTypeException: Data Type 
class [B Is not 
supportedorg.apache.plc4x.java.api.exceptions.PlcUnsupportedDataTypeException: 
Data Type class [B Is not supported at 
org.apache.plc4x.java.spi.values.IEC61131ValueHandler.of(IEC61131ValueHandler.java:91)

 


was (Author: maidab):
Just to make sure I'm doing this right, this is what I changed in the example: 

!image-2021-08-05-16-40-56-113.png!

However on version 0.9.0-SNAPSHOT I get the following exception: 

java.lang.ClassCastException: class [B cannot be cast to class java.lang.String 
([B and java.lang.String are in module java.base of loader 
'bootstrap')java.lang.ClassCastException: class [B cannot be cast to class 
java.lang.String ([B and java.lang.String are in module java.base of loader 
'bootstrap') at org.apache.plc4x.java.spi.values.PlcBYTE.of(PlcBYTE.java:61)

And when I stop in the debugger when PlcBYTE is constructed, this is how it 
looks like: 


!image-2021-08-05-16-42-26-978.png!



In version 0.8.0: 

It throws an exception: PlcUnsupportedDataTypeException: Data Type class [B Is 
not supported

 

> [S7] Writing byte array not working
> -----------------------------------
>
>                 Key: PLC4X-309
>                 URL: https://issues.apache.org/jira/browse/PLC4X-309
>             Project: Apache PLC4X
>          Issue Type: Bug
>          Components: Driver-S7
>    Affects Versions: 0.8.0
>         Environment: Windows 10
>            Reporter: Maida Baralić
>            Assignee: Christofer Dutz
>            Priority: Major
>         Attachments: DB4.pdf, PLCWrite.zip, 
> image-2021-08-05-16-40-56-113.png, image-2021-08-05-16-42-26-978.png, 
> write_byte_array_0.8.0.pcapng, write_byte_array_0.9.0.pcapng
>
>
> I'm having some issues with writing a byte array using S7 driver to the 
> S7-1200.
> I'm a bit new to the communication with PLCs, so I'm not sure if I'm doing 
> something wrong.
> I've followed the example of how to write a byte array to the connection, 
> however I'm getting an INTERNAL_ERROR as a response code from the library and 
> in the Wireshark the status from the PLC is inconsistent data type. 
> I've attached both the sample project that's not working for me, my 
> definition of byte array on the PLC and also  Wireshark capture. 
> It's possible that I'm not doing something right, however I can't figure it 
> out. 
> Writing of most of the single values is working, however the array is the 
> problem. And as far as I understood from the code and documentation arrays 
> should be supported. 
> Any help would be appreciated.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to