implement bearer (data session) create/connect/disconnect/delete flow.
bearer config builder
impl BearerConfig {
pub fn new(apn: &str) -> Self;
pub fn with_ip_type(self, ip_type: IpType) -> Self;
pub fn with_credentials(self, user: &str, password: &str) -> Self;
pub fn with_auth_method(self, method: AuthMethod) -> Self;
pub fn with_roaming(self, allow: bool) -> Self;
}
api methods
impl ModemManager {
pub async fn list_bearers(&self) -> Result<Vec<Bearer>>;
pub async fn create_bearer(&self, config: &BearerConfig) -> Result<Bearer>;
pub async fn delete_bearer(&self, path: &str) -> Result<()>;
}
impl Bearer {
pub async fn connect(&self) -> Result<()>;
pub async fn disconnect(&self) -> Result<()>;
}
ip config extraction
parse Ip4Config / Ip6Config dicts from bearer properties:
pub struct Ip4Config {
pub address: String,
pub prefix: u32,
pub gateway: Option<String>,
pub dns: Vec<String>,
pub mtu: Option<u32>,
}
bearer stats
pub struct BearerStats {
pub rx_bytes: u64,
pub tx_bytes: u64,
pub duration: u32,
}
files
mmrs/src/api/builders/bearer.rs
mmrs/src/core/bearer.rs
implement bearer (data session) create/connect/disconnect/delete flow.
bearer config builder
api methods
ip config extraction
parse
Ip4Config/Ip6Configdicts from bearer properties:bearer stats
files
mmrs/src/api/builders/bearer.rsmmrs/src/core/bearer.rs