mirror of git://git.sysmocom.de/ofono
test: Add test-smart-messaging
This commit is contained in:
parent
59bbdd5d08
commit
8283d127e6
|
@ -417,7 +417,8 @@ test_scripts = test/backtrace \
|
|||
test/disable-gprs \
|
||||
test/get-icon \
|
||||
test/set-fast-dormancy \
|
||||
test/test-push-notification
|
||||
test/test-push-notification \
|
||||
test/test-smart-messaging
|
||||
|
||||
if TEST
|
||||
testdir = $(pkglibdir)/test
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import gobject
|
||||
|
||||
import sys
|
||||
import dbus
|
||||
import dbus.service
|
||||
import dbus.mainloop.glib
|
||||
|
||||
class SmartMessagingAgent(dbus.service.Object):
|
||||
@dbus.service.method("org.ofono.SmartMessagingAgent",
|
||||
in_signature="", out_signature="")
|
||||
def Release(self):
|
||||
print "Release"
|
||||
mainloop.quit()
|
||||
|
||||
@dbus.service.method("org.ofono.SmartMessagingAgent",
|
||||
in_signature="aya{sv}", out_signature="")
|
||||
def ReceiveBusinessCard(self, data, props):
|
||||
for key in props.keys():
|
||||
print "Key: %s, Value: %s" % (key, props[key])
|
||||
|
||||
string = ""
|
||||
for byte in data:
|
||||
string += str(byte)
|
||||
|
||||
print "Received Business Card:"
|
||||
print string
|
||||
|
||||
@dbus.service.method("org.ofono.SmartMessagingAgent",
|
||||
in_signature="aya{sv}", out_signature="")
|
||||
def ReceiveAppointment(self, data, props):
|
||||
for key in props.keys():
|
||||
print "Key: %s, Value: %s" % (key, props[key])
|
||||
|
||||
string = ""
|
||||
for byte in data:
|
||||
string += str(byte)
|
||||
|
||||
print "Received Appointment:"
|
||||
print string
|
||||
|
||||
if __name__ == '__main__':
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
manager = dbus.Interface(bus.get_object("org.ofono", "/"),
|
||||
"org.ofono.Manager")
|
||||
|
||||
modems = manager.GetModems()
|
||||
|
||||
for path, properties in modems:
|
||||
if "org.ofono.SmartMessaging" not in properties["Interfaces"]:
|
||||
continue
|
||||
|
||||
pn = dbus.Interface(bus.get_object('org.ofono', path),
|
||||
'org.ofono.SmartMessaging')
|
||||
|
||||
path = "/test/agent"
|
||||
agent = SmartMessagingAgent(bus, path)
|
||||
pn.RegisterAgent(path)
|
||||
print "Agent registered"
|
||||
|
||||
mainloop = gobject.MainLoop()
|
||||
mainloop.run()
|
Loading…
Reference in New Issue