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, SlmpCompatibilityMode, SlmpConnectionOptions, SlmpFrameType,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = SlmpConnectionOptions::new("192.168.250.100");
options.port = 1025;
options.frame_type = SlmpFrameType::Frame4E;
options.compatibility_mode = SlmpCompatibilityMode::Iqr;
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, SlmpCompatibilityMode, SlmpConnectionOptions, SlmpFrameType,
SlmpValue, read_named, write_named,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = SlmpConnectionOptions::new("192.168.250.100");
options.port = 1025;
options.frame_type = SlmpFrameType::Frame4E;
options.compatibility_mode = SlmpCompatibilityMode::Iqr;
let client = SlmpClient::connect(options).await?;
let snapshot = read_named(
&client,
&["D100".into(), "D200:F".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 and long counter
state reads (LTS, LTC, LSTS, LSTC, LCS, LCC) are normalized
through the corresponding current-value block reads.
§Examples
The repository includes runnable examples under examples/:
raw_read_writenamed_helpersadvanced_operations
Run them with cargo run --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
Device Address - Slmp
Error - Slmp
Extension Spec - Slmp
Long Timer Result - Slmp
Named Target - Slmp
Qualified Device Address - Slmp
Random Read Result - Slmp
Target Address - Slmp
Type Name Info
Enums§
- Slmp
Command - Slmp
Compatibility Mode - Slmp
Device Code - Slmp
Frame Type - Slmp
Trace Direction - Slmp
Transport Mode - Slmp
Value
Functions§
- encode_
device_ spec - normalize_
named_ address - parse_
named_ address - parse_
named_ target - parse_
qualified_ device - parse_
scalar_ for_ named - parse_
target_ auto_ number - poll_
named - read_
dwords_ chunked - read_
dwords_ single_ request - read_
named - read_
typed - read_
words_ chunked - read_
words_ single_ request - write_
bit_ in_ word - write_
dwords_ chunked - write_
dwords_ single_ request - write_
named - write_
typed - write_
words_ chunked - write_
words_ single_ request