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§
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). - Event
Report - An event report (
QMI_WMS_EVENT_REPORT_IND). - Failure
Cause - Failure cause of a GSM/WCDMA acknowledgement
(
wms_3gpp_failure_information_type_v01). - GetRoutes
- Reads the routing table (
QMI_WMS_GET_ROUTES). - List
Messages - Lists stored messages (
QMI_WMS_LIST_MESSAGES). - Message
Class - Message class (
wms_message_class_enum_v01). - Message
Format - Format of message data (
wms_message_format_enum_v01). - Message
List - Stored messages.
- Message
Mode - Message mode (
wms_message_mode_enum_v01). - Message
Protocol - Message protocol (
wms_message_protocol_enum_v01). - Message
Tag - Status tag of a stored message (
wms_message_tag_type_enum_v01). - Message
Type - Message type of a route (
wms_message_type_enum_v01). - RawMessage
- A stored message.
- RawRead
- Reads a stored message (
QMI_WMS_RAW_READ). - Receipt
Action - 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). - SetEvent
Report - Sets which event reports the modem sends to this client
(
QMI_WMS_SET_EVENT_REPORT). - SetRoutes
- Writes the routing table (
QMI_WMS_SET_ROUTES). - Storage
Type - Message storage (
wms_storage_type_enum_v01). - Stored
Entry - An entry of a
MessageList. - Stored
Message - 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). - Transfer
Indication - Where status reports go (
wms_transfer_ind_enum_v01). - Transferred
Message - 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.