Translating AT commands to ModemManager commands?
Dan Williams
dcbw at redhat.com
Wed May 17 20:03:45 UTC 2017
On Wed, 2017-05-17 at 10:27 +0200, Einar Jón wrote:
> Hi
>
> I have a problem with our modems.
> We are trying to move from simple AT commands to using ModemManager
> in
> python, but we still have some connectivity tests that are only done
> with AT commands.
>
> I have been trying to search for the commands available on the DBus
> interface using the mmcli with introspection in python.
> I would like to replace these with something like:
> MODEM_IFACE='org.freedesktop.ModemManager1.Modem'
> value = self.modemProxy.Get(MODEM_IFACE, 'PowerState',
> dbus_interface=PROPERTIES_IFACE)
> logging.debug('PowerState: ' + str(value))
>
> Using these values.
> https://www.freedesktop.org/software/ModemManager/api/1.0.0/gdbus-org
> .freedesktop.ModemManager1.Modem.html
>
> Are the rest of the commands (or equivalent commans) avaliable?
>
> Commands used:
> # Testing that the modem is alive
> AT -> easy
> # Testing that the SIM is not locked
> AT+CPIN? -> 'UnlockRequired'
> # Testing Subscriber Identity
> AT+CIMI
Find your Modem object. Then grab the "Sim" property using the
org.freedesktop.DBus.Properties interface. Make a new D-Bus proxy for
the SIM object using that object path, then:
SIM_IFACE='org.freedesktop.ModemManager1.Sim'
value = self.simProxy.Get(SIM_IFACE, 'Imsi', dbus_interface=PROPERTIES_IFACE)
logging.debug('IMSI: ' + str(value))
> # Testing error level setting
> AT+CMEE=2
MM does this internally so it can get verbose errors. This is not
reflected externally. But I don't think you'll need to do this if
you're using ModemManager.
> # Testing Antenna Power
> AT+CIND?
That gets a lot of things. If you mean 'signal', that's basically the
same as AT+CSQ except on a scale of 1-5 instead of 1-31. So just use
AT+CSQ instead.
Or, which specific indicator are you looking for in the CIND response?
> # Testing check power mode
> AT+CFUN? 'PowerState'
> # Testing Signal Power
> AT+RSCP?
Some modems implement the "Signal" interface. So you can:
SIGNAL_IFACE='org.freedesktop.ModemManager1.Modem.Signal'
<create a
proxy for the modem object, for SIGNAL_IFACE>
signalProxy.Setup(5)
rscp =
0
while rscp = 0 AND timeElapsed < 30:
value =
self.modemProxy.Get(SIGNAL_IFACE, 'Umts',
dbus_interface=PROPERTIES_IFACE)
rscp = value["rscp"]
logging.debug('
IMSI: ' + str(value["rscp"]))
> # Testing Signal Quality
> AT+CSQ -> 'SignalQuality'
value = self.modemProxy.Get(MODEM_IFACE, 'SignalQuality', dbus_interface=PROPERTIES_IFACE)
> # Testing PLMN selection
> AT+COPS?
The modem probably implements the
"org.freedesktop.ModemManager1.Modem.Modem3gpp" interface, which has a
Scan() method you can call, which will (after a long delay) return
an array-of-dictionaries, each element representing a scanned operator.
Dan
More information about the ModemManager-devel
mailing list