summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-11-09 19:48:17 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-11-09 19:49:32 +0100
commit4c7e84f080fb2ae5e40b3b36c50d23bc2902c54c (patch)
treef7ad5edeb52e67cd6fcd19189a7d51f42b3434fc
parent62004b3e26104dc58c3d41b13f3d58f666e43ac3 (diff)
ofono: Remove the SmsWatcher.. but add an easy way to register
-rw-r--r--ofono-end-to-end/osmocom/sms.py27
1 files changed, 6 insertions, 21 deletions
diff --git a/ofono-end-to-end/osmocom/sms.py b/ofono-end-to-end/osmocom/sms.py
index d4dbda5..38fff30 100644
--- a/ofono-end-to-end/osmocom/sms.py
+++ b/ofono-end-to-end/osmocom/sms.py
@@ -15,27 +15,6 @@
import dbus
-sms = []
-
-class SmsWatcher:
- def __init__(self, sms):
- self.sms = sms
- self.watched = {}
- self.sms.connect_to_signal("MessageAdded", self._msg_added)
- self.sms.connect_to_signal("MessageRemoved", self._msg_removed)
-
- def _msg_added(self, property, value):
- self.watched[property] = 1
- print "PROP: ", property
- print "VA:: ", value
-
- def _msg_removed(self, property):
- try:
- del self.watched[property]
- except KeyError:
- pass
- print "PROP: ", property
-
class Sms(object):
def __init__(self, bus, name):
self.bus = bus
@@ -71,6 +50,12 @@ class SmsManager(object):
def get_message(self, path):
return Sms(self.bus, path)
+ def registerOnMsgAdded(self, cb):
+ self.sms.connect_to_signal('MessageAdded', cb)
+
+ def registerOnMsgRemoved(self, cb):
+ self.sms.connect_to_signal('MessageRemoved', cb)
+
def __repr__(self):
return "<SmsManager for Modem('%s')>" % self.name