def __init__(self): OdsBase.__init__(self, "org.openobex.Manager", "/org/openobex") self.Servers = {} self.Sessions = {} self.Handle("SessionClosed", self.on_session_closed) self.Handle("SessionConnectError", self.on_session_error) self.Handle("SessionConnected", self.on_session_connected)
def __init__(self, obj_path): OdsBase.__init__(self, "org.openobex.Session", obj_path) self.Connected = False self.Handle("Cancelled", self.on_cancelled) self.Handle("Disconnected", self.on_disconnected) self.Handle("TransferStarted", self.on_trans_started) self.Handle("TransferProgress", self.on_trans_progress) self.Handle("TransferCompleted", self.on_trans_complete) self.Handle("ErrorOccurred", self.on_error)
def __init__(self, obj_path): OdsBase.__init__(self, "org.openobex.ServerSession", obj_path) self.Handle("Cancelled", self.on_cancelled) self.Handle("Disconnected", self.on_disconnected) self.Handle("TransferStarted", self.on_trans_started) self.Handle("TransferProgress", self.on_trans_progress) self.Handle("TransferCompleted", self.on_trans_complete) self.Handle("ErrorOccurred", self.on_error)
def __init__(self, obj_path): OdsBase.__init__(self, "org.openobex.Server", obj_path) self.Handle("Started", self.on_started) self.Handle("Stopped", self.on_stopped) self.Handle("Closed", self.on_closed) self.Handle("ErrorOccured", self.on_error) self.Handle("SessionCreated", self.on_session_created) self.Handle("SessionRemoved", self.on_session_removed) self.sessions = {}
def DisconnectAll(self, *args): def on_destroyed(inst, path): if len(self.Servers) - 1 == 0: OdsBase.DisconnectAll(self, *args) OdsBase.GHandle(self, "server-destroyed", on_destroyed) if len(self.Servers) == 0: on_destroyed(None) else: for k, v in self.Servers.items(): self.destroy_server(k)
def DisconnectAll(self, *args): for k, v in self.sessions.iteritems(): v.DisconnectAll() self.sessions = {} OdsBase.DisconnectAll(self, *args)
def on_destroyed(inst, path): if len(self.Servers) - 1 == 0: OdsBase.DisconnectAll(self, *args)