plctag-core
a rust wrapper of libplctag, with rust style APIs and useful extensions.
How to use
Add plctag-core to your Cargo.toml
[]
= "0.2"
Examples
read/write tag
use ;
let timeout = 100;//ms
let path="protocol=ab-eip&plc=controllogix&path=1,0&gateway=192.168.1.120&name=MyTag1&elem_count=1&elem_size=16";// YOUR TAG DEFINITION
let tag = new.unwrap;
//read tag
let status = tag.read;
assert!;
let offset = 0;
let value:u16 = tag.get_value.unwrap;
println!;
let value = value + 10;
tag.set_value.unwrap;
//write tag
let status = tag.write;
assert!;
println!;
More examples
please take a look at examples
Thread-safety
Operations are not thread-safe in this library, please use std::sync::Mutex or something similar to enforce thread-safety.
Build & Test
Please refer to How to use to setup build environment.
Because mutithread will cause troubles, you need to run tests with:
cargo test -- --test-threads=1
License
MIT