Hi Tarmo,
On 10/31/19, Tarmo Kuuse <tarmo.kuuse(a)gmail.com> wrote:
Assuming you're using ofono to provide your 4G LTE connectivity,
it
provides a dbus interface where it exposes a lot of detail about GSM
status (including SIM serial, IMSI, current network, signal strength etc).
Yes, I am using ofono.
All you need is a dbus client. There's one in Debian package
"dbus"
called dbus-send. Some sample commands I use with ofono v 1.21:
# Get list of modems
$ sudo dbus-send --system --print-reply --dest=org.ofono /
org.ofono.Manager.GetModems
# Get general configuration of modem "/quectel_0"; enable roaming
$ sudo dbus-send --system --print-reply --dest=org.ofono /quectel_0
org.ofono.ConnectionManager.GetProperties
$ sudo dbus-send --system --print-reply --dest=org.ofono /quectel_0
org.ofono.ConnectionManager.SetProperty string:"RoamingAllowed"
variant:boolean:true
# Get status of network registration on modem "/quectel_0"
$ sudo dbus-send --system --print-reply --dest=org.ofono /quectel_0
org.ofono.NetworkRegistration.GetProperties
# List all GPRS contexts
$ sudo dbus-send --system --print-reply --dest=org.ofono /quectel_0
org.ofono.ConnectionManager.GetContexts
# Get status of GPRS context number 1
$ sudo dbus-send --system --print-reply --dest=org.ofono
/quectel_0/context1 org.ofono.ConnectionContext.GetProperties
That is great, I do have dbus-send in the device, but I know little
about it, I tried to play it, but could not get into array and dict
entry, sorry for asking a dbus-send syntax question, how could you run
dbus-send to display the array and dict entry for string
"CardIdentifier" variant value?
# dbus-send --system --print-reply --dest=org.ofono /ubloxqmi_0
org.ofono.SimManager.GetProperties
method return time=1572518707.814990 sender=:1.4 -> destination=:1.9 serial=85 2
array [
dict entry(
string "Present"
variant boolean true
)
dict entry(
string "CardIdentifier"
variant string "xxxxxxxxxxxxx"
)
............
I tried following command, apparently it is wrong, could you please
show me a correct command syntax?
# dbus-send --system --print-reply --dest=org.ofono /ubloxqmi_0
org.ofono.SimManager.array.dict:string:CardIdentifier
....incorrect Aborted
I've also used Python to build my own simple dbus client for GSM
monitoring purposes. I used the 'pydbus' library provided by Debian
package "python3-pydbus". You can look for other alternatives if you're
low on disk space, e.g. going with dbus-send or implementing your custom
dbus client in C/C++.
Yeah, long way to go :-), first have to lean the dbus-send command
line, my application is using C++, so I will use the C++.
Thank you so much Tarmo
Kind regards,
- jh