Skip to content

String test not working #13

@isaac-trunorth

Description

@isaac-trunorth

I'm using a Compact GuardLogix, on v35. When trying to read a string from the PLC this is what I'm seeing:

🔧 [DEBUG] Parsing CIP response (96 bytes): [CC, 00, 00, 00, A0, 02, CE, 0F, 04, 00, 00, 00, 74, 65, 73, 74, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
🔧 [DEBUG] Service reply: 0xCC, Status: 0x00
🔧 [DEBUG] Data type: 0x02A0, Value data (90 bytes): [CE, 0F, 04, 00, 00, 00, 74, 65, 73, 74, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
🔧 [DEBUG] Detected UDT structure (0x02A0) with 90 bytes
🔧 [DEBUG] Raw UDT data: [CE, 0F, 04, 00, 00, 00, 74, 65, 73, 74, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
🔧 [DEBUG] Parsing UDT structure with 90 bytes
🔧 [DEBUG] Alignment 0: DINT1=266190, DINT2=1702100992, REAL=0.000000000000000000000000000000000000000041774
🔧 [DEBUG] Reasonableness check: DINT1=266190 (false), DINT2=1702100992 (false), REAL=0.000000000000000000000000000000000000000041774 (true)
🔧 [DEBUG] Alignment 1: DINT1=1039, DINT2=1936028672, REAL=0.000000000000000000000000000000000000000000163
🔧 [DEBUG] Reasonableness check: DINT1=1039 (false), DINT2=1936028672 (false), REAL=0.000000000000000000000000000000000000000000163 (true)
🔧 [DEBUG] Alignment 2: DINT1=4, DINT2=1953719668, REAL=0
🔧 [DEBUG] Reasonableness check: DINT1=4 (true), DINT2=1953719668 (false), REAL=0 (true)
🔧 [DEBUG] Alignment 3: DINT1=1946157056, DINT2=7631717, REAL=0
🔧 [DEBUG] Reasonableness check: DINT1=1946157056 (false), DINT2=7631717 (false), REAL=0 (true)
🔧 [DEBUG] DINT_at_start: DINT = 266190
🔧 [DEBUG] DINT_at_end: DINT = 0
  • It is getting recognized as a UDT with a single key in it
  • As a side note, when parsing a UDT, it would be great to get the raw data returned. so making something like read_tag_raw available that just returns the array of bytes. This would allow easier parsing of UDTs, and defining a struct that can impl From<PlcValue::UDT in order to parse more complicated UDTs. The current parsing attempt seems to be not robust enough

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions