Skip to main content

Crate modemmanager

Crate modemmanager 

Source
Expand description

Rust bindings for ModemManager over D-Bus.

This crate is in early development. The public surface includes the high-level ModemManager entry point plus model types that describe modems, SIMs, and packet-data bearers as exposed by ModemManager.

§Modules

  • models re-exports every public data type under crate::api::models. The same types are re-exported at the crate root, so modemmanager::ModemState, modemmanager::models::ModemState, and modemmanager::api::models::ModemState refer to the same item.

§Quick reference

§Example

use modemmanager::{AccessTechnology, BearerConfig, IpType, ModemManager, ModemState};

let mm = ModemManager::new().await?;
let modems = mm.list_modems().await?;

let state = ModemState::from_raw(11);
assert!(state.is_connected());

let tech = AccessTechnology::from(0x4000); // MM_MODEM_ACCESS_TECHNOLOGY_LTE
assert!(tech.has_lte());

let cfg = BearerConfig::new("internet")
    .with_ip_type(IpType::Ipv4v6)
    .with_user("user")
    .with_password("hunter2");
assert_eq!(cfg.apn, "internet");

Re-exports§

pub use api::models::AccessTechnology;
pub use api::models::Bearer;
pub use api::models::BearerConfig;
pub use api::models::BearerStats;
pub use api::models::ConnectionStatus;
pub use api::models::Ip4Config;
pub use api::models::IpType;
pub use api::models::Modem;
pub use api::models::ModemError;
pub use api::models::ModemState;
pub use api::models::Result;
pub use api::models::Sim;
pub use api::models::SimLockState;
pub use api::ModemManager;
pub use api::ModemScope;

Modules§

api
Public-facing API surface for the modemmanager crate.
models
Public data types for ModemManager (modems, SIMs, bearers, errors).