7 unstable releases
0.4.1 | Feb 19, 2023 |
---|---|
0.4.0 | Jan 14, 2023 |
0.3.0 | Feb 25, 2022 |
0.2.2 | Oct 16, 2022 |
0.1.0 | Sep 14, 2021 |
#1082 in Asynchronous
41 downloads per month
Used in plctag
2MB
31K
SLoC
plctag-async
async wrapper for libplctag
.
How to use
Add plctag-async
to your Cargo.toml
[dependencies]
plctag-async= "0.4"
Examples
use plctag_async::{AsyncTag, Error, Pool, PoolEntry};
use tokio::runtime;
let rt = runtime::Runtime::new().unwrap()?;
rt.block_on(async {
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 pool = Pool::new();
let tag = pool.entry(path).await.unwrap();
let tag_ref = tag.get().await.unwrap();
let offset = 0;
let value:u16 = tag_ref.read_value(offset).await.unwrap();
println!("tag value: {}", value);
let value = value + 10;
tag_ref.write_value(offset, value).await.unwrap();
});
Build
Please refer to How to build to setup build environment.
License
MIT
Dependencies
~0.5–3MB
~59K SLoC