Crate ql_dms
Expand description
Rust client for Qualcomm’s QMI Device Management Service (DMS).
DMS (QMI service 0x02) reports the identity of the modem and controls its operating mode. This crate covers the manufacturer, model, firmware revision and serial numbers, the operating mode and the event reports.
EVA and EVD firmware share these messages. The crate only uses fields that both have. EVA has IDL version 1.57 and EVD has 1.60.
§Example
use std::error::Error;
use std::time::Duration;
use ql_dms::Client;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn Error>> {
let (client, connection) = Client::builder().connect()?;
tokio::spawn(connection.run());
let serials = client.serial_numbers().await?;
println!("IMEI: {:?}", serials.imei);
let mode = client
.operating_mode()
.timeout(Duration::from_secs(1))
.await?;
println!("mode: {:?}", mode.mode);
Ok(())
}Client has a method for every request of this crate. Each request method
returns the request, so you can set a timeout with .timeout() before you
await it.
Client::qmi returns the typed ql_qmi::Client for custom requests.
§Indications
Client::set_event_report makes the modem send an EventReport
when the operating mode or the SIM state changes. Client::events
receives them. Subscribe before you enable the reports, otherwise the
first ones are lost.
use std::error::Error;
use ql_dms::{Client, SetEventReport};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn Error>> {
let (client, connection) = Client::builder().connect()?;
tokio::spawn(connection.run());
let mut events = client.events()?;
let enable = SetEventReport {
operating_mode: Some(true),
..SetEventReport::default()
};
client.set_event_report(&enable).await?;
loop {
let report = events.next().await?;
println!("mode: {:?}", report.operating_mode);
}
}The client runs on tokio. See ql_qmi for the runtime and permission
requirements.
Modules§
- client 🔒
- event 🔒
- event_
report 🔒 - identity 🔒
- operating_
mode 🔒 - types 🔒
Structs§
- Client
- Client of the DMS service.
- Dms
- Marker of the DMS service for
ql_qmi::Client. - Event
Report - An event report (
QMI_DMS_EVENT_REPORT_IND). - GetManufacturer
- Reads the manufacturer (
QMI_DMS_GET_DEVICE_MFR). - GetModel
- Reads the model (
QMI_DMS_GET_DEVICE_MODEL_ID). - GetOperating
Mode - Reads the operating mode (
QMI_DMS_GET_OPERATING_MODE). - GetRevision
- Reads the firmware revisions (
QMI_DMS_GET_DEVICE_REV_ID). - GetSerial
Numbers - Reads the serial numbers (
QMI_DMS_GET_DEVICE_SERIAL_NUMBERS). - Manufacturer
- Manufacturer of the modem.
- Model
- Model of the modem.
- Offline
Reason - Reasons for the offline mode (
dms_offline_reason_mask_v01). - Operating
Mode - Operating mode of the modem (
dms_operating_mode_enum_v01). - Operating
Mode State - Operating mode of the modem.
- Revision
- Firmware revisions of the modem.
- Serial
Numbers - Serial numbers of the modem.
- SetEvent
Report - Sets which event reports the modem sends to this client
(
QMI_DMS_SET_EVENT_REPORT). - SetOperating
Mode - Sets the operating mode (
QMI_DMS_SET_OPERATING_MODE). - UimState
- State of the SIM card (
dms_uim_state_enum_v01).