aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2020-04-06 14:05:57 +0200
committerGuido Günther <agx@sigxcpu.org>2020-04-06 15:15:06 +0200
commitdcb59c1d1738319268d3a46d87a5ba506268462a (patch)
tree197be6b549d593b2894c339a449a769e0983a9f7
parentce8e4040d59c4f351724e6a731716c42dbbb44cc (diff)
mmproxy: Introduce modem object
This allows us to keep needed interfaces around
-rw-r--r--src/ppm/modemproxy.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ppm/modemproxy.py b/src/ppm/modemproxy.py
index 314068f..2d0e7ae 100644
--- a/src/ppm/modemproxy.py
+++ b/src/ppm/modemproxy.py
@@ -31,6 +31,15 @@ class ModemError(Exception):
return [False, True][self.msg.find("not enabled") != -1]
+class Modem(GObject.GObject):
+ def __init__(self, path):
+ GObject.GObject.__init__(self)
+ self._path = path
+
+ @property
+ def path(self):
+ return self._path
+
class ModemManagerProxy(GObject.GObject):
"""Interface to ModemManager DBus API
@ivar request: current pending request to ModemManager
@@ -167,7 +176,7 @@ class ModemManagerProxy(GObject.GObject):
for obj in objs:
for path, ifaces in obj.items():
if self.MM_DBUS_INTERFACE_MODEM in ifaces:
- self._modems.append(path)
+ self._modems.append(Modem(path))
logging.debug("Found modems: %s", self.modems)
self.emit('got-modems', self)
@@ -190,7 +199,7 @@ class ModemManagerProxy(GObject.GObject):
self.MM_DBUS_FLAGS,
None,
self.MM_DBUS_SERVICE,
- self.objects()[self.modem][self.MM_DBUS_INTERFACE_MODEM]['Sim'],
+ self.objects()[self.modem.path][self.MM_DBUS_INTERFACE_MODEM]['Sim'],
self.DBUS_INTERFACE_PROPERTIES,
None)
try:
@@ -210,7 +219,7 @@ class ModemManagerProxy(GObject.GObject):
self.MM_DBUS_FLAGS,
None,
self.MM_DBUS_SERVICE,
- self.modem,
+ self.modem.path,
self.MM_DBUS_INTERFACE_MODEM_GSM_USSD,
None)
ussd.call("Initiate", GLib.Variant('(s)', (command,)),
@@ -223,7 +232,7 @@ class ModemManagerProxy(GObject.GObject):
self.MM_DBUS_FLAGS,
None,
self.MM_DBUS_SERVICE,
- self.modem,
+ self.modem.path,
self.MM_DBUS_INTERFACE_MODEM,
None)
ussd.call("Enable", GLib.Variant('(b)', (enable,)),