Skip to main content

Crate rfid_silion_compat

Crate rfid_silion_compat 

Source
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

§Typical Workflow

  1. Create a transport (native serial or web serial).
  2. Construct SilionReader with that transport.
  3. 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§

AsyncInventorySession
An active asynchronous inventory session driven by awaited reads.
ReaderAsyncInventoryStartData
Start configuration for asynchronous inventory.
ReaderClient
Protocol client over a ReaderTransport.
SilionReader
High-level reader API that returns typed values for common protocol operations.

Enums§

AsyncInventoryMessage
One asynchronous inventory message pushed by the reader.
ClientError
Errors produced by the protocol client.
ProtocolError
Errors returned by this crate.
SelectOption
Tag singulation/select options used by inventory and access helpers.

Traits§

ReaderTransport
Abstraction over asynchronous byte-oriented transport used by the reader protocol.