About LIBQMI APIs

Aleksander Morgado aleksander at aleksander.es
Thu Mar 18 10:58:14 UTC 2021


Hey,

>
> I am looking at QMI APIs, specially interested in
>
> qmi_client_wds_start_network ()
>
> The references that I could find for the usage of this are only in qmicli and modem manager. Initially I thought that the API can be used directly, but looking at the approach followed in QMICLI, it looks like there is a need for a set of APIs to be called in a specific sequence, before the start API can be used. Is that correct? And for someone new to libqmi and wondering if the modem can be enabled with use of QMI APIs included in build, instead of using QMICLI or QMI-NETWORK, is there any other simpler approach than that is followed in QMICLI?
>
> In short, lets say I don't want anything other than just to start/stop the data connection on the modem with a simple set of QMI APIs, is that possible?
>
> Any inputs are greatly appreciated.
>

Before using qmi_client_wds_start_network() you need to allocate a
"WDS QMI client". All the WDS operations require a client to be
allocated in advance; the same way as all operations in other services
like DMS or NAS also require a client of the specific service to be
allocated in advance.

The client allocation procedure is done using the CTL service (the
only service for which no specific client needs to be allocated), but
this service is "hidden" to the libqmi API user behind QmiDevice
operations; e.g. in your case you need qmi_device_allocate_client().

So, if you want to write an application using libqmi and the minimal
number of steps required to call the WDS start network operation,
you'll need to:
 * qmi_device_new()
 * qmi_device_allocate_client (device, WDS)
 * qmi_client_wds_set_ip_family(client, ....)     --> optional if
ip-type not set in start network
 * qmi_client_wds_start_network(client, ...)    --> returns packet-data-handle

And once you want to stop the connection:
 * qmi_client_wds_stop_network(client, packet-data-handle)
 * qmi_device_release_client(device,client)

-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list