Expand description
Host-side implementation of the Silion reader communication protocol.
The implementation follows the packet format defined in: https://en.silion.com.cn/En/doc_center/ModuleAPI_Docs/Communication_Protocol_Doc/html/Protocol_Introduction.html and command pages linked from that document.
This crate is centered around the high-level SilionReader API for common
reader operations (version, region, inventory, and tag access).
See the project README for installation and feature setup.
§API Entry Points
SilionReader: high-level async reader operations.ReaderAsyncInventoryStartData: typed async inventory start configuration.SelectOption: high-level select/singulation input for inventory and access.AsyncInventoryMessage: typed pushed messages from async inventory.EpcValue: high-level EPC wrapper with EPC Tag URI helpers.
§Typical Workflow
- Create a transport (native serial or web serial).
- Construct
SilionReaderwith that transport. - Call typed async methods and work with parsed return values.
§Example: Single-Tag Inventory (native serial)
ⓘ
use rfid_silion_compat::MetadataFlags;
use rfid_silion_compat::SelectOption;
use rfid_silion_compat::SerialTransport;
use rfid_silion_compat::SilionReader;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let transport = SerialTransport::open("/dev/ttyUSB0", 115_200)?;
let mut reader = SilionReader::new(transport);
let metadata = MetadataFlags::default().with_rssi(true).with_antenna_id(true);
let tag = reader
.single_tag_inventory(1000, SelectOption::Disabled, Some(metadata))
.await?;
println!("EPC: {:02X?}", tag.epc_id);
println!("RSSI dBm: {:?}", tag.rssi_dbm);
Ok(())
}Re-exports§
pub use codes::AntennaPortsOption;pub use codes::RegionCode;pub use codes::StatusCode;pub use command::AntennaPortsConfiguration;pub use command::EmbeddedReadTagData;pub use command::InventoryEmbeddedCommandContent;pub use command::InventorySearchFlags;pub use command::MemBank;pub use command::MetadataFlags;pub use epc::EpcSchema;pub use epc::EpcValue;pub use epc::Giai96;pub use epc::Sgtin96;pub use frame::ReaderFrame;pub use parsers::AntennaPair;pub use parsers::AntennaPortsResponse;pub use parsers::AntennaPower;pub use parsers::AntennaPowerSettling;pub use parsers::ProtocolConfigurationValue;pub use parsers::ReaderConfigurationValue;pub use parsers::RegulatoryHopTime;pub use parsers::RunPhase;pub use parsers::SerialNumberInfo;pub use parsers::TagEpcAndMetaData;pub use parsers::VersionInfo;
Modules§
- codes
- Protocol constants and enums for commands, regions, antennas, and statuses. Protocol code definitions used across command building and response parsing.
- command
- Low-level command payload types and host packet builders. Command-layer protocol types and host packet builders.
- epc
- EPC value types and EPC URI/binary helpers. EPC helper types for common GS1 schemes.
- frame
- Wire-frame encoding/decoding primitives for reader/host packets. Wire-frame encoding and decoding helpers.
- parsers
- Response payload decoders and parsed output data models. Response payload parsers and typed decoded data structures.
Structs§
- Async
Inventory Session - An active asynchronous inventory session driven by awaited reads.
- Reader
Async Inventory Start Data - Start configuration for asynchronous inventory.
- Reader
Client - Protocol client over a
ReaderTransport. - Silion
Reader - High-level reader API that returns typed values for common protocol operations.
Enums§
- Async
Inventory Message - One asynchronous inventory message pushed by the reader.
- Client
Error - Errors produced by the protocol client.
- Protocol
Error - Errors returned by this crate.
- Select
Option - Tag singulation/select options used by inventory and access helpers.
Traits§
- Reader
Transport - Abstraction over asynchronous byte-oriented transport used by the reader protocol.