import sys
import gobject
+import string
import dbus
import dbus.service
"net.connman.Session")
except dbus.DBusException, e:
- if e.get_dbus_name() in ['net.connman.Error.InvalidArguments']:
+ if e.get_dbus_name() in ['net.connman.Error.Failed']:
print e.get_dbus_message()
return
traceback.print_exc()
try:
self.session.Connect()
except dbus.DBusException, e:
- if e.get_dbus_name() in ['net.connman.Error.InProgress',
- 'net.connman.Error.AlreadyConnected']:
+ if e.get_dbus_name() in ['net.connman.Error.Failed']:
print e.get_dbus_message()
return
traceback.print_exc()
try:
self.session.Disconnect()
except dbus.DBusException, e:
- if e.get_dbus_name() in ['net.connman.Error.AlreadyDisabled',
- 'net.connman.Error.NotConnected']:
+ if e.get_dbus_name() in ['net.connman.Error.Failed']:
print e.get_dbus_message()
return
traceback.print_exc()
val = self.type_convert(key, value)
self.session.Change(key, val)
except dbus.DBusException, e:
- if e.get_dbus_name() in ['net.connman.Error.InvalidArguments']:
+ if e.get_dbus_name() in ['net.connman.Error.Failed']:
print e.get_dbus_message()
return
traceback.print_exc()
app_path = sys.argv[2]
bus = dbus.SessionBus()
+ app_name = "com.example.SessionApplication.%s" % (string.strip(app_path, "/"))
+
if sys.argv[1] == "run":
- name = dbus.service.BusName("com.example.SessionApplication", bus)
+ name = dbus.service.BusName(app_name, bus)
mainloop = gobject.MainLoop()
app = SessionApplication(bus, app_path, mainloop)
mainloop.run()
return
- app = dbus.Interface(bus.get_object("com.example.SessionApplication", app_path),
+ app = dbus.Interface(bus.get_object(app_name, app_path),
"com.example.TestSession")
if sys.argv[1] == "create":