implement the main ModemManager entry point and ergonomic api.
core struct
pub struct ModemManager {
conn: Connection,
}
impl ModemManager {
pub async fn new() -> Result<Self>;
pub async fn with_connection(conn: Connection) -> Result<Self>;
pub fn connection(&self) -> &Connection;
}
modem enumeration
impl ModemManager {
pub async fn list_modems(&self) -> Result<Vec<Modem>>;
pub async fn modem_by_imei(&self, imei: &str) -> Result<Modem>;
pub async fn primary_modem(&self) -> Result<Modem>;
pub fn modem(&self, path: &str) -> ModemScope<'_>;
}
use ObjectManager.GetManagedObjects() to enumerate, same pattern as nmrs bluez adapter enumeration.
simple operations
impl ModemManager {
pub async fn enable(&self) -> Result<()>;
pub async fn disable(&self) -> Result<()>;
pub async fn connect_simple(&self, apn: &str) -> Result<Bearer>;
pub async fn connect(&self, config: &BearerConfig) -> Result<Bearer>;
pub async fn disconnect(&self) -> Result<()>;
pub async fn status(&self) -> Result<ConnectionStatus>;
}
connect_simple uses Modem.Simple.Connect for one-shot enable+register+connect.
sim operations
impl ModemManager {
pub async fn sim(&self) -> Result<Option<Sim>>;
pub async fn unlock_pin(&self, pin: &str) -> Result<()>;
pub async fn unlock_puk(&self, puk: &str, new_pin: &str) -> Result<()>;
pub async fn set_pin_enabled(&self, pin: &str, enabled: bool) -> Result<()>;
pub async fn change_pin(&self, old: &str, new: &str) -> Result<()>;
}
signal / registration
impl ModemManager {
pub async fn signal_quality(&self) -> Result<u32>;
pub async fn access_technology(&self) -> Result<AccessTechnology>;
}
per-modem scope
pub struct ModemScope<'a> {
mm: &'a ModemManager,
path: String,
}
impl<'a> ModemScope<'a> {
pub async fn info(&self) -> Result<Modem>;
pub async fn enable(&self) -> Result<()>;
pub async fn connect_simple(&self, apn: &str) -> Result<Bearer>;
// mirrors ModemManager methods, scoped to this modem
}
for multi-modem systems (vehicle gateways, dual-sim devices).
files
mmrs/src/api/
├── mod.rs
├── modem_manager.rs
└── modem_scope.rs
implement the main
ModemManagerentry point and ergonomic api.core struct
modem enumeration
use
ObjectManager.GetManagedObjects()to enumerate, same pattern as nmrs bluez adapter enumeration.simple operations
connect_simpleusesModem.Simple.Connectfor one-shot enable+register+connect.sim operations
signal / registration
per-modem scope
for multi-modem systems (vehicle gateways, dual-sim devices).
files