Mercurial > libervia-backend
comparison frontends/sat_bridge_frontend/DBus.py @ 0:c4bc297b82f0
sat:
- first public release, initial commit
author | goffi@necton2 |
---|---|
date | Sat, 29 Aug 2009 13:34:59 +0200 |
parents | |
children | a06a151fc31f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c4bc297b82f0 |
---|---|
1 #!/usr/bin/python | |
2 #-*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 SAT communication bridge | |
6 Copyright (C) 2009 Jérôme Poisson (goffi@goffi.org) | |
7 | |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation, either version 3 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 """ | |
21 | |
22 from bridge_frontend import BridgeFrontend | |
23 import dbus, dbus.glib | |
24 | |
25 | |
26 class DBusBridgeFrontend(BridgeFrontend): | |
27 def __init__(self): | |
28 self.sessions_bus = dbus.SessionBus() | |
29 self.db_object = self.sessions_bus.get_object('org.goffi.SAT', | |
30 '/org/goffi/SAT/bridge') | |
31 self.db_comm_iface = dbus.Interface(self.db_object, | |
32 dbus_interface='org.goffi.SAT.communication') | |
33 self.db_req_iface = dbus.Interface(self.db_object, | |
34 dbus_interface='org.goffi.SAT.request') | |
35 #props = self.db_comm_iface.getProperties() | |
36 | |
37 def register(self, functionName, handler, iface="communication"): | |
38 if iface == "communication": | |
39 self.db_comm_iface.connect_to_signal(functionName, handler) | |
40 elif iface == "request": | |
41 self.db_req_iface.connect_to_signal(functionName, handler) | |
42 | |
43 def connect(self): | |
44 return self.db_comm_iface.connect() | |
45 | |
46 def getContacts(self): | |
47 return self.db_comm_iface.getContacts() | |
48 | |
49 def getPresenceStatus(self): | |
50 return self.db_comm_iface.getPresenceStatus() | |
51 | |
52 def sendMessage(self, to, message): | |
53 return self.db_comm_iface.sendMessage(to, message) | |
54 | |
55 def sendFile(self, to, path): | |
56 return self.db_comm_iface.sendFile(to, path) | |
57 | |
58 def setPresence(self, to="", type="", show="", status="", priority=0): | |
59 return self.db_comm_iface.setPresence(to, type, show, status, priority) | |
60 | |
61 def setParam(self, name, value, namespace="default"): | |
62 return self.db_comm_iface.setParam(name, value, namespace) | |
63 | |
64 def getParam(self, name, namespace="default"): | |
65 return self.db_comm_iface.getParam(name, namespace) | |
66 | |
67 def getParams(self, namespace="default"): | |
68 return self.db_comm_iface.getParams(namespace) | |
69 | |
70 def getParamsCategories(self): | |
71 return self.db_comm_iface.getParamsCategories() | |
72 | |
73 def getHistory(self, from_jid, to_jid, size): | |
74 return self.db_comm_iface.getHistory(from_jid, to_jid, size) | |
75 | |
76 def addContact(self, jid): | |
77 return self.db_comm_iface.addContact(jid) | |
78 | |
79 def delContact(self, jid): | |
80 return self.db_comm_iface.delContact(jid) | |
81 | |
82 def isConnected(self): | |
83 return self.db_comm_iface.isConnected() | |
84 | |
85 def confirmationAnswer(self, id, accepted, data): | |
86 return self.db_req_iface.confirmationAnswer(id, accepted, data) | |
87 | |
88 def getProgress(self, id): | |
89 return self.db_req_iface.getProgress(id) |