Joylei / eip-rs

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

Can not read a large template #6

Closed GeneL closed 2 years ago

GeneL commented 2 years ago

let template = client.find_template(tag_info.1).await?; println!("template instance:\n{:?}", template);

These statements work for a small (<500 bytes) templates, but do not work for a large (>500 bytes) templates:

let info = client.read_template(&template).call().await?;
println!("template definition:\n{:?}", info);
Joylei commented 2 years ago

It was fixed in release v0.2.1. please reopen the issue if it's not working.

GeneL commented 2 years ago

let template = client.find_template(instance_id).await?; println!("template instance:\n{:?}", template); let info = client.read_template(&template).call().await?; println!("template definition:\n{:?}", info);

Result:

template instance: Template { instance_id: 393, handle: 57110, member_count: 7, object_size: 35, struct_size: 28 } template definition: TemplateDefinition { name: "DateTime", members: {"Hr": MemberInfo { name: "Hr", array_size: 0, type_info: SymbolType { type: "atomic", dims: 0, type_code: 0xc4 }, offset: 12 }, "Sec": MemberInfo { name: "Sec", array_size: 0, type_info: SymbolType { type: "atomic", dims: 0, type_code: 0xc4 }, offset: 20 }, "Da": MemberInfo {.......

It works for small struct. In this case the size is: 28.

In case of a large struct 1868 I get these errors: template instance: Template { instance_id: 1575, handle: 13998, member_count: 233, object_size: 1411, struct_size: 1868 } thread 'main' panicked at 'assertion failed: self.remaining() >= dst.len()', bytes-1.1.0/src/buf/buf_impl.rs:253:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Joylei commented 2 years ago

can you provide the detailed backtrace?