ofono/test/test-modem

66 lines
1.6 KiB
Plaintext
Raw Normal View History

2009-05-21 21:21:15 +00:00
#!/usr/bin/python
import gobject
import dbus
import dbus.mainloop.glib
def property_changed(name, value):
print "Modem property %s changed to %s" % (name, value)
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')
2010-09-09 19:37:37 +00:00
modems = manager.GetModems()
modem = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
2009-05-21 21:21:15 +00:00
'org.ofono.Modem')
modem.connect_to_signal("PropertyChanged", property_changed)
properties = modem.GetProperties()
if properties.has_key('Name'):
print "Name: %s" % (properties['Name'])
2009-05-21 21:21:15 +00:00
if properties.has_key('Manufacturer'):
print "Manufacturer: %s" % (properties['Manufacturer'])
if properties.has_key('Model'):
print "Model: %s" % (properties['Model'])
if properties.has_key('Revision'):
print "Revision: %s" % (properties['Revision'])
if properties.has_key('Serial'):
print "Serial: %s" % (properties['Serial'])
if properties.has_key('Powered'):
print "Powered: %s" % (properties['Powered'])
if properties.has_key('Online'):
print "Online: %s" % (properties['Online'])
if properties.has_key('Lockdown'):
print "Lockdown: %s" % (properties['Lockdown'])
if properties.has_key('Emergency'):
print "Emergency: %s" % (properties['Emergency'])
if properties.has_key('Features'):
print "Features:"
for feature in properties["Features"]:
print " [ %s ]" % (feature)
if properties.has_key('Interfaces'):
print "Interfaces:"
for interface in properties["Interfaces"]:
print " [ %s ]" % (interface)
2009-05-21 21:21:15 +00:00
mainloop = gobject.MainLoop()
mainloop.run()