Joylei / eip-rs

rseip - EIP&CIP client in pure Rust, for generic CIP and AB PLC
MIT License
49 stars 6 forks source link

Question: Can eip-rs Read UDTs? #20

Closed TheColonel2688 closed 4 weeks ago

TheColonel2688 commented 6 months ago

Can eip-rs Read and Write UDTs?

I need a grab a UDT instance from my CompactLogix PLCs, can that be done? And then Mapped to a struct?

Example UDT on PLC

- Type: MyUDT
  - MyDint1 : DINT
  - MyDint2: DINT
  - MyString1 : STRING
  - MyString2 : STRING

Path to an instance on PLC that is in Program1 \Program1.MyUdtInstance1

Rust Type:

struct MyUDT {
    MyDint1: i32,
    MyDint2: i32,
    MyString1 : String
    MyString2 : String
}
Joylei commented 6 months ago

the lib can read UDT, please check examples in the repo.

TheColonel2688 commented 6 months ago

I don't see examples of fetching a UDT instance, I only see an example of reading individual tags that ate in side a UDT, but not the whole UDT.

Could you direct me to the example you are talking about?

klmurphy72 commented 6 months ago

Check out ab-tag-read-fragmented.rs. It reads a UDT full of strings.