Skip to main content

Crate ql_wms

Crate ql_wms 

Expand description

Rust client for Qualcomm’s QMI Wireless Messaging Service (WMS).

WMS (QMI service 0x05) receives and stores SMS messages. This crate covers the event reports for received messages, the routing table, the message storage and the acknowledgements. It hands out messages as raw PDUs, which flaskpost decodes.

EVA and EVD firmware share these messages. The crate only uses fields that both have. EVA has IDL version 1.24 and EVD has 1.33.

§Example

use std::error::Error;

use ql_wms::{Client, ListMessages, StorageType};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn Error>> {
    let (client, connection) = Client::builder().connect()?;
    tokio::spawn(connection.run());
    let routes = client.routes().await?;
    for route in &routes.routes {
        println!("{route:?}");
    }
    let request = ListMessages {
        storage: StorageType::NV,
        tag: None,
        mode: None,
    };
    let list = client.list_messages(&request).await?;
    println!("{} stored messages", list.messages.len());
    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 for each received message. Client::events receives them. Subscribe before you enable the reports, otherwise the first ones are lost.

use std::error::Error;

use ql_wms::{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 {
        mt_message: Some(true),
    };
    client.set_event_report(&enable).await?;
    loop {
        let report = events.next().await?;
        if let Some(message) = report.transferred {
            println!("received PDU {:02x?}", message.data);
        }
    }
}

§Acknowledgements

The route of a message decides who acknowledges it to the network. On ReceiptAction::TRANSFER_AND_ACK routes the modem does it, as the IDL states. On EVA and EVD, a negative Client::send_ack then failed with ACK_NOT_SENT, and the message didn’t arrive again within 2 minutes. mcm_ril_service still sends an acknowledgement for every message with AckIndicator::SEND_ACK. On ReceiptAction::TRANSFER_ONLY routes the client must call Client::send_ack.

On EVA and EVD, TransferredMessage::ack doesn’t match whether a negative Client::send_ack succeeds. Messages on ReceiptAction::TRANSFER_AND_ACK routes had AckIndicator::SEND_ACK and transaction ID 0xFFFFFFFF. Messages on ReceiptAction::TRANSFER_ONLY routes had AckIndicator::DO_NOT_SEND_ACK and the transaction IDs 0 and 1 for the first two messages. Decide by the route.

§Coexistence with mcm_ril_service

Qualcomm’s MCM daemon is a WMS client too. At startup it sets every point-to-point route to ReceiptAction::TRANSFER_AND_ACK. The messages go to every client that enabled SetEventReport::mt_message.

The daemon also deletes stored messages. On EVD a restart of the daemon deleted one test message on the SIM and one in NV storage. The restart wasn’t tested on EVA, because a route that stores in NV didn’t report a stored message there. The routes of the daemon itself don’t store messages.

The client runs on tokio. See ql_qmi for the runtime and permission requirements.

Modules§

ack 🔒
client 🔒
error 🔒
event 🔒
event_report 🔒
routes 🔒
storage 🔒
types 🔒

Structs§

AckIndicator
Whether a client must acknowledge a message (wms_ack_indicator_enum_v01).
Client
Client of the WMS service.
Delete
Deletes stored messages (QMI_WMS_DELETE).
EventReport
An event report (QMI_WMS_EVENT_REPORT_IND).
FailureCause
Failure cause of a GSM/WCDMA acknowledgement (wms_3gpp_failure_information_type_v01).
GetRoutes
Reads the routing table (QMI_WMS_GET_ROUTES).
ListMessages
Lists stored messages (QMI_WMS_LIST_MESSAGES).
MessageClass
Message class (wms_message_class_enum_v01).
MessageFormat
Format of message data (wms_message_format_enum_v01).
MessageList
Stored messages.
MessageMode
Message mode (wms_message_mode_enum_v01).
MessageProtocol
Message protocol (wms_message_protocol_enum_v01).
MessageTag
Status tag of a stored message (wms_message_tag_type_enum_v01).
MessageType
Message type of a route (wms_message_type_enum_v01).
RawMessage
A stored message.
RawRead
Reads a stored message (QMI_WMS_RAW_READ).
ReceiptAction
What the modem does with a received message (wms_receipt_action_enum_v01).
Route
What the modem does with received messages of one class.
Routes
The routing table of the modem.
RpCause
RP cause of a failed acknowledgement, from 3GPP TS 24.011 (wms_rp_cause_send_ack_enum_v01).
SendAck
Acknowledges a transferred message to the network (QMI_WMS_SEND_ACK).
SetEventReport
Sets which event reports the modem sends to this client (QMI_WMS_SET_EVENT_REPORT).
SetRoutes
Writes the routing table (QMI_WMS_SET_ROUTES).
StorageType
Message storage (wms_storage_type_enum_v01).
StoredEntry
An entry of a MessageList.
StoredMessage
A message stored by the modem (wms_mt_message_type_v01).
TpCause
TP cause of a failed acknowledgement, from 3GPP TS 23.040 (wms_tp_cause_enum_v01).
TransferIndication
Where status reports go (wms_transfer_ind_enum_v01).
TransferredMessage
A message passed on without storing it (wms_transfer_route_mt_message_type_v01).
Wms
Marker of the WMS service for ql_qmi::Client.

Enums§

Error
Error returned by WMS operations.