Hi everyone,


I'm currently writing my master thesis on the topic of Architecture Mining
for S7 machines through analysis of pcap files.



Therefore I'm already able to retrieve all the fields for request and
response messages (S7ParameterReadVarRequest tells me the read request was
for DB444:0.0:REAL and the corresponding S7ParameterReadVarResponse contains
the answer as data item S7VarPayloadDataItem).

Now I'm stuck at the point where I've got a byte array as returned by
item.getData() . How is it possible to convert this byte[] to the concrete
value of that DB, if the type is known (item.getTransportSize() returns a
DataTransportSize e.g. REAL, NULL etc.)

I want: data of response as byte[] "41 dd bf 4e" of type REAL --> concrete
value: e.g. 123,456



I've had a look at the mechanism when actively reading a S7 DB e.g. via
HelloPlc4x example . Within S7ProtocolLogic.java a private function
(PlcValue parsePlcValue(S7Field field, ByteBuf data)) is used : return
DataItemIO.staticParse(readBuffer, field.getDataType().getDataProtocolId(),
stringLength)

Unfortunately in my case I don't have all the parameters. My data types
REAL, NULL, .. are types enum DataTransportSize not enum TransportSize, so
there is no protocolId.

Is there any way to make use of this function or do you have any other idea
how to convert the bytes ?

I would really appreciate any help in this. Thanks!



Best,

Anja Hager



Reply via email to