/usr/share/ofono/scripts/test-smart-messaging is in ofono-scripts 1.17.bzr6912+16.04.20160314.3-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #!/usr/bin/python3
from gi.repository import GLib
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 = GLib.MainLoop()
try:
mainloop.run()
except KeyboardInterrupt:
pn.UnregisterAgent(path)
mainloop.run()
|