modemmonitor: use dbus-monitor

Instead of looping over mmcli commands to check for incoming
calls and texts every 3s, use dbus-monitor to tell us when
something is coming in.  This should save some battery life
as well as reduce the delay in new call/msg notification.

I was running on the latest released scripts, so have not
strictly tested this with git master.  Note that I dropped
the call to checkmissedcalls.  Perhaps we should still run
that at firststart?

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Serge E. Hallyn 4 years ago committed by Maarten van Gompel
parent 1b45e7743d
commit 99099a359f
  1. 16
      scripts/modem/sxmo_modemmonitor.sh

@ -125,12 +125,16 @@ checkfornewtexts() {
}
mainloop() {
while true; do
checkformissedcalls
checkforincomingcalls
checkfornewtexts
sleep $TIMEOUT & wait
done
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
while read line; do
checkforincomingcalls
done &
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
while read line; do
checkfornewtexts
done &
wait
wait
}
mainloop

Loading…
Cancel
Save