Expand description
Async Rust client for Mitsubishi SLMP Binary 3E and 4E.
This crate follows the same operation semantics as the sibling
plc-comm-slmp-python, .NET, C++, Node-RED, and cross-verify
projects in the same family. The intended flow is:
- connect with
SlmpConnectionOptionsandSlmpClient - use raw device APIs for low-level control
- use helper APIs such as
read_namedandwrite_namedfor application-facing snapshots and typed values - validate behavior through
plc-comm-slmp-cross-verify
§Quick Start
use plc_comm_slmp::{
SlmpAddress, SlmpClient, SlmpConnectionOptions, SlmpPlcFamily,
};
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()?;
runtime.block_on(async {
let mut options = SlmpConnectionOptions::new("192.168.250.100", SlmpPlcFamily::IqR);
options.port = 1025;
let client = SlmpClient::connect(options).await?;
let words = client.read_words_raw(SlmpAddress::parse("D100")?, 2).await?;
println!("{words:?}");
Ok(())
})§Recommended High-Level Helpers
use plc_comm_slmp::{
NamedAddress, SlmpClient, SlmpConnectionOptions, SlmpPlcFamily, SlmpValue, read_named,
write_named,
};
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()?;
runtime.block_on(async {
let mut options = SlmpConnectionOptions::new("192.168.250.100", SlmpPlcFamily::IqF);
options.port = 1025;
let client = SlmpClient::connect(options).await?;
let snapshot = read_named(
&client,
&["D100".into(), "X100".into(), "D50.3".into(), "LTN10:D".into()],
)
.await?;
println!("{snapshot:?}");
let mut updates = NamedAddress::new();
updates.insert("D300".into(), SlmpValue::U16(42));
updates.insert("D400:F".into(), SlmpValue::F32(3.14));
write_named(&client, &updates).await?;
Ok(())
})§Address Notes
- Plain word devices:
D100,R50,ZR0 - Plain bit devices:
M100,X20,Y20,B10 - Typed suffixes:
D200:F,D300:D,D400:L - Bit-in-word form:
D50.3 - Long current values:
LTN10:D,LSTN20:D,LCN30:D - Extended devices:
J1\\W10,U3\\G100,U1\\HG0
.bit notation is only valid for word devices. Long timer state reads
(LTS, LTC, LSTS, LSTC) are decoded through the corresponding
current-value blocks. Long counter state reads (LCS, LCC) use direct bit
read. LCN current values use random dword access in the high-level helpers,
and high-level state writes use random bit write (0x1402).
§Examples
The repository includes runnable examples under examples/:
raw_read_writenamed_helpersadvanced_operations
Run them with cargo run --features cli --example <name>.
§Verification
This crate is meant to participate in plc-comm-slmp-cross-verify.
The canonical wrapper binary is slmp_verify_client.
Structs§
- Slmp
Address - Slmp
Block Read - Slmp
Block Read Result - Slmp
Block Write - Slmp
Block Write Options - Slmp
Client - Slmp
Connection Options - Slmp
CpuOperation State - Slmp
Device Address - Slmp
Device Range Catalog - Slmp
Device Range Entry - Slmp
Device Range Sample Device Report - Slmp
Device Range Sample Failure - Slmp
Device Range Sample Options - Slmp
Device Range Sample Report - Slmp
Device Range Sample Summary - Slmp
Error - Slmp
Extension Spec - Slmp
Label Array Read Point - Slmp
Label Array Read Result - Slmp
Label Array Write Point - Slmp
Label Random Read Result - Slmp
Label Random Write Point - Slmp
Long Timer Result - Slmp
Named Target - Slmp
Qualified Device Address - Slmp
Random Read Result - Slmp
Route Validation Case - Slmp
Route Validation Options - Slmp
Route Validation Report - Slmp
Route Validation Summary - Slmp
Target Address - Slmp
Traffic Stats - Slmp
Type Name Info
Enums§
- Slmp
Command - Slmp
Compatibility Mode - Slmp
CpuOperation Status - Slmp
Device Code - Slmp
Device Range Category - Slmp
Device Range Family - Slmp
Device Range Notation - Slmp
Device Range Sample Value Kind - Slmp
Frame Type - Slmp
PlcFamily - Slmp
Route Validation Status - Slmp
Trace Direction - Slmp
Transport Mode - Slmp
Value
Functions§
- encode_
device_ spec - normalize_
named_ address - parse_
device_ for_ plc_ family - parse_
named_ address - parse_
named_ target - parse_
qualified_ device - parse_
scalar_ for_ named - parse_
scalar_ for_ named_ with_ family - parse_
target_ auto_ number - poll_
named - read_
dwords_ chunked - read_
dwords_ single_ request - read_
named - read_
typed - read_
words_ chunked - read_
words_ single_ request - run_
device_ range_ sample_ compare - run_
route_ validation_ compare - write_
bit_ in_ word - write_
dwords_ chunked - write_
dwords_ single_ request - write_
named - write_
typed - write_
words_ chunked - write_
words_ single_ request