Merge lp:~boiko/telepathy-ofono/fix_python_errors into lp:telepathy-ofono/legacy
- fix_python_errors
- Merge into legacy
Status: | Merged |
---|---|
Approved by: | Renato Araujo Oliveira Filho |
Approved revision: | 88 |
Merged at revision: | 85 |
Proposed branch: | lp:~boiko/telepathy-ofono/fix_python_errors |
Merge into: | lp:telepathy-ofono/legacy |
Diff against target: |
1365 lines (+205/-236) 25 files modified
debian/changelog (+6/-0) tpofono/__init__.py (+4/-2) tpofono/aliasing.py (+3/-27) tpofono/call/__init__.py (+2/-0) tpofono/call/content.py (+10/-11) tpofono/capabilities.py (+7/-12) tpofono/channel/__init__.py (+9/-10) tpofono/channel/call.py (+34/-35) tpofono/channel/text.py (+28/-28) tpofono/channel_manager.py (+3/-9) tpofono/connection.py (+30/-41) tpofono/connection_manager.py (+2/-3) tpofono/contacts.py (+23/-24) tpofono/debug.py (+1/-0) tpofono/handle.py (+2/-2) tpofono/ofono/__init__.py (+8/-0) tpofono/ofono/ofonocall.py (+3/-4) tpofono/ofono/ofonocalls.py (+2/-3) tpofono/ofono/ofonocallvolume.py (+2/-2) tpofono/ofono/ofonomanager.py (+3/-2) tpofono/ofono/ofonomessages.py (+1/-3) tpofono/ofono/ofonomodem.py (+2/-1) tpofono/ofono/ofonovoicemail.py (+7/-3) tpofono/presence.py (+6/-8) tpofono/protocol.py (+7/-6) |
To merge this branch: | bzr merge lp:~boiko/telepathy-ofono/fix_python_errors |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Renato Araujo Oliveira Filho (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Sergio Schvezov | Needs Information | ||
Review via email: mp+155615@code.launchpad.net |
Commit message
Fix python errors reported by pyflakes and pep8.
Description of the change
Fix python errors reported by pyflakes and pep8.
PS Jenkins bot (ps-jenkins) wrote : | # |
Sergio Schvezov (sergiusens) wrote : | # |
Do you intent not to fix these?
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
./tpofono/
- 88. By Gustavo Pichorim Boiko
-
Fix more errors reported by pep8 from raring.
Gustavo Pichorim Boiko (boiko) wrote : | # |
> Do you intent not to fix these?
I have fixed all but the long lines ones.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:88
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
After a chat with Gustavo we decided to keep the "line too long" because this does not worth the effort to fix it, and the code will be ported to qt.
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2013-02-20 19:47:34 +0000 | |||
3 | +++ debian/changelog 2013-03-28 19:50:24 +0000 | |||
4 | @@ -1,3 +1,9 @@ | |||
5 | 1 | telepathy-ofono (0.25) quantal; urgency=low | ||
6 | 2 | |||
7 | 3 | * Fix python errors reported by pyflakes and pep8 (LP: #1124783) | ||
8 | 4 | |||
9 | 5 | -- Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> Tue, 26 Mar 2013 18:13:32 -0300 | ||
10 | 6 | |||
11 | 1 | telepathy-ofono (0.24) quantal; urgency=low | 7 | telepathy-ofono (0.24) quantal; urgency=low |
12 | 2 | 8 | ||
13 | 3 | * Watch for changes in modem interfaces and only use modems that already have | 9 | * Watch for changes in modem interfaces and only use modems that already have |
14 | 4 | 10 | ||
15 | === modified file 'tpofono/__init__.py' | |||
16 | --- tpofono/__init__.py 2013-02-19 20:09:40 +0000 | |||
17 | +++ tpofono/__init__.py 2013-03-28 19:50:24 +0000 | |||
18 | @@ -16,5 +16,7 @@ | |||
19 | 16 | # You should have received a copy of the GNU General Public License | 16 | # You should have received a copy of the GNU General Public License |
20 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | 18 | 18 | ||
24 | 19 | from connection_manager import * | 19 | from connection_manager import oFonoConnectionManager |
25 | 20 | from debug import * | 20 | from debug import oFonoDebug |
26 | 21 | |||
27 | 22 | __all__ = ['oFonoConnectionManager', 'oFonoDebug'] | ||
28 | 21 | 23 | ||
29 | === modified file 'tpofono/aliasing.py' | |||
30 | --- tpofono/aliasing.py 2013-02-19 20:09:40 +0000 | |||
31 | +++ tpofono/aliasing.py 2013-03-28 19:50:24 +0000 | |||
32 | @@ -26,6 +26,7 @@ | |||
33 | 26 | 26 | ||
34 | 27 | logger = logging.getLogger('oFono.Aliasing') | 27 | logger = logging.getLogger('oFono.Aliasing') |
35 | 28 | 28 | ||
36 | 29 | |||
37 | 29 | class oFonoAliasing( | 30 | class oFonoAliasing( |
38 | 30 | telepathy.server.ConnectionInterfaceAliasing): | 31 | telepathy.server.ConnectionInterfaceAliasing): |
39 | 31 | 32 | ||
40 | @@ -58,15 +59,6 @@ | |||
41 | 58 | handle.pending_alias = alias | 59 | handle.pending_alias = alias |
42 | 59 | continue | 60 | continue |
43 | 60 | 61 | ||
44 | 61 | new_alias = alias.encode("utf-8") | ||
45 | 62 | old_alias = contact.infos.get(ContactGeneral.ANNOTATIONS, {}).\ | ||
46 | 63 | get(ContactAnnotations.NICKNAME, None) | ||
47 | 64 | if new_alias == old_alias: | ||
48 | 65 | continue | ||
49 | 66 | |||
50 | 67 | infos = {ContactGeneral.ANNOTATIONS : | ||
51 | 68 | {ContactAnnotations.NICKNAME : new_alias} | ||
52 | 69 | } | ||
53 | 70 | #TODO: update contact info | 62 | #TODO: update contact info |
54 | 71 | else: | 63 | else: |
55 | 72 | logger.info("Self alias changed to '%s'" % alias) | 64 | logger.info("Self alias changed to '%s'" % alias) |
56 | @@ -77,14 +69,14 @@ | |||
57 | 77 | handle = self.handle(telepathy.HANDLE_TYPE_CONTACT, handle_id) | 69 | handle = self.handle(telepathy.HANDLE_TYPE_CONTACT, handle_id) |
58 | 78 | logger.info("Getting the alias for the handle name %s" % handle.name) | 70 | logger.info("Getting the alias for the handle name %s" % handle.name) |
59 | 79 | return handle.name | 71 | return handle.name |
61 | 80 | 72 | ||
62 | 81 | if (handle == self._self_handle): | 73 | if (handle == self._self_handle): |
63 | 82 | return handle.name | 74 | return handle.name |
64 | 83 | 75 | ||
65 | 84 | #self.fill_contact_info(handle_id) | 76 | #self.fill_contact_info(handle_id) |
66 | 85 | if not handle_id in self.contactInfo: | 77 | if not handle_id in self.contactInfo: |
67 | 86 | return handle.name | 78 | return handle.name |
69 | 87 | 79 | ||
70 | 88 | alias = None | 80 | alias = None |
71 | 89 | contact = self.contactInfo[handle_id] | 81 | contact = self.contactInfo[handle_id] |
72 | 90 | if len(contact['alias']) != 0: | 82 | if len(contact['alias']) != 0: |
73 | @@ -110,19 +102,3 @@ | |||
74 | 110 | alias = contact.display_name | 102 | alias = contact.display_name |
75 | 111 | alias = unicode(alias, 'utf-8')""" | 103 | alias = unicode(alias, 'utf-8')""" |
76 | 112 | return alias | 104 | return alias |
77 | 113 | |||
78 | 114 | def _contact_alias_changed(self, contact): | ||
79 | 115 | alias = None | ||
80 | 116 | |||
81 | 117 | handle = self.ensure_contact_handle(contact) | ||
82 | 118 | if handle != self._self_handle: | ||
83 | 119 | alias = contact.infos.get(ContactGeneral.ANNOTATIONS, {}).\ | ||
84 | 120 | get(ContactAnnotations.NICKNAME, None) | ||
85 | 121 | |||
86 | 122 | if alias == "" or alias is None: | ||
87 | 123 | alias = contact.display_name | ||
88 | 124 | |||
89 | 125 | alias = unicode(alias, 'utf-8') | ||
90 | 126 | logger.info("Contact %s alias changed to '%s'" % (unicode(handle), alias)) | ||
91 | 127 | self.AliasesChanged([(handle, alias)]) | ||
92 | 128 | |||
93 | 129 | 105 | ||
94 | === modified file 'tpofono/call/__init__.py' | |||
95 | --- tpofono/call/__init__.py 2013-02-19 20:09:40 +0000 | |||
96 | +++ tpofono/call/__init__.py 2013-03-28 19:50:24 +0000 | |||
97 | @@ -16,3 +16,5 @@ | |||
98 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
99 | 17 | 17 | ||
100 | 18 | from content import oFonoCallContent | 18 | from content import oFonoCallContent |
101 | 19 | |||
102 | 20 | __all__ = ['oFonoCallContent'] | ||
103 | 19 | 21 | ||
104 | === modified file 'tpofono/call/content.py' | |||
105 | --- tpofono/call/content.py 2013-02-19 20:09:40 +0000 | |||
106 | +++ tpofono/call/content.py 2013-03-28 19:50:24 +0000 | |||
107 | @@ -16,21 +16,21 @@ | |||
108 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
109 | 17 | 17 | ||
110 | 18 | import logging | 18 | import logging |
111 | 19 | import weakref | ||
112 | 20 | import dbus | 19 | import dbus |
113 | 21 | 20 | ||
114 | 22 | import telepathy | 21 | import telepathy |
116 | 23 | from telepathy.interfaces import CALL_CONTENT, CALL_CONTENT_INTERFACE_DTMF | 22 | from telepathy.interfaces import CALL_CONTENT |
117 | 24 | from telepathy._generated.Call_Content import CallContent | 23 | from telepathy._generated.Call_Content import CallContent |
118 | 25 | from telepathy._generated.Call_Content_Interface_DTMF import CallContentInterfaceDTMF | 24 | from telepathy._generated.Call_Content_Interface_DTMF import CallContentInterfaceDTMF |
119 | 26 | 25 | ||
121 | 27 | __all__ = ['oFonoCallContent.py'] | 26 | __all__ = ['oFonoCallContent'] |
122 | 28 | 27 | ||
123 | 29 | logger = logging.getLogger('oFono.CallContent') | 28 | logger = logging.getLogger('oFono.CallContent') |
124 | 30 | 29 | ||
128 | 31 | class oFonoCallContent(CallContent, | 30 | |
129 | 32 | telepathy.server.DBusProperties, | 31 | class oFonoCallContent(CallContent, |
130 | 33 | CallContentInterfaceDTMF): | 32 | telepathy.server.DBusProperties, |
131 | 33 | CallContentInterfaceDTMF): | ||
132 | 34 | 34 | ||
133 | 35 | def __init__(self, channel, name, contentType, conn, object_path=None, bus_name=None): | 35 | def __init__(self, channel, name, contentType, conn, object_path=None, bus_name=None): |
134 | 36 | CallContent.__init__(self, conn, object_path=object_path, bus_name=bus_name) | 36 | CallContent.__init__(self, conn, object_path=object_path, bus_name=bus_name) |
135 | @@ -46,7 +46,7 @@ | |||
136 | 46 | 'Name': CALL_CONTENT, | 46 | 'Name': CALL_CONTENT, |
137 | 47 | 'Type': CALL_CONTENT, | 47 | 'Type': CALL_CONTENT, |
138 | 48 | 'Disposition': CALL_CONTENT, | 48 | 'Disposition': CALL_CONTENT, |
140 | 49 | 'Interfaces' : CALL_CONTENT, | 49 | 'Interfaces': CALL_CONTENT, |
141 | 50 | }) | 50 | }) |
142 | 51 | 51 | ||
143 | 52 | self._implement_property_get(CALL_CONTENT, { | 52 | self._implement_property_get(CALL_CONTENT, { |
144 | @@ -54,13 +54,13 @@ | |||
145 | 54 | 'Type': lambda: dbus.UInt32(self._type), | 54 | 'Type': lambda: dbus.UInt32(self._type), |
146 | 55 | 'Disposition': lambda: dbus.UInt32(self._disposition), | 55 | 'Disposition': lambda: dbus.UInt32(self._disposition), |
147 | 56 | 'Streams': lambda: dbus.Array([], signature="o"), | 56 | 'Streams': lambda: dbus.Array([], signature="o"), |
149 | 57 | 'Interfaces' : lambda: dbus.Array(self._interfaces, signature="s"), | 57 | 'Interfaces': lambda: dbus.Array(self._interfaces, signature="s"), |
150 | 58 | }) | 58 | }) |
151 | 59 | 59 | ||
152 | 60 | def Remove(self): | 60 | def Remove(self): |
153 | 61 | self._channel.removeContent(self) | 61 | self._channel.removeContent(self) |
154 | 62 | self.remove_from_connection() | 62 | self.remove_from_connection() |
156 | 63 | self._channel = None | 63 | self._channel = None |
157 | 64 | 64 | ||
158 | 65 | def StartTone(self, event): | 65 | def StartTone(self, event): |
159 | 66 | logger.info("StartTone called") | 66 | logger.info("StartTone called") |
160 | @@ -76,10 +76,9 @@ | |||
161 | 76 | else: | 76 | else: |
162 | 77 | # convert number to ascii value | 77 | # convert number to ascii value |
163 | 78 | ofonoEvent = event + 48 | 78 | ofonoEvent = event + 48 |
165 | 79 | 79 | ||
166 | 80 | self._channel._conn.SendTones(chr(ofonoEvent)) | 80 | self._channel._conn.SendTones(chr(ofonoEvent)) |
167 | 81 | 81 | ||
168 | 82 | def StopTone(self): | 82 | def StopTone(self): |
169 | 83 | logger.info("StopTone called") | 83 | logger.info("StopTone called") |
170 | 84 | pass | 84 | pass |
171 | 85 | |||
172 | 86 | 85 | ||
173 | === modified file 'tpofono/capabilities.py' | |||
174 | --- tpofono/capabilities.py 2013-02-19 20:09:40 +0000 | |||
175 | +++ tpofono/capabilities.py 2013-03-28 19:50:24 +0000 | |||
176 | @@ -25,23 +25,24 @@ | |||
177 | 25 | 25 | ||
178 | 26 | logger = logging.getLogger('oFono.Capabilities') | 26 | logger = logging.getLogger('oFono.Capabilities') |
179 | 27 | 27 | ||
180 | 28 | |||
181 | 28 | class oFonoCapabilities( | 29 | class oFonoCapabilities( |
182 | 29 | telepathy.server.ConnectionInterfaceCapabilities, | 30 | telepathy.server.ConnectionInterfaceCapabilities, |
183 | 30 | telepathy.server.ConnectionInterfaceContactCapabilities): | 31 | telepathy.server.ConnectionInterfaceContactCapabilities): |
184 | 31 | 32 | ||
185 | 32 | text_chat_class = \ | 33 | text_chat_class = \ |
186 | 33 | ({telepathy.CHANNEL_INTERFACE + '.ChannelType': | 34 | ({telepathy.CHANNEL_INTERFACE + '.ChannelType': |
188 | 34 | telepathy.CHANNEL_TYPE_TEXT, | 35 | telepathy.CHANNEL_TYPE_TEXT, |
189 | 35 | telepathy.CHANNEL_INTERFACE + '.TargetHandleType': | 36 | telepathy.CHANNEL_INTERFACE + '.TargetHandleType': |
191 | 36 | dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)}, | 37 | dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)}, |
192 | 37 | [telepathy.CHANNEL_INTERFACE + '.TargetHandle', | 38 | [telepathy.CHANNEL_INTERFACE + '.TargetHandle', |
193 | 38 | telepathy.CHANNEL_INTERFACE + '.TargetID']) | 39 | telepathy.CHANNEL_INTERFACE + '.TargetID']) |
194 | 39 | 40 | ||
195 | 40 | audio_chat_class = \ | 41 | audio_chat_class = \ |
196 | 41 | ({telepathy.CHANNEL_INTERFACE + '.ChannelType': | 42 | ({telepathy.CHANNEL_INTERFACE + '.ChannelType': |
198 | 42 | telepathy.CHANNEL_TYPE_CALL, | 43 | telepathy.CHANNEL_TYPE_CALL, |
199 | 43 | telepathy.CHANNEL_INTERFACE + '.TargetHandleType': | 44 | telepathy.CHANNEL_INTERFACE + '.TargetHandleType': |
201 | 44 | dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)}, | 45 | dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)}, |
202 | 45 | [telepathy.CHANNEL_INTERFACE + '.TargetHandle', | 46 | [telepathy.CHANNEL_INTERFACE + '.TargetHandle', |
203 | 46 | telepathy.CHANNEL_INTERFACE + '.TargetID', | 47 | telepathy.CHANNEL_INTERFACE + '.TargetID', |
204 | 47 | telepathy.CHANNEL_TYPE_CALL + '.InitialAudio']) | 48 | telepathy.CHANNEL_TYPE_CALL + '.InitialAudio']) |
205 | @@ -52,9 +53,7 @@ | |||
206 | 52 | 53 | ||
207 | 53 | self._update_capabilities_calls = [] | 54 | self._update_capabilities_calls = [] |
208 | 54 | 55 | ||
209 | 55 | |||
210 | 56 | ### Capabilities interface ----------------------------------------------- | 56 | ### Capabilities interface ----------------------------------------------- |
211 | 57 | |||
212 | 58 | def _get_capabilities(self, contact): | 57 | def _get_capabilities(self, contact): |
213 | 59 | gen_caps = 0 | 58 | gen_caps = 0 |
214 | 60 | spec_caps = 0 | 59 | spec_caps = 0 |
215 | @@ -90,9 +89,7 @@ | |||
216 | 90 | if diff is not None: | 89 | if diff is not None: |
217 | 91 | self.CapabilitiesChanged([diff]) | 90 | self.CapabilitiesChanged([diff]) |
218 | 92 | 91 | ||
219 | 93 | |||
220 | 94 | ### ContactCapabilities interface ---------------------------------------- | 92 | ### ContactCapabilities interface ---------------------------------------- |
221 | 95 | |||
222 | 96 | def AdvertiseCapabilities(self, add, remove): | 93 | def AdvertiseCapabilities(self, add, remove): |
223 | 97 | return telepathy.server.ConnectionInterfaceCapabilities.\ | 94 | return telepathy.server.ConnectionInterfaceCapabilities.\ |
224 | 98 | AdvertiseCapabilities(self, add, remove) | 95 | AdvertiseCapabilities(self, add, remove) |
225 | @@ -106,7 +103,7 @@ | |||
226 | 106 | # Signal. | 103 | # Signal. |
227 | 107 | if changed: | 104 | if changed: |
228 | 108 | updated = dbus.Dictionary({self._self_handle: self._contact_caps[self._self_handle]}, | 105 | updated = dbus.Dictionary({self._self_handle: self._contact_caps[self._self_handle]}, |
230 | 109 | signature='ua(a{sv}as)') | 106 | signature='ua(a{sv}as)') |
231 | 110 | self.ContactCapabilitiesChanged(updated) | 107 | self.ContactCapabilitiesChanged(updated) |
232 | 111 | 108 | ||
233 | 112 | def _get_contact_capabilities(self, contact): | 109 | def _get_contact_capabilities(self, contact): |
234 | @@ -120,14 +117,12 @@ | |||
235 | 120 | caps = {} | 117 | caps = {} |
236 | 121 | for handle in handles: | 118 | for handle in handles: |
237 | 122 | caps[handle] = self._get_contact_capabilities(handle.contact) | 119 | caps[handle] = self._get_contact_capabilities(handle.contact) |
239 | 123 | self._contact_caps[handle.id] = caps[handle] # update global dict | 120 | self._contact_caps[handle.id] = caps[handle] # update global dict |
240 | 124 | 121 | ||
241 | 125 | ret = dbus.Dictionary(caps, signature='ua(a{sv}as)') | 122 | ret = dbus.Dictionary(caps, signature='ua(a{sv}as)') |
242 | 126 | self.ContactCapabilitiesChanged(ret) | 123 | self.ContactCapabilitiesChanged(ret) |
243 | 127 | 124 | ||
244 | 128 | |||
245 | 129 | ### Initialization ------------------------------------------------------- | 125 | ### Initialization ------------------------------------------------------- |
246 | 130 | |||
247 | 131 | def _populate_capabilities(self): | 126 | def _populate_capabilities(self): |
248 | 132 | """ Add the default capabilities to all contacts in our | 127 | """ Add the default capabilities to all contacts in our |
249 | 133 | contacts list.""" | 128 | contacts list.""" |
250 | 134 | 129 | ||
251 | === modified file 'tpofono/channel/__init__.py' | |||
252 | --- tpofono/channel/__init__.py 2013-02-19 20:09:40 +0000 | |||
253 | +++ tpofono/channel/__init__.py 2013-03-28 19:50:24 +0000 | |||
254 | @@ -21,23 +21,22 @@ | |||
255 | 21 | 21 | ||
256 | 22 | import telepathy | 22 | import telepathy |
257 | 23 | 23 | ||
258 | 24 | from tpofono.handle import oFonoHandleFactory | ||
259 | 25 | |||
260 | 26 | __all__ = ['oFonoChannel'] | 24 | __all__ = ['oFonoChannel'] |
261 | 27 | 25 | ||
262 | 28 | logger = logging.getLogger('oFono.Channel') | 26 | logger = logging.getLogger('oFono.Channel') |
263 | 29 | 27 | ||
264 | 28 | |||
265 | 30 | class oFonoChannel(object): | 29 | class oFonoChannel(object): |
266 | 31 | def __init__(self, conn, props): | 30 | def __init__(self, conn, props): |
267 | 32 | # If we have InitiatorHandle set in our new channel, use that, | 31 | # If we have InitiatorHandle set in our new channel, use that, |
268 | 33 | if telepathy.CHANNEL_INTERFACE + '.InitiatorHandle' in props: | 32 | if telepathy.CHANNEL_INTERFACE + '.InitiatorHandle' in props: |
269 | 34 | self._initiator = conn.handle(telepathy.HANDLE_TYPE_CONTACT, | 33 | self._initiator = conn.handle(telepathy.HANDLE_TYPE_CONTACT, |
271 | 35 | props[telepathy.CHANNEL_INTERFACE + '.InitiatorHandle']) | 34 | props[telepathy.CHANNEL_INTERFACE + '.InitiatorHandle']) |
272 | 36 | 35 | ||
273 | 37 | # otherwise use InitiatorID. | 36 | # otherwise use InitiatorID. |
274 | 38 | elif telepathy.CHANNEL_INTERFACE + '.InitiatorID' in props: | 37 | elif telepathy.CHANNEL_INTERFACE + '.InitiatorID' in props: |
275 | 39 | self._initiator = conn.ensure_handle(telepathy.HANDLE_TYPE_CONTACT, | 38 | self._initiator = conn.ensure_handle(telepathy.HANDLE_TYPE_CONTACT, |
277 | 40 | props[telepathy.CHANNEL_INTERFACE + '.InitiatorID']) | 39 | props[telepathy.CHANNEL_INTERFACE + '.InitiatorID']) |
278 | 41 | 40 | ||
279 | 42 | # If we don't have either of the above but we requested the channel, | 41 | # If we don't have either of the above but we requested the channel, |
280 | 43 | # then we're the initiator. | 42 | # then we're the initiator. |
281 | @@ -51,11 +50,11 @@ | |||
282 | 51 | # Don't implement the initiator properties if we don't have one. | 50 | # Don't implement the initiator properties if we don't have one. |
283 | 52 | if self._initiator: | 51 | if self._initiator: |
284 | 53 | self._implement_property_get(telepathy.CHANNEL_INTERFACE, { | 52 | self._implement_property_get(telepathy.CHANNEL_INTERFACE, { |
288 | 54 | 'InitiatorHandle': lambda: dbus.UInt32(self._initiator.id), | 53 | 'InitiatorHandle': lambda: dbus.UInt32(self._initiator.id), |
289 | 55 | 'InitiatorID': lambda: self._initiator.name | 54 | 'InitiatorID': lambda: self._initiator.name |
290 | 56 | }) | 55 | }) |
291 | 57 | 56 | ||
292 | 58 | self._add_immutable_properties({ | 57 | self._add_immutable_properties({ |
296 | 59 | 'InitiatorHandle': telepathy.CHANNEL_INTERFACE, | 58 | 'InitiatorHandle': telepathy.CHANNEL_INTERFACE, |
297 | 60 | 'InitiatorID': telepathy.CHANNEL_INTERFACE, | 59 | 'InitiatorID': telepathy.CHANNEL_INTERFACE, |
298 | 61 | }) | 60 | }) |
299 | 62 | 61 | ||
300 | === modified file 'tpofono/channel/call.py' | |||
301 | --- tpofono/channel/call.py 2013-02-19 20:09:40 +0000 | |||
302 | +++ tpofono/channel/call.py 2013-03-28 19:50:24 +0000 | |||
303 | @@ -16,7 +16,6 @@ | |||
304 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
305 | 17 | 17 | ||
306 | 18 | import logging | 18 | import logging |
307 | 19 | import weakref | ||
308 | 20 | import dbus | 19 | import dbus |
309 | 21 | 20 | ||
310 | 22 | import telepathy | 21 | import telepathy |
311 | @@ -25,7 +24,7 @@ | |||
312 | 25 | from tpofono.ofono.ofonocall import oFonoCall | 24 | from tpofono.ofono.ofonocall import oFonoCall |
313 | 26 | from tpofono.call import oFonoCallContent | 25 | from tpofono.call import oFonoCallContent |
314 | 27 | 26 | ||
316 | 28 | from telepathy.interfaces import CHANNEL_INTERFACE, CHANNEL_TYPE_CALL, CALL_INTERFACE_MUTE, CHANNEL_INTERFACE_HOLD | 27 | from telepathy.interfaces import CHANNEL_TYPE_CALL, CALL_INTERFACE_MUTE, CHANNEL_INTERFACE_HOLD |
317 | 29 | from telepathy.constants import LOCAL_MUTE_STATE_UNMUTED, LOCAL_MUTE_STATE_MUTED, LOCAL_HOLD_STATE_REASON_REQUESTED, LOCAL_HOLD_STATE_UNHELD, LOCAL_HOLD_STATE_HELD | 28 | from telepathy.constants import LOCAL_MUTE_STATE_UNMUTED, LOCAL_MUTE_STATE_MUTED, LOCAL_HOLD_STATE_REASON_REQUESTED, LOCAL_HOLD_STATE_UNHELD, LOCAL_HOLD_STATE_HELD |
318 | 30 | from telepathy._generated.Call_Interface_Mute import CallInterfaceMute | 29 | from telepathy._generated.Call_Interface_Mute import CallInterfaceMute |
319 | 31 | from telepathy._generated.Channel_Interface_Hold import ChannelInterfaceHold | 30 | from telepathy._generated.Channel_Interface_Hold import ChannelInterfaceHold |
320 | @@ -34,7 +33,7 @@ | |||
321 | 34 | 33 | ||
322 | 35 | logger = logging.getLogger('oFono.CallChannel') | 34 | logger = logging.getLogger('oFono.CallChannel') |
323 | 36 | 35 | ||
325 | 37 | # FIXME: we need to implement also Call1.Interface.Mute | 36 | |
326 | 38 | class oFonoCallChannel( | 37 | class oFonoCallChannel( |
327 | 39 | oFonoChannel, | 38 | oFonoChannel, |
328 | 40 | telepathy.server.ChannelTypeCall, | 39 | telepathy.server.ChannelTypeCall, |
329 | @@ -47,7 +46,7 @@ | |||
330 | 47 | def __init__(self, conn, manager, call_object, handle, props, object_path=None): | 46 | def __init__(self, conn, manager, call_object, handle, props, object_path=None): |
331 | 48 | oFonoCall.__init__(self, call_object) | 47 | oFonoCall.__init__(self, call_object) |
332 | 49 | telepathy.server.ChannelTypeCall.__init__(self, conn, manager, props, | 48 | telepathy.server.ChannelTypeCall.__init__(self, conn, manager, props, |
334 | 50 | object_path=object_path) | 49 | object_path=object_path) |
335 | 51 | oFonoChannel.__init__(self, conn, props) | 50 | oFonoChannel.__init__(self, conn, props) |
336 | 52 | ChannelInterfaceHold.__init__(self) | 51 | ChannelInterfaceHold.__init__(self) |
337 | 53 | 52 | ||
338 | @@ -57,7 +56,7 @@ | |||
339 | 57 | self._handle = handle | 56 | self._handle = handle |
340 | 58 | self._memberFlags = 0 | 57 | self._memberFlags = 0 |
341 | 59 | self._localMuteState = LOCAL_MUTE_STATE_UNMUTED | 58 | self._localMuteState = LOCAL_MUTE_STATE_UNMUTED |
343 | 60 | self._holdState = LOCAL_HOLD_STATE_UNHELD | 59 | self._holdState = LOCAL_HOLD_STATE_UNHELD |
344 | 61 | self._requested = props.get(telepathy.CHANNEL_INTERFACE + ".Requested", True) | 60 | self._requested = props.get(telepathy.CHANNEL_INTERFACE + ".Requested", True) |
345 | 62 | self._initialAudio = props.get(CHANNEL_TYPE_CALL + '.InitialAudio', True) | 61 | self._initialAudio = props.get(CHANNEL_TYPE_CALL + '.InitialAudio', True) |
346 | 63 | self._initialVideo = props.get(CHANNEL_TYPE_CALL + '.InitialVideo', False) | 62 | self._initialVideo = props.get(CHANNEL_TYPE_CALL + '.InitialVideo', False) |
347 | @@ -66,7 +65,7 @@ | |||
348 | 66 | self._speakerMode = False | 65 | self._speakerMode = False |
349 | 67 | self._incoming = self.isCallIncoming() | 66 | self._incoming = self.isCallIncoming() |
350 | 68 | self._localHangupRequested = False | 67 | self._localHangupRequested = False |
352 | 69 | 68 | ||
353 | 70 | self._conn.SetMuted(False) | 69 | self._conn.SetMuted(False) |
354 | 71 | 70 | ||
355 | 72 | logger.info("Call is incoming: %d" % self._incoming) | 71 | logger.info("Call is incoming: %d" % self._incoming) |
356 | @@ -117,29 +116,29 @@ | |||
357 | 117 | self.setCallState(telepathy.CALL_STATE_INITIALISED, 0, telepathy.CALL_STATE_CHANGE_REASON_PROGRESS_MADE, 0) | 116 | self.setCallState(telepathy.CALL_STATE_INITIALISED, 0, telepathy.CALL_STATE_CHANGE_REASON_PROGRESS_MADE, 0) |
358 | 118 | 117 | ||
359 | 119 | def SetRinging(self): | 118 | def SetRinging(self): |
361 | 120 | logger.info("SetRinging called"); | 119 | logger.info("SetRinging called") |
362 | 121 | if self._incoming and self._state == telepathy.CALL_STATE_INITIALISED: | 120 | if self._incoming and self._state == telepathy.CALL_STATE_INITIALISED: |
365 | 122 | self.setCallState(self._state, self._conn.self_handle.id, | 121 | self.setCallState(self._state, self._conn.self_handle.id, |
366 | 123 | telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, telepathy.CALL_FLAG_LOCALLY_RINGING) | 122 | telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, telepathy.CALL_FLAG_LOCALLY_RINGING) |
367 | 124 | # FIXME: we need to return the Not Available error for some cases. | 123 | # FIXME: we need to return the Not Available error for some cases. |
368 | 125 | # check this documentation: http://telepathy.freedesktop.org/spec/Channel_Type_Call.html#Method:SetRinging | 124 | # check this documentation: http://telepathy.freedesktop.org/spec/Channel_Type_Call.html#Method:SetRinging |
369 | 126 | 125 | ||
370 | 127 | def SetQueued(self): | 126 | def SetQueued(self): |
372 | 128 | logger.info("SetQueued called"); | 127 | logger.info("SetQueued called") |
373 | 129 | # TODO: implement | 128 | # TODO: implement |
374 | 130 | 129 | ||
375 | 131 | def Accept(self): | 130 | def Accept(self): |
377 | 132 | logger.info("Accept called"); | 131 | logger.info("Accept called") |
378 | 133 | if self._incoming: | 132 | if self._incoming: |
379 | 134 | self.setCallState(telepathy.CALL_STATE_ACCEPTED, self._conn.self_handle.id, | 133 | self.setCallState(telepathy.CALL_STATE_ACCEPTED, self._conn.self_handle.id, |
381 | 135 | telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, 0); | 134 | telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, 0) |
382 | 136 | if self.isCallWaiting(): | 135 | if self.isCallWaiting(): |
383 | 137 | self._conn.HoldAndAnswer() | 136 | self._conn.HoldAndAnswer() |
384 | 138 | else: | 137 | else: |
385 | 139 | self.Answer() | 138 | self.Answer() |
386 | 140 | 139 | ||
387 | 141 | def Hangup(self, Reason, Detailed_Hangup_Reason, Message): | 140 | def Hangup(self, Reason, Detailed_Hangup_Reason, Message): |
389 | 142 | logger.info("Hangup called"); | 141 | logger.info("Hangup called") |
390 | 143 | 142 | ||
391 | 144 | # check if this call is active or ringing | 143 | # check if this call is active or ringing |
392 | 145 | if self._state == telepathy.CALL_STATE_ACTIVE or self._state == telepathy.CALL_STATE_ACCEPTED or self._state == telepathy.CALL_STATE_INITIALISED: | 144 | if self._state == telepathy.CALL_STATE_ACTIVE or self._state == telepathy.CALL_STATE_ACCEPTED or self._state == telepathy.CALL_STATE_INITIALISED: |
393 | @@ -148,7 +147,7 @@ | |||
394 | 148 | oFonoCall.Hangup(self) | 147 | oFonoCall.Hangup(self) |
395 | 149 | 148 | ||
396 | 150 | def AddContent(self, Content_Name, Content_Type, InitialDirection): | 149 | def AddContent(self, Content_Name, Content_Type, InitialDirection): |
398 | 151 | logger.info("AddContent called"); | 150 | logger.info("AddContent called") |
399 | 152 | path = "%s/content%d" % (self._object_path, self.__call_content_id) | 151 | path = "%s/content%d" % (self._object_path, self.__call_content_id) |
400 | 153 | content = oFonoCallContent(self, Content_Name, Content_Type, self._conn._name, object_path=path) | 152 | content = oFonoCallContent(self, Content_Name, Content_Type, self._conn._name, object_path=path) |
401 | 154 | self.__call_content_id += 1 | 153 | self.__call_content_id += 1 |
402 | @@ -157,23 +156,23 @@ | |||
403 | 157 | 156 | ||
404 | 158 | def GetCallStateDetails(self): | 157 | def GetCallStateDetails(self): |
405 | 159 | details = dbus.Dictionary({}, signature="sv") | 158 | details = dbus.Dictionary({}, signature="sv") |
407 | 160 | logger.info("GetCallStateDetails called"); | 159 | logger.info("GetCallStateDetails called") |
408 | 161 | return details | 160 | return details |
409 | 162 | 161 | ||
410 | 163 | def GetCallStateReason(self): | 162 | def GetCallStateReason(self): |
412 | 164 | logger.info("GetCallStateReason called"); | 163 | logger.info("GetCallStateReason called") |
413 | 165 | return (dbus.UInt32(self._stateActor), dbus.UInt32(self._stateReason), dbus.String(""), dbus.String("")) | 164 | return (dbus.UInt32(self._stateActor), dbus.UInt32(self._stateReason), dbus.String(""), dbus.String("")) |
414 | 166 | 165 | ||
415 | 167 | def GetCallMembers(self): | 166 | def GetCallMembers(self): |
416 | 168 | members = dbus.Dictionary({}, signature="uu") | 167 | members = dbus.Dictionary({}, signature="uu") |
418 | 169 | logger.info("GetCallMembers called"); | 168 | logger.info("GetCallMembers called") |
419 | 170 | members[dbus.UInt32(self._handle.id)] = dbus.UInt32(self._memberFlags) | 169 | members[dbus.UInt32(self._handle.id)] = dbus.UInt32(self._memberFlags) |
420 | 171 | return members | 170 | return members |
421 | 172 | 171 | ||
422 | 173 | def GetMemberIdentifiers(self): | 172 | def GetMemberIdentifiers(self): |
423 | 174 | identifiers = dbus.Dictionary({}, signature="us") | 173 | identifiers = dbus.Dictionary({}, signature="us") |
424 | 175 | identifiers[dbus.UInt32(self._handle.id)] = self._handle.name | 174 | identifiers[dbus.UInt32(self._handle.id)] = self._handle.name |
426 | 176 | logger.info("GetMemberIdentifiers called"); | 175 | logger.info("GetMemberIdentifiers called") |
427 | 177 | return identifiers | 176 | return identifiers |
428 | 178 | 177 | ||
429 | 179 | def Close(self): | 178 | def Close(self): |
430 | @@ -193,7 +192,7 @@ | |||
431 | 193 | pass | 192 | pass |
432 | 194 | 193 | ||
433 | 195 | def removeContent(self, content): | 194 | def removeContent(self, content): |
435 | 196 | self.ContentRemoved(content, (dbus.UInt32(self._conn.self_handle.id), dbus.UInt32(telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED), dbus.String(""), dbus.String(""))) | 195 | self.ContentRemoved(content, (dbus.UInt32(self._conn.self_handle.id), dbus.UInt32(telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED), dbus.String(""), dbus.String(""))) |
436 | 197 | del self._content[self._content.index(content)] | 196 | del self._content[self._content.index(content)] |
437 | 198 | 197 | ||
438 | 199 | def setCallState(self, state, actor, reason, flags): | 198 | def setCallState(self, state, actor, reason, flags): |
439 | @@ -203,19 +202,19 @@ | |||
440 | 203 | self._flags = flags | 202 | self._flags = flags |
441 | 204 | 203 | ||
442 | 205 | # signature='uu(uuss)a{sv}') | 204 | # signature='uu(uuss)a{sv}') |
446 | 206 | self.CallStateChanged(dbus.UInt32(self._state), dbus.UInt32(self._flags), | 205 | self.CallStateChanged(dbus.UInt32(self._state), dbus.UInt32(self._flags), |
447 | 207 | (dbus.UInt32(self._stateActor), dbus.UInt32(self._stateReason), dbus.String(""), dbus.String("")), | 206 | (dbus.UInt32(self._stateActor), dbus.UInt32(self._stateReason), dbus.String(""), dbus.String("")), |
448 | 208 | dbus.Dictionary({}, signature="sv")) | 207 | dbus.Dictionary({}, signature="sv")) |
449 | 209 | 208 | ||
450 | 210 | def setMemberFlags(self, member, flags, actor=0, reason=telepathy.CALL_STATE_CHANGE_REASON_UNKNOWN): | 209 | def setMemberFlags(self, member, flags, actor=0, reason=telepathy.CALL_STATE_CHANGE_REASON_UNKNOWN): |
451 | 211 | # FIXME: handle multiple contacts | 210 | # FIXME: handle multiple contacts |
452 | 212 | self._memberFlags = flags | 211 | self._memberFlags = flags |
453 | 213 | 212 | ||
454 | 214 | # signature='a{uu}a{us}au(uuss)') | 213 | # signature='a{uu}a{us}au(uuss)') |
459 | 215 | self.CallMembersChanged(dbus.Dictionary({dbus.UInt32(self._handle.id) : dbus.UInt32(self._memberFlags)}, signature="uu"), | 214 | self.CallMembersChanged(dbus.Dictionary({dbus.UInt32(self._handle.id): dbus.UInt32(self._memberFlags)}, signature="uu"), |
460 | 216 | dbus.Dictionary({dbus.UInt32(self._handle.id) : dbus.String(self._handle.name)}, signature="us"), | 215 | dbus.Dictionary({dbus.UInt32(self._handle.id): dbus.String(self._handle.name)}, signature="us"), |
461 | 217 | dbus.Array([], signature="u"), | 216 | dbus.Array([], signature="u"), |
462 | 218 | (dbus.UInt32(actor), dbus.UInt32(reason), dbus.String(""), dbus.String(""))) | 217 | (dbus.UInt32(actor), dbus.UInt32(reason), dbus.String(""), dbus.String(""))) |
463 | 219 | 218 | ||
464 | 220 | ### oFono Call Interface ### | 219 | ### oFono Call Interface ### |
465 | 221 | def oFonoCallStateChanged(self): | 220 | def oFonoCallStateChanged(self): |
466 | @@ -235,7 +234,7 @@ | |||
467 | 235 | if (self._holdState == LOCAL_HOLD_STATE_UNHELD): | 234 | if (self._holdState == LOCAL_HOLD_STATE_UNHELD): |
468 | 236 | self.HoldStateChanged(LOCAL_HOLD_STATE_HELD, LOCAL_HOLD_STATE_REASON_REQUESTED) | 235 | self.HoldStateChanged(LOCAL_HOLD_STATE_HELD, LOCAL_HOLD_STATE_REASON_REQUESTED) |
469 | 237 | self._holdState = LOCAL_HOLD_STATE_HELD | 236 | self._holdState = LOCAL_HOLD_STATE_HELD |
471 | 238 | self.setCallState(telepathy.CALL_STATE_ACTIVE, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, telepathy.CALL_FLAG_LOCALLY_HELD) | 237 | self.setCallState(telepathy.CALL_STATE_ACTIVE, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, telepathy.CALL_FLAG_LOCALLY_HELD) |
472 | 239 | elif self.isCallForeground(): | 238 | elif self.isCallForeground(): |
473 | 240 | # the call was accepted/unheld | 239 | # the call was accepted/unheld |
474 | 241 | logger.info("The call is active") | 240 | logger.info("The call is active") |
475 | @@ -251,14 +250,15 @@ | |||
476 | 251 | # incoming call stopped ringing | 250 | # incoming call stopped ringing |
477 | 252 | self.setCallState(telepathy.CALL_STATE_ENDED, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_NO_ANSWER, 0) | 251 | self.setCallState(telepathy.CALL_STATE_ENDED, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_NO_ANSWER, 0) |
478 | 253 | self.Close() | 252 | self.Close() |
480 | 254 | else: # handle outgoing call | 253 | else: |
481 | 254 | # handle outgoing call | ||
482 | 255 | if self.isCallHeld(): | 255 | if self.isCallHeld(): |
483 | 256 | # put on hold | 256 | # put on hold |
484 | 257 | logger.info("The call is on hold") | 257 | logger.info("The call is on hold") |
485 | 258 | if (self._holdState == LOCAL_HOLD_STATE_UNHELD): | 258 | if (self._holdState == LOCAL_HOLD_STATE_UNHELD): |
486 | 259 | self.HoldStateChanged(LOCAL_HOLD_STATE_HELD, LOCAL_HOLD_STATE_REASON_REQUESTED) | 259 | self.HoldStateChanged(LOCAL_HOLD_STATE_HELD, LOCAL_HOLD_STATE_REASON_REQUESTED) |
487 | 260 | self._holdState = LOCAL_HOLD_STATE_HELD | 260 | self._holdState = LOCAL_HOLD_STATE_HELD |
489 | 261 | self.setCallState(telepathy.CALL_STATE_ACTIVE, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, telepathy.CALL_FLAG_LOCALLY_HELD) | 261 | self.setCallState(telepathy.CALL_STATE_ACTIVE, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, telepathy.CALL_FLAG_LOCALLY_HELD) |
490 | 262 | elif self.isCallForeground(): | 262 | elif self.isCallForeground(): |
491 | 263 | if self._state == telepathy.CALL_STATE_ACCEPTED: | 263 | if self._state == telepathy.CALL_STATE_ACCEPTED: |
492 | 264 | logger.info("The call is waiting for answer") | 264 | logger.info("The call is waiting for answer") |
493 | @@ -271,7 +271,7 @@ | |||
494 | 271 | self._holdState = LOCAL_HOLD_STATE_UNHELD | 271 | self._holdState = LOCAL_HOLD_STATE_UNHELD |
495 | 272 | # set this call as accepted before active, so the duration field is correctly set in tp-logger | 272 | # set this call as accepted before active, so the duration field is correctly set in tp-logger |
496 | 273 | if self._state != telepathy.CALL_STATE_ACTIVE: | 273 | if self._state != telepathy.CALL_STATE_ACTIVE: |
498 | 274 | self.setCallState(telepathy.CALL_STATE_ACCEPTED, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, 0); | 274 | self.setCallState(telepathy.CALL_STATE_ACCEPTED, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, 0) |
499 | 275 | self.setCallState(telepathy.CALL_STATE_ACTIVE, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, 0) | 275 | self.setCallState(telepathy.CALL_STATE_ACTIVE, self._handle.id, telepathy.CALL_STATE_CHANGE_REASON_USER_REQUESTED, 0) |
500 | 276 | elif self.isCallRinging(): | 276 | elif self.isCallRinging(): |
501 | 277 | logger.info("The call is ringing") | 277 | logger.info("The call is ringing") |
502 | @@ -286,20 +286,20 @@ | |||
503 | 286 | 286 | ||
504 | 287 | def RequestMuted(self, muted): | 287 | def RequestMuted(self, muted): |
505 | 288 | logger.info("RequestMuted called") | 288 | logger.info("RequestMuted called") |
507 | 289 | if (self._localMuteState != LOCAL_MUTE_STATE_MUTED and muted == True): | 289 | if (self._localMuteState != LOCAL_MUTE_STATE_MUTED and muted): |
508 | 290 | self._localMuteState = LOCAL_MUTE_STATE_MUTED | 290 | self._localMuteState = LOCAL_MUTE_STATE_MUTED |
509 | 291 | self.MuteStateChanged(self._localMuteState) | 291 | self.MuteStateChanged(self._localMuteState) |
510 | 292 | self._conn.SetMuted(True) | 292 | self._conn.SetMuted(True) |
512 | 293 | elif (self._localMuteState != LOCAL_MUTE_STATE_UNMUTED and muted == False): | 293 | elif (self._localMuteState != LOCAL_MUTE_STATE_UNMUTED and not muted): |
513 | 294 | self._localMuteState = LOCAL_MUTE_STATE_UNMUTED | 294 | self._localMuteState = LOCAL_MUTE_STATE_UNMUTED |
514 | 295 | self.MuteStateChanged(self._localMuteState) | 295 | self.MuteStateChanged(self._localMuteState) |
515 | 296 | self._conn.SetMuted(False) | 296 | self._conn.SetMuted(False) |
516 | 297 | 297 | ||
517 | 298 | def RequestHold(self, hold): | 298 | def RequestHold(self, hold): |
518 | 299 | logger.info("RequestHold called") | 299 | logger.info("RequestHold called") |
520 | 300 | if (self._holdState != LOCAL_HOLD_STATE_HELD and hold == True): | 300 | if (self._holdState != LOCAL_HOLD_STATE_HELD and hold): |
521 | 301 | self._conn.SwapCalls() | 301 | self._conn.SwapCalls() |
523 | 302 | elif (self._holdState != LOCAL_HOLD_STATE_UNHELD and hold == False): | 302 | elif (self._holdState != LOCAL_HOLD_STATE_UNHELD and not hold): |
524 | 303 | self._conn.SwapCalls() | 303 | self._conn.SwapCalls() |
525 | 304 | 304 | ||
526 | 305 | def GetHoldState(self): | 305 | def GetHoldState(self): |
527 | @@ -331,4 +331,3 @@ | |||
528 | 331 | # TODO: implement speaker mode | 331 | # TODO: implement speaker mode |
529 | 332 | #oFonoCall.turnOnSpeaker(self, active, False) | 332 | #oFonoCall.turnOnSpeaker(self, active, False) |
530 | 333 | pass | 333 | pass |
531 | 334 | |||
532 | 335 | 334 | ||
533 | === modified file 'tpofono/channel/text.py' | |||
534 | --- tpofono/channel/text.py 2013-02-19 20:09:40 +0000 | |||
535 | +++ tpofono/channel/text.py 2013-03-28 19:50:24 +0000 | |||
536 | @@ -18,11 +18,9 @@ | |||
537 | 18 | # You should have received a copy of the GNU General Public License | 18 | # You should have received a copy of the GNU General Public License |
538 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
539 | 20 | 20 | ||
540 | 21 | import gobject | ||
541 | 22 | import logging | 21 | import logging |
542 | 23 | import weakref | 22 | import weakref |
543 | 24 | import time | 23 | import time |
544 | 25 | import re | ||
545 | 26 | 24 | ||
546 | 27 | import dbus | 25 | import dbus |
547 | 28 | import telepathy | 26 | import telepathy |
548 | @@ -36,6 +34,7 @@ | |||
549 | 36 | 34 | ||
550 | 37 | logger = logging.getLogger('oFono.TextChannel') | 35 | logger = logging.getLogger('oFono.TextChannel') |
551 | 38 | 36 | ||
552 | 37 | |||
553 | 39 | class oFonoTextChannel( | 38 | class oFonoTextChannel( |
554 | 40 | oFonoChannel, | 39 | oFonoChannel, |
555 | 41 | telepathy.server.ChannelTypeText, | 40 | telepathy.server.ChannelTypeText, |
556 | @@ -51,22 +50,22 @@ | |||
557 | 51 | self._pending_messages2 = {} | 50 | self._pending_messages2 = {} |
558 | 52 | 51 | ||
559 | 53 | telepathy.server.ChannelTypeText.__init__(self, conn, manager, props, | 52 | telepathy.server.ChannelTypeText.__init__(self, conn, manager, props, |
561 | 54 | object_path=object_path) | 53 | object_path=object_path) |
562 | 55 | oFonoChannel.__init__(self, conn, props) | 54 | oFonoChannel.__init__(self, conn, props) |
563 | 56 | ChannelInterfaceMessages.__init__(self) | 55 | ChannelInterfaceMessages.__init__(self) |
564 | 57 | 56 | ||
565 | 58 | self._implement_property_get(CHANNEL_INTERFACE_MESSAGES, { | 57 | self._implement_property_get(CHANNEL_INTERFACE_MESSAGES, { |
567 | 59 | 'SupportedContentTypes': lambda: ["text/plain"] , | 58 | 'SupportedContentTypes': lambda: ["text/plain"], |
568 | 60 | 'MessagePartSupportFlags': lambda: 0, | 59 | 'MessagePartSupportFlags': lambda: 0, |
569 | 61 | 'DeliveryReportingSupport': lambda: telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES, | 60 | 'DeliveryReportingSupport': lambda: telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES, |
570 | 62 | 'PendingMessages': lambda: dbus.Array(self._pending_messages2.values(), signature='aa{sv}') | 61 | 'PendingMessages': lambda: dbus.Array(self._pending_messages2.values(), signature='aa{sv}') |
572 | 63 | }) | 62 | }) |
573 | 64 | 63 | ||
574 | 65 | self._add_immutables({ | 64 | self._add_immutables({ |
575 | 66 | 'SupportedContentTypes': CHANNEL_INTERFACE_MESSAGES, | 65 | 'SupportedContentTypes': CHANNEL_INTERFACE_MESSAGES, |
576 | 67 | 'MessagePartSupportFlags': CHANNEL_INTERFACE_MESSAGES, | 66 | 'MessagePartSupportFlags': CHANNEL_INTERFACE_MESSAGES, |
577 | 68 | 'DeliveryReportingSupport': CHANNEL_INTERFACE_MESSAGES, | 67 | 'DeliveryReportingSupport': CHANNEL_INTERFACE_MESSAGES, |
579 | 69 | }) | 68 | }) |
580 | 70 | 69 | ||
581 | 71 | def _send_text_message(self, message_type, text): | 70 | def _send_text_message(self, message_type, text): |
582 | 72 | "Send a simple text message, return true if sent correctly" | 71 | "Send a simple text message, return true if sent correctly" |
583 | @@ -88,11 +87,8 @@ | |||
584 | 88 | def MessageSentCallback(self, objectPath, status): | 87 | def MessageSentCallback(self, objectPath, status): |
585 | 89 | if status == self._conn.PROPERTY_STATUS_SENT: | 88 | if status == self._conn.PROPERTY_STATUS_SENT: |
586 | 90 | return | 89 | return |
587 | 91 | timestamp = int(time.time()) | ||
588 | 92 | if objectPath in self.sentMessages: | 90 | if objectPath in self.sentMessages: |
592 | 93 | message = self.sentMessages.pop(objectPath) | 91 | self.sentMessages.pop(objectPath) |
590 | 94 | message_type = message["message_type"] | ||
591 | 95 | text = message["text"] | ||
593 | 96 | headers = {} | 92 | headers = {} |
594 | 97 | body = {} | 93 | body = {} |
595 | 98 | delivery = {'message-sender': self._handle_id, | 94 | delivery = {'message-sender': self._handle_id, |
596 | @@ -103,12 +99,14 @@ | |||
597 | 103 | self.MessageReceived(msg) | 99 | self.MessageReceived(msg) |
598 | 104 | 100 | ||
599 | 105 | def _signal_text_sent(self, timestamp, message_type, text): | 101 | def _signal_text_sent(self, timestamp, message_type, text): |
606 | 106 | headers = {'message-sent' : timestamp, | 102 | headers = { |
607 | 107 | 'message-type' : message_type | 103 | 'message-sent': timestamp, |
608 | 108 | } | 104 | 'message-type': message_type |
609 | 109 | body = {'content-type': 'text/plain', | 105 | } |
610 | 110 | 'content': text | 106 | body = { |
611 | 111 | } | 107 | 'content-type': 'text/plain', |
612 | 108 | 'content': text | ||
613 | 109 | } | ||
614 | 112 | message = [headers, body] | 110 | message = [headers, body] |
615 | 113 | self.Sent(timestamp, message_type, text) | 111 | self.Sent(timestamp, message_type, text) |
616 | 114 | self.MessageSent(message, 0, '') | 112 | self.MessageSent(message, 0, '') |
617 | @@ -116,17 +114,19 @@ | |||
618 | 116 | def _signal_text_received(self, sender, text, id, timestamp, scrollback): | 114 | def _signal_text_received(self, sender, text, id, timestamp, scrollback): |
619 | 117 | type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL | 115 | type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL |
620 | 118 | self.Received(id, timestamp, sender.id, type, 0, text) | 116 | self.Received(id, timestamp, sender.id, type, 0, text) |
628 | 119 | headers = dbus.Dictionary({dbus.String('message-received') : dbus.UInt64(timestamp), | 117 | headers = dbus.Dictionary({ |
629 | 120 | dbus.String('pending-message-id') : dbus.UInt32(id), | 118 | dbus.String('message-received'): dbus.UInt64(timestamp), |
630 | 121 | dbus.String('message-token') : dbus.String(id), | 119 | dbus.String('pending-message-id'): dbus.UInt32(id), |
631 | 122 | dbus.String('message-sender') : dbus.UInt32(sender), | 120 | dbus.String('message-token'): dbus.String(id), |
632 | 123 | dbus.String('message-type') : dbus.UInt32(type), | 121 | dbus.String('message-sender'): dbus.UInt32(sender), |
633 | 124 | dbus.String('scrollback') : dbus.Boolean(scrollback) | 122 | dbus.String('message-type'): dbus.UInt32(type), |
634 | 125 | }, signature='sv') | 123 | dbus.String('scrollback'): dbus.Boolean(scrollback) |
635 | 124 | }, signature='sv') | ||
636 | 126 | 125 | ||
640 | 127 | body = dbus.Dictionary({dbus.String('content-type'): dbus.String('text/plain'), | 126 | body = dbus.Dictionary({ |
641 | 128 | dbus.String('content'): dbus.String(text) | 127 | dbus.String('content-type'): dbus.String('text/plain'), |
642 | 129 | }, signature='sv') | 128 | dbus.String('content'): dbus.String(text) |
643 | 129 | }, signature='sv') | ||
644 | 130 | message = dbus.Array([headers, body], signature='a{sv}') | 130 | message = dbus.Array([headers, body], signature='a{sv}') |
645 | 131 | self.MessageReceived(message) | 131 | self.MessageReceived(message) |
646 | 132 | 132 | ||
647 | @@ -154,7 +154,7 @@ | |||
648 | 154 | raise telepathy.NotImplemented("Unhandled message type") | 154 | raise telepathy.NotImplemented("Unhandled message type") |
649 | 155 | text = None | 155 | text = None |
650 | 156 | for part in message: | 156 | for part in message: |
652 | 157 | if part.get("content-type", None) == "text/plain": | 157 | if part.get("content-type", None) == "text/plain": |
653 | 158 | text = part['content'] | 158 | text = part['content'] |
654 | 159 | break | 159 | break |
655 | 160 | if text is None: | 160 | if text is None: |
656 | @@ -165,7 +165,7 @@ | |||
657 | 165 | self._signal_text_sent(timestamp, message_type, text) | 165 | self._signal_text_sent(timestamp, message_type, text) |
658 | 166 | 166 | ||
659 | 167 | def AcknowledgePendingMessages(self, ids): | 167 | def AcknowledgePendingMessages(self, ids): |
661 | 168 | readIds = [] | 168 | readIds = [] |
662 | 169 | for id in ids: | 169 | for id in ids: |
663 | 170 | if id in self._pending_messages2: | 170 | if id in self._pending_messages2: |
664 | 171 | del self._pending_messages2[id] | 171 | del self._pending_messages2[id] |
665 | 172 | 172 | ||
666 | === modified file 'tpofono/channel_manager.py' | |||
667 | --- tpofono/channel_manager.py 2013-02-19 20:09:40 +0000 | |||
668 | +++ tpofono/channel_manager.py 2013-03-28 19:50:24 +0000 | |||
669 | @@ -17,16 +17,12 @@ | |||
670 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
671 | 18 | 18 | ||
672 | 19 | import logging | 19 | import logging |
673 | 20 | import weakref | ||
674 | 21 | from string import ascii_letters, digits | 20 | from string import ascii_letters, digits |
675 | 22 | 21 | ||
676 | 23 | import dbus | ||
677 | 24 | import telepathy | 22 | import telepathy |
678 | 25 | from telepathy.interfaces import CHANNEL_TYPE_CALL | ||
679 | 26 | 23 | ||
680 | 27 | from tpofono.channel.text import oFonoTextChannel | 24 | from tpofono.channel.text import oFonoTextChannel |
681 | 28 | from tpofono.channel.call import oFonoCallChannel | 25 | from tpofono.channel.call import oFonoCallChannel |
682 | 29 | from tpofono.handle import oFonoHandleFactory | ||
683 | 30 | 26 | ||
684 | 31 | __all__ = ['oFonoChannelManager'] | 27 | __all__ = ['oFonoChannelManager'] |
685 | 32 | 28 | ||
686 | @@ -34,6 +30,7 @@ | |||
687 | 34 | 30 | ||
688 | 35 | _ASCII_ALNUM = ascii_letters + digits | 31 | _ASCII_ALNUM = ascii_letters + digits |
689 | 36 | 32 | ||
690 | 33 | |||
691 | 37 | class oFonoChannelManager(telepathy.server.ChannelManager): | 34 | class oFonoChannelManager(telepathy.server.ChannelManager): |
692 | 38 | __text_channel_id = 1 | 35 | __text_channel_id = 1 |
693 | 39 | __call_channel_id = 1 | 36 | __call_channel_id = 1 |
694 | @@ -58,7 +55,7 @@ | |||
695 | 58 | # Normal 1-1 chat | 55 | # Normal 1-1 chat |
696 | 59 | if handle.get_type() == telepathy.HANDLE_TYPE_CONTACT: | 56 | if handle.get_type() == telepathy.HANDLE_TYPE_CONTACT: |
697 | 60 | channel = oFonoTextChannel(self._conn, self, conversation, handle, props, | 57 | channel = oFonoTextChannel(self._conn, self, conversation, handle, props, |
699 | 61 | object_path=path) | 58 | object_path=path) |
700 | 62 | else: | 59 | else: |
701 | 63 | raise telepathy.NotImplemented('Only contacts are allowed') | 60 | raise telepathy.NotImplemented('Only contacts are allowed') |
702 | 64 | 61 | ||
703 | @@ -70,8 +67,6 @@ | |||
704 | 70 | if handle.get_type() != telepathy.HANDLE_TYPE_CONTACT: | 67 | if handle.get_type() != telepathy.HANDLE_TYPE_CONTACT: |
705 | 71 | raise telepathy.NotImplemented('Only contacts are allowed') | 68 | raise telepathy.NotImplemented('Only contacts are allowed') |
706 | 72 | 69 | ||
707 | 73 | contact = handle.contact | ||
708 | 74 | |||
709 | 75 | logger.debug('New call channel') | 70 | logger.debug('New call channel') |
710 | 76 | 71 | ||
711 | 77 | path = "CallChannel/%d" % self.__call_channel_id | 72 | path = "CallChannel/%d" % self.__call_channel_id |
712 | @@ -86,7 +81,7 @@ | |||
713 | 86 | break | 81 | break |
714 | 87 | 82 | ||
715 | 88 | # if it is not found, call the number | 83 | # if it is not found, call the number |
717 | 89 | if call == None: | 84 | if call is None: |
718 | 90 | logger.info("No existing call found, calling ofono now") | 85 | logger.info("No existing call found, calling ofono now") |
719 | 91 | call = self._conn.Call(handle.name) | 86 | call = self._conn.Call(handle.name) |
720 | 92 | 87 | ||
721 | @@ -110,4 +105,3 @@ | |||
722 | 110 | if channel._call == objectPath: | 105 | if channel._call == objectPath: |
723 | 111 | return channel | 106 | return channel |
724 | 112 | return None | 107 | return None |
725 | 113 | |||
726 | 114 | 108 | ||
727 | === modified file 'tpofono/connection.py' | |||
728 | --- tpofono/connection.py 2013-02-20 18:45:38 +0000 | |||
729 | +++ tpofono/connection.py 2013-03-28 19:50:24 +0000 | |||
730 | @@ -17,19 +17,13 @@ | |||
731 | 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
732 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
733 | 19 | 19 | ||
734 | 20 | import weakref | ||
735 | 21 | import logging | 20 | import logging |
736 | 22 | 21 | ||
737 | 23 | import dbus | 22 | import dbus |
738 | 24 | import telepathy | 23 | import telepathy |
739 | 25 | import hashlib | ||
740 | 26 | import datetime | ||
741 | 27 | from datetime import datetime | 24 | from datetime import datetime |
742 | 28 | from datetime import timedelta | ||
743 | 29 | import time | 25 | import time |
744 | 30 | 26 | ||
745 | 31 | from telepathy.interfaces import CONNECTION, CHANNEL_TYPE_CALL | ||
746 | 32 | |||
747 | 33 | from tpofono.aliasing import oFonoAliasing | 27 | from tpofono.aliasing import oFonoAliasing |
748 | 34 | from tpofono.capabilities import oFonoCapabilities | 28 | from tpofono.capabilities import oFonoCapabilities |
749 | 35 | from tpofono.handle import oFonoHandleFactory | 29 | from tpofono.handle import oFonoHandleFactory |
750 | @@ -51,17 +45,16 @@ | |||
751 | 51 | 45 | ||
752 | 52 | 46 | ||
753 | 53 | class oFonoConnection(telepathy.server.Connection, | 47 | class oFonoConnection(telepathy.server.Connection, |
765 | 54 | telepathy.server.ConnectionInterfaceRequests, | 48 | telepathy.server.ConnectionInterfaceRequests, |
766 | 55 | oFonoAliasing, | 49 | oFonoAliasing, |
767 | 56 | # oFonoAvatars, | 50 | oFonoCapabilities, |
768 | 57 | oFonoCapabilities, | 51 | oFonoContacts, |
769 | 58 | oFonoContacts, | 52 | oFonoCalls, |
770 | 59 | oFonoCalls, | 53 | oFonoCallVolume, |
771 | 60 | oFonoCallVolume, | 54 | oFonoMessages, |
772 | 61 | oFonoMessages, | 55 | oFonoPresence, |
773 | 62 | oFonoPresence, | 56 | oFonoVoicemail, |
774 | 63 | oFonoVoicemail, | 57 | oFonoManager): |
764 | 64 | oFonoManager): | ||
775 | 65 | 58 | ||
776 | 66 | phone = None | 59 | phone = None |
777 | 67 | createdChannels = [] | 60 | createdChannels = [] |
778 | @@ -75,13 +68,13 @@ | |||
779 | 75 | 68 | ||
780 | 76 | try: | 69 | try: |
781 | 77 | self.myModem = None | 70 | self.myModem = None |
783 | 78 | self._account = "ofono" #unicode(parameters['account']) | 71 | self._account = "ofono" # unicode(parameters['account']) |
784 | 79 | self._channel_manager = oFonoChannelManager(self, protocol) | 72 | self._channel_manager = oFonoChannelManager(self, protocol) |
785 | 80 | self._manager = manager | 73 | self._manager = manager |
786 | 81 | 74 | ||
787 | 82 | # Call parent initializers | 75 | # Call parent initializers |
788 | 83 | telepathy.server.Connection.__init__(self, 'ofono', self._account, | 76 | telepathy.server.Connection.__init__(self, 'ofono', self._account, |
790 | 84 | 'ofono', protocol) | 77 | 'ofono', protocol) |
791 | 85 | telepathy.server.ConnectionInterfaceRequests.__init__(self) | 78 | telepathy.server.ConnectionInterfaceRequests.__init__(self) |
792 | 86 | oFonoAliasing.__init__(self) | 79 | oFonoAliasing.__init__(self) |
793 | 87 | #oFonoAvatars.__init__(self) | 80 | #oFonoAvatars.__init__(self) |
794 | @@ -94,12 +87,12 @@ | |||
795 | 94 | oFonoVoicemail.__init__(self) | 87 | oFonoVoicemail.__init__(self) |
796 | 95 | 88 | ||
797 | 96 | # FIXME: re-add the org.ofono.MessageWaiting interface once it is available again | 89 | # FIXME: re-add the org.ofono.MessageWaiting interface once it is available again |
799 | 97 | oFonoManager.__init__(self, [ "org.ofono.MessageManager", "org.ofono.VoiceCallManager", "org.ofono.CallVolume" ]) | 90 | oFonoManager.__init__(self, ["org.ofono.MessageManager", "org.ofono.VoiceCallManager", "org.ofono.CallVolume"]) |
800 | 98 | # NOTE: comment the line above and uncomment the one below to test telepathy-ofono using ofono-phonesim | 91 | # NOTE: comment the line above and uncomment the one below to test telepathy-ofono using ofono-phonesim |
801 | 99 | #oFonoManager.__init__(self, [ "org.ofono.MessageManager", "org.ofono.VoiceCallManager" ]) | 92 | #oFonoManager.__init__(self, [ "org.ofono.MessageManager", "org.ofono.VoiceCallManager" ]) |
802 | 100 | 93 | ||
803 | 101 | self_handle = self.create_handle(telepathy.HANDLE_TYPE_CONTACT, | 94 | self_handle = self.create_handle(telepathy.HANDLE_TYPE_CONTACT, |
805 | 102 | self._account) | 95 | self._account) |
806 | 103 | self.set_self_handle(self_handle) | 96 | self.set_self_handle(self_handle) |
807 | 104 | 97 | ||
808 | 105 | self._implement_property_get(telepathy.CONNECTION, { | 98 | self._implement_property_get(telepathy.CONNECTION, { |
809 | @@ -108,8 +101,7 @@ | |||
810 | 108 | 101 | ||
811 | 109 | logger.info("Connection to the account %s created" % self._account) | 102 | logger.info("Connection to the account %s created" % self._account) |
812 | 110 | 103 | ||
815 | 111 | except Exception, e: | 104 | except: |
814 | 112 | import traceback | ||
816 | 113 | logger.exception("Failed to create Connection") | 105 | logger.exception("Failed to create Connection") |
817 | 114 | raise | 106 | raise |
818 | 115 | 107 | ||
819 | @@ -136,7 +128,7 @@ | |||
820 | 136 | """Create new handle with given type and name.""" | 128 | """Create new handle with given type and name.""" |
821 | 137 | handle_id = self.get_handle_id() | 129 | handle_id = self.get_handle_id() |
822 | 138 | handle = oFonoHandleFactory(self, handle_type, handle_id, | 130 | handle = oFonoHandleFactory(self, handle_type, handle_id, |
824 | 139 | handle_name, **kwargs) | 131 | handle_name, **kwargs) |
825 | 140 | if handle is None: | 132 | if handle is None: |
826 | 141 | raise telepathy.NotAvailable('Handle type unsupported %d' % handle_type) | 133 | raise telepathy.NotAvailable('Handle type unsupported %d' % handle_type) |
827 | 142 | logger.info("New Handle %s" % unicode(handle)) | 134 | logger.info("New Handle %s" % unicode(handle)) |
828 | @@ -157,7 +149,7 @@ | |||
829 | 157 | """Normalize handle name so the name is consistent everywhere.""" | 149 | """Normalize handle name so the name is consistent everywhere.""" |
830 | 158 | if not self.is_valid_handle_name(handle_type, handle_name): | 150 | if not self.is_valid_handle_name(handle_type, handle_name): |
831 | 159 | raise telepathy.InvalidHandle('TargetID %s not valid for type %d' % | 151 | raise telepathy.InvalidHandle('TargetID %s not valid for type %d' % |
833 | 160 | (name, handle_type)) | 152 | (handle_name, handle_type)) |
834 | 161 | if handle_type == telepathy.HANDLE_TYPE_CONTACT: | 153 | if handle_type == telepathy.HANDLE_TYPE_CONTACT: |
835 | 162 | return handle_name.lower().strip() | 154 | return handle_name.lower().strip() |
836 | 163 | return handle_name | 155 | return handle_name |
837 | @@ -195,7 +187,7 @@ | |||
838 | 195 | alias = parsedVcard.fn.value | 187 | alias = parsedVcard.fn.value |
839 | 196 | else: | 188 | else: |
840 | 197 | alias = handle.name | 189 | alias = handle.name |
842 | 198 | 190 | ||
843 | 199 | self.contactInfo[handle_id] = {} | 191 | self.contactInfo[handle_id] = {} |
844 | 200 | self.contactInfo[handle_id]['alias'] = alias | 192 | self.contactInfo[handle_id]['alias'] = alias |
845 | 201 | 193 | ||
846 | @@ -211,7 +203,7 @@ | |||
847 | 211 | logger.info("Connecting") | 203 | logger.info("Connecting") |
848 | 212 | self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTING, telepathy.CONNECTION_STATUS_REASON_REQUESTED) | 204 | self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTING, telepathy.CONNECTION_STATUS_REASON_REQUESTED) |
849 | 213 | self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTED, telepathy.CONNECTION_STATUS_REASON_REQUESTED) | 205 | self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTED, telepathy.CONNECTION_STATUS_REASON_REQUESTED) |
851 | 214 | if self.myModem != None: | 206 | if self.myModem is not None: |
852 | 215 | self.SetOnline(True) | 207 | self.SetOnline(True) |
853 | 216 | else: | 208 | else: |
854 | 217 | self.SetOnline(False) | 209 | self.SetOnline(False) |
855 | @@ -236,20 +228,18 @@ | |||
856 | 236 | telepathy.CHANNEL_INTERFACE + '.TargetHandle': handle.get_id(), | 228 | telepathy.CHANNEL_INTERFACE + '.TargetHandle': handle.get_id(), |
857 | 237 | telepathy.CHANNEL_INTERFACE + '.TargetHandleType': handle.get_type(), | 229 | telepathy.CHANNEL_INTERFACE + '.TargetHandleType': handle.get_type(), |
858 | 238 | telepathy.CHANNEL_INTERFACE + '.Requested': suppress_handler | 230 | telepathy.CHANNEL_INTERFACE + '.Requested': suppress_handler |
860 | 239 | } | 231 | } |
861 | 240 | 232 | ||
862 | 241 | if initiator_handle is not None: | 233 | if initiator_handle is not None: |
863 | 242 | if initiator_handle.get_type() is not telepathy.HANDLE_TYPE_NONE: | 234 | if initiator_handle.get_type() is not telepathy.HANDLE_TYPE_NONE: |
866 | 243 | props[telepathy.CHANNEL_INTERFACE + '.InitiatorHandle'] = \ | 235 | props[telepathy.CHANNEL_INTERFACE + '.InitiatorHandle'] = initiator_handle.get_id() |
865 | 244 | initiator_handle.get_id() | ||
867 | 245 | 236 | ||
868 | 246 | return props | 237 | return props |
869 | 247 | 238 | ||
870 | 248 | |||
871 | 249 | @dbus.service.method(telepathy.CONNECTION, in_signature='suub', | 239 | @dbus.service.method(telepathy.CONNECTION, in_signature='suub', |
873 | 250 | out_signature='o', async_callbacks=('_success', '_error')) | 240 | out_signature='o', async_callbacks=('_success', '_error')) |
874 | 251 | def RequestChannel(self, type, handle_type, handle_id, suppress_handler, | 241 | def RequestChannel(self, type, handle_type, handle_id, suppress_handler, |
876 | 252 | _success, _error): | 242 | _success, _error): |
877 | 253 | self.check_connected() | 243 | self.check_connected() |
878 | 254 | channel_manager = self._channel_manager | 244 | channel_manager = self._channel_manager |
879 | 255 | 245 | ||
880 | @@ -281,10 +271,10 @@ | |||
881 | 281 | call = oFonoCall(objectPath, properties) | 271 | call = oFonoCall(objectPath, properties) |
882 | 282 | if call.isCallIncoming() or call.isCallWaiting(): | 272 | if call.isCallIncoming() or call.isCallWaiting(): |
883 | 283 | props = self._generate_props(telepathy.CHANNEL_TYPE_CALL, | 273 | props = self._generate_props(telepathy.CHANNEL_TYPE_CALL, |
885 | 284 | handle, False, initiator_handle=handle) | 274 | handle, False, initiator_handle=handle) |
886 | 285 | else: | 275 | else: |
887 | 286 | props = self._generate_props(telepathy.CHANNEL_TYPE_CALL, | 276 | props = self._generate_props(telepathy.CHANNEL_TYPE_CALL, |
889 | 287 | handle, False, initiator_handle=self.self_handle) | 277 | handle, False, initiator_handle=self.self_handle) |
890 | 288 | 278 | ||
891 | 289 | # check if this channel was already created | 279 | # check if this channel was already created |
892 | 290 | if self._channel_manager.existing_channel(props): | 280 | if self._channel_manager.existing_channel(props): |
893 | @@ -297,7 +287,7 @@ | |||
894 | 297 | def ModemAdded(self, modem): | 287 | def ModemAdded(self, modem): |
895 | 298 | logger.info("Got modem %s", modem.objectPath) | 288 | logger.info("Got modem %s", modem.objectPath) |
896 | 299 | # check if we already have a modem | 289 | # check if we already have a modem |
898 | 300 | if self.myModem != None: | 290 | if self.myModem is not None: |
899 | 301 | return | 291 | return |
900 | 302 | 292 | ||
901 | 303 | self.myModem = modem | 293 | self.myModem = modem |
902 | @@ -340,14 +330,14 @@ | |||
903 | 340 | text = message | 330 | text = message |
904 | 341 | timestamp = datetime.strptime(props["SentTime"][:-5], "%Y-%m-%dT%H:%M:%S") | 331 | timestamp = datetime.strptime(props["SentTime"][:-5], "%Y-%m-%dT%H:%M:%S") |
905 | 342 | timestamp = time.mktime(timestamp.timetuple()) | 332 | timestamp = time.mktime(timestamp.timetuple()) |
907 | 343 | 333 | ||
908 | 344 | # FIXME: do not use timestamp as ID | 334 | # FIXME: do not use timestamp as ID |
910 | 345 | id = int (timestamp) | 335 | id = int(timestamp) |
911 | 346 | handle = self.ensure_contact_handle(number) | 336 | handle = self.ensure_contact_handle(number) |
912 | 347 | props = self._generate_props(telepathy.CHANNEL_TYPE_TEXT, | 337 | props = self._generate_props(telepathy.CHANNEL_TYPE_TEXT, |
914 | 348 | handle, False) | 338 | handle, False) |
915 | 349 | channel = self._channel_manager.channel_for_props(props, | 339 | channel = self._channel_manager.channel_for_props(props, |
917 | 350 | signal=True) | 340 | signal=True) |
918 | 351 | channel._signal_text_received(handle, text, id, timestamp, scrollback) | 341 | channel._signal_text_received(handle, text, id, timestamp, scrollback) |
919 | 352 | 342 | ||
920 | 353 | @dbus.service.signal(dbus_interface=CANONICAL_IFACE_TELEPHONY, | 343 | @dbus.service.signal(dbus_interface=CANONICAL_IFACE_TELEPHONY, |
921 | @@ -374,4 +364,3 @@ | |||
922 | 374 | in_signature='', out_signature='i') | 364 | in_signature='', out_signature='i') |
923 | 375 | def VoicemailCount(self): | 365 | def VoicemailCount(self): |
924 | 376 | return oFonoVoicemail.VoicemailCount(self) | 366 | return oFonoVoicemail.VoicemailCount(self) |
925 | 377 | |||
926 | 378 | 367 | ||
927 | === modified file 'tpofono/connection_manager.py' | |||
928 | --- tpofono/connection_manager.py 2013-02-19 20:09:40 +0000 | |||
929 | +++ tpofono/connection_manager.py 2013-03-28 19:50:24 +0000 | |||
930 | @@ -18,7 +18,6 @@ | |||
931 | 18 | 18 | ||
932 | 19 | import telepathy | 19 | import telepathy |
933 | 20 | import gobject | 20 | import gobject |
934 | 21 | import dbus | ||
935 | 22 | import logging | 21 | import logging |
936 | 23 | 22 | ||
937 | 24 | from tpofono.protocol import oFonoProtocol | 23 | from tpofono.protocol import oFonoProtocol |
938 | @@ -30,7 +29,7 @@ | |||
939 | 30 | 29 | ||
940 | 31 | class oFonoConnectionManager(telepathy.server.ConnectionManager): | 30 | class oFonoConnectionManager(telepathy.server.ConnectionManager): |
941 | 32 | """oFono connection manager | 31 | """oFono connection manager |
943 | 33 | 32 | ||
944 | 34 | Implements the org.freedesktop.Telepathy.ConnectionManager interface""" | 33 | Implements the org.freedesktop.Telepathy.ConnectionManager interface""" |
945 | 35 | 34 | ||
946 | 36 | def __init__(self, shutdown_func=None): | 35 | def __init__(self, shutdown_func=None): |
947 | @@ -48,7 +47,7 @@ | |||
948 | 48 | len(self._connections) == 0: | 47 | len(self._connections) == 0: |
949 | 49 | self._shutdown() | 48 | self._shutdown() |
950 | 50 | return False | 49 | return False |
952 | 51 | result = telepathy.server.ConnectionManager.disconnected(self, conn) | 50 | telepathy.server.ConnectionManager.disconnected(self, conn) |
953 | 52 | gobject.timeout_add_seconds(5, shutdown) | 51 | gobject.timeout_add_seconds(5, shutdown) |
954 | 53 | 52 | ||
955 | 54 | def quit(self): | 53 | def quit(self): |
956 | 55 | 54 | ||
957 | === modified file 'tpofono/contacts.py' | |||
958 | --- tpofono/contacts.py 2013-02-19 20:09:40 +0000 | |||
959 | +++ tpofono/contacts.py 2013-03-28 19:50:24 +0000 | |||
960 | @@ -17,7 +17,6 @@ | |||
961 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
962 | 18 | 18 | ||
963 | 19 | import logging | 19 | import logging |
964 | 20 | import time | ||
965 | 21 | 20 | ||
966 | 22 | import telepathy | 21 | import telepathy |
967 | 23 | import telepathy.errors | 22 | import telepathy.errors |
968 | @@ -27,29 +26,29 @@ | |||
969 | 27 | 26 | ||
970 | 28 | logger = logging.getLogger('oFono.Contacts') | 27 | logger = logging.getLogger('oFono.Contacts') |
971 | 29 | 28 | ||
972 | 29 | |||
973 | 30 | class oFonoContacts( | 30 | class oFonoContacts( |
974 | 31 | telepathy.server.ConnectionInterfaceContacts): | 31 | telepathy.server.ConnectionInterfaceContacts): |
975 | 32 | 32 | ||
976 | 33 | attributes = { | 33 | attributes = { |
984 | 34 | telepathy.CONNECTION : 'contact-id', | 34 | telepathy.CONNECTION: 'contact-id', |
985 | 35 | telepathy.CONNECTION_INTERFACE_ALIASING : 'alias', | 35 | telepathy.CONNECTION_INTERFACE_ALIASING: 'alias', |
986 | 36 | # telepathy.CONNECTION_INTERFACE_AVATARS : 'token', | 36 | telepathy.CONNECTION_INTERFACE_CAPABILITIES: 'caps', |
987 | 37 | telepathy.CONNECTION_INTERFACE_CAPABILITIES : 'caps', | 37 | telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES: 'capabilities', |
988 | 38 | telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES : 'capabilities', | 38 | telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE: 'presence' |
989 | 39 | telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE : 'presence' | 39 | } |
983 | 40 | } | ||
990 | 41 | 40 | ||
991 | 42 | def __init__(self): | 41 | def __init__(self): |
992 | 43 | telepathy.server.ConnectionInterfaceContacts.__init__(self) | 42 | telepathy.server.ConnectionInterfaceContacts.__init__(self) |
993 | 44 | 43 | ||
994 | 45 | dbus_interface = telepathy.CONNECTION_INTERFACE_CONTACTS | 44 | dbus_interface = telepathy.CONNECTION_INTERFACE_CONTACTS |
995 | 46 | 45 | ||
998 | 47 | self._implement_property_get(dbus_interface, \ | 46 | self._implement_property_get(dbus_interface, |
999 | 48 | {'ContactAttributeInterfaces' : self.get_contact_attribute_interfaces}) | 47 | {'ContactAttributeInterfaces': self.get_contact_attribute_interfaces}) |
1000 | 49 | 48 | ||
1001 | 50 | # Overwrite the dbus attribute to get the sender argument | 49 | # Overwrite the dbus attribute to get the sender argument |
1002 | 51 | @dbus.service.method(telepathy.CONNECTION_INTERFACE_CONTACTS, in_signature='auasb', | 50 | @dbus.service.method(telepathy.CONNECTION_INTERFACE_CONTACTS, in_signature='auasb', |
1004 | 52 | out_signature='a{ua{sv}}', sender_keyword='sender') | 51 | out_signature='a{ua{sv}}', sender_keyword='sender') |
1005 | 53 | def GetContactAttributes(self, handles, interfaces, hold, sender): | 52 | def GetContactAttributes(self, handles, interfaces, hold, sender): |
1006 | 54 | #InspectHandle already checks we're connected, the handles and handle type. | 53 | #InspectHandle already checks we're connected, the handles and handle type. |
1007 | 55 | supported_interfaces = set() | 54 | supported_interfaces = set() |
1008 | @@ -66,19 +65,19 @@ | |||
1009 | 66 | ret[handle] = dbus.Dictionary(signature='sv') | 65 | ret[handle] = dbus.Dictionary(signature='sv') |
1010 | 67 | 66 | ||
1011 | 68 | functions = { | 67 | functions = { |
1025 | 69 | telepathy.CONNECTION : | 68 | telepathy.CONNECTION: |
1026 | 70 | lambda x: zip(x, self.InspectHandles(handle_type, x)), | 69 | lambda x: zip(x, self.InspectHandles(handle_type, x)), |
1027 | 71 | telepathy.CONNECTION_INTERFACE_ALIASING : | 70 | telepathy.CONNECTION_INTERFACE_ALIASING: |
1028 | 72 | lambda x: self.GetAliases(x).items(), | 71 | lambda x: self.GetAliases(x).items(), |
1029 | 73 | # telepathy.CONNECTION_INTERFACE_AVATARS : | 72 | # telepathy.CONNECTION_INTERFACE_AVATARS: |
1030 | 74 | # lambda x: self.GetKnownAvatarTokens(x).items(), | 73 | # lambda x: self.GetKnownAvatarTokens(x).items(), |
1031 | 75 | telepathy.CONNECTION_INTERFACE_CAPABILITIES : | 74 | telepathy.CONNECTION_INTERFACE_CAPABILITIES: |
1032 | 76 | lambda x: self.GetCapabilities(x).items(), | 75 | lambda x: self.GetCapabilities(x).items(), |
1033 | 77 | telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES : | 76 | telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES: |
1034 | 78 | lambda x: self.GetContactCapabilities(x).items(), | 77 | lambda x: self.GetContactCapabilities(x).items(), |
1035 | 79 | telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE : | 78 | telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE: |
1036 | 80 | lambda x: self.GetPresences(x).items() | 79 | lambda x: self.GetPresences(x).items() |
1037 | 81 | } | 80 | } |
1038 | 82 | 81 | ||
1039 | 83 | #Hold handles if needed | 82 | #Hold handles if needed |
1040 | 84 | if hold: | 83 | if hold: |
1041 | 85 | 84 | ||
1042 | === modified file 'tpofono/debug.py' | |||
1043 | --- tpofono/debug.py 2013-02-19 20:09:40 +0000 | |||
1044 | +++ tpofono/debug.py 2013-03-28 19:50:24 +0000 | |||
1045 | @@ -18,6 +18,7 @@ | |||
1046 | 18 | 18 | ||
1047 | 19 | import telepathy | 19 | import telepathy |
1048 | 20 | 20 | ||
1049 | 21 | |||
1050 | 21 | class oFonoDebug(telepathy.server.Debug): | 22 | class oFonoDebug(telepathy.server.Debug): |
1051 | 22 | """oFono debug interface | 23 | """oFono debug interface |
1052 | 23 | 24 | ||
1053 | 24 | 25 | ||
1054 | === modified file 'tpofono/handle.py' | |||
1055 | --- tpofono/handle.py 2013-02-19 20:09:40 +0000 | |||
1056 | +++ tpofono/handle.py 2013-03-28 19:50:24 +0000 | |||
1057 | @@ -25,6 +25,7 @@ | |||
1058 | 25 | 25 | ||
1059 | 26 | logger = logging.getLogger('oFono.Handle') | 26 | logger = logging.getLogger('oFono.Handle') |
1060 | 27 | 27 | ||
1061 | 28 | |||
1062 | 28 | def oFonoHandleFactory(connection, type, id, name, **kwargs): | 29 | def oFonoHandleFactory(connection, type, id, name, **kwargs): |
1063 | 29 | mapping = {telepathy.HANDLE_TYPE_CONTACT: oFonoContactHandle} | 30 | mapping = {telepathy.HANDLE_TYPE_CONTACT: oFonoContactHandle} |
1064 | 30 | handle = mapping[type](connection, id, name, **kwargs) | 31 | handle = mapping[type](connection, id, name, **kwargs) |
1065 | @@ -38,7 +39,7 @@ | |||
1066 | 38 | self._conn = weakref.proxy(connection) | 39 | self._conn = weakref.proxy(connection) |
1067 | 39 | 40 | ||
1068 | 40 | def __unicode__(self): | 41 | def __unicode__(self): |
1070 | 41 | type_mapping = {telepathy.HANDLE_TYPE_CONTACT : 'Contact'} | 42 | type_mapping = {telepathy.HANDLE_TYPE_CONTACT: 'Contact'} |
1071 | 42 | type_str = type_mapping.get(self.type, '') | 43 | type_str = type_mapping.get(self.type, '') |
1072 | 43 | return "<oFono%sHandle id=%u name='%s'>" % \ | 44 | return "<oFono%sHandle id=%u name='%s'>" % \ |
1073 | 44 | (type_str, self.id, self.name) | 45 | (type_str, self.id, self.name) |
1074 | @@ -56,4 +57,3 @@ | |||
1075 | 56 | @property | 57 | @property |
1076 | 57 | def contact(self): | 58 | def contact(self): |
1077 | 58 | return self._contact | 59 | return self._contact |
1078 | 59 | |||
1079 | 60 | 60 | ||
1080 | === modified file 'tpofono/ofono/__init__.py' | |||
1081 | --- tpofono/ofono/__init__.py 2013-02-19 20:09:40 +0000 | |||
1082 | +++ tpofono/ofono/__init__.py 2013-03-28 19:50:24 +0000 | |||
1083 | @@ -25,3 +25,11 @@ | |||
1084 | 25 | from ofonovoicemail import oFonoVoicemail | 25 | from ofonovoicemail import oFonoVoicemail |
1085 | 26 | from ofonomodem import oFonoModem | 26 | from ofonomodem import oFonoModem |
1086 | 27 | from ofonomanager import oFonoManager | 27 | from ofonomanager import oFonoManager |
1087 | 28 | |||
1088 | 29 | __all__ = ['oFonoCall', | ||
1089 | 30 | 'oFonoCalls', | ||
1090 | 31 | 'oFonoCallVolume', | ||
1091 | 32 | 'oFonoMessages', | ||
1092 | 33 | 'oFonoVoicemail', | ||
1093 | 34 | 'oFonoModem', | ||
1094 | 35 | 'oFonoManager'] | ||
1095 | 28 | 36 | ||
1096 | === modified file 'tpofono/ofono/ofonocall.py' | |||
1097 | --- tpofono/ofono/ofonocall.py 2013-02-19 20:09:40 +0000 | |||
1098 | +++ tpofono/ofono/ofonocall.py 2013-03-28 19:50:24 +0000 | |||
1099 | @@ -17,12 +17,12 @@ | |||
1100 | 17 | 17 | ||
1101 | 18 | import logging | 18 | import logging |
1102 | 19 | import dbus | 19 | import dbus |
1103 | 20 | import gobject | ||
1104 | 21 | 20 | ||
1106 | 22 | __all__ = ['oFonoCall.py'] | 21 | __all__ = ['oFonoCall'] |
1107 | 23 | 22 | ||
1108 | 24 | logger = logging.getLogger('oFono.Call') | 23 | logger = logging.getLogger('oFono.Call') |
1109 | 25 | 24 | ||
1110 | 25 | |||
1111 | 26 | class oFonoCall: | 26 | class oFonoCall: |
1112 | 27 | PROPERTY_KEY_STATE = "State" | 27 | PROPERTY_KEY_STATE = "State" |
1113 | 28 | PROPERTY_KEY_LINE_IDENTIFICATION = "LineIdentification" | 28 | PROPERTY_KEY_LINE_IDENTIFICATION = "LineIdentification" |
1114 | @@ -61,7 +61,7 @@ | |||
1115 | 61 | if prop == self.PROPERTY_KEY_STATE: | 61 | if prop == self.PROPERTY_KEY_STATE: |
1116 | 62 | self.StatePropertyChanged(value) | 62 | self.StatePropertyChanged(value) |
1117 | 63 | 63 | ||
1119 | 64 | def StatePropertyChanged(self, state, notify = True): | 64 | def StatePropertyChanged(self, state, notify=True): |
1120 | 65 | self.isRinging = state == self.PROPERTY_STATE_INCOMING | 65 | self.isRinging = state == self.PROPERTY_STATE_INCOMING |
1121 | 66 | self.isHeld = state == self.PROPERTY_STATE_HELD | 66 | self.isHeld = state == self.PROPERTY_STATE_HELD |
1122 | 67 | self.isAlerting = state == self.PROPERTY_STATE_ALERTING | 67 | self.isAlerting = state == self.PROPERTY_STATE_ALERTING |
1123 | @@ -109,4 +109,3 @@ | |||
1124 | 109 | 109 | ||
1125 | 110 | def isCallWaiting(self): | 110 | def isCallWaiting(self): |
1126 | 111 | return self.isWaiting | 111 | return self.isWaiting |
1127 | 112 | |||
1128 | 113 | 112 | ||
1129 | === modified file 'tpofono/ofono/ofonocalls.py' | |||
1130 | --- tpofono/ofono/ofonocalls.py 2013-02-19 20:09:40 +0000 | |||
1131 | +++ tpofono/ofono/ofonocalls.py 2013-03-28 19:50:24 +0000 | |||
1132 | @@ -21,11 +21,10 @@ | |||
1133 | 21 | 21 | ||
1134 | 22 | import logging | 22 | import logging |
1135 | 23 | import dbus | 23 | import dbus |
1136 | 24 | import gobject | ||
1137 | 25 | from ofonomanager import oFonoManager | ||
1138 | 26 | 24 | ||
1139 | 27 | logger = logging.getLogger('oFonoCalls') | 25 | logger = logging.getLogger('oFonoCalls') |
1140 | 28 | 26 | ||
1141 | 27 | |||
1142 | 29 | class oFonoCalls: | 28 | class oFonoCalls: |
1143 | 30 | def __init__(self): | 29 | def __init__(self): |
1144 | 31 | self.props = {} | 30 | self.props = {} |
1145 | @@ -76,7 +75,7 @@ | |||
1146 | 76 | def oFonoCallRemoved(self, objectPath): | 75 | def oFonoCallRemoved(self, objectPath): |
1147 | 77 | # TODO: check if this code actually works | 76 | # TODO: check if this code actually works |
1148 | 78 | if objectPath in self.calls: | 77 | if objectPath in self.calls: |
1150 | 79 | props = self.calls.pop(objectPath) | 78 | self.calls.pop(objectPath) |
1151 | 80 | self.CallRemoved(objectPath) | 79 | self.CallRemoved(objectPath) |
1152 | 81 | 80 | ||
1153 | 82 | def CallAdded(self, objectPath, properties): | 81 | def CallAdded(self, objectPath, properties): |
1154 | 83 | 82 | ||
1155 | === modified file 'tpofono/ofono/ofonocallvolume.py' | |||
1156 | --- tpofono/ofono/ofonocallvolume.py 2013-02-19 20:09:40 +0000 | |||
1157 | +++ tpofono/ofono/ofonocallvolume.py 2013-03-28 19:50:24 +0000 | |||
1158 | @@ -21,15 +21,15 @@ | |||
1159 | 21 | 21 | ||
1160 | 22 | import logging | 22 | import logging |
1161 | 23 | import dbus | 23 | import dbus |
1162 | 24 | import gobject | ||
1163 | 25 | from ofonomanager import oFonoManager | ||
1164 | 26 | 24 | ||
1165 | 27 | logger = logging.getLogger('oFonoCallVolume') | 25 | logger = logging.getLogger('oFonoCallVolume') |
1166 | 28 | 26 | ||
1167 | 27 | |||
1168 | 29 | class oFonoCallVolume: | 28 | class oFonoCallVolume: |
1169 | 30 | PROPERTY_KEY_SPEAKER_VOLUME = "SpeakerVolume" | 29 | PROPERTY_KEY_SPEAKER_VOLUME = "SpeakerVolume" |
1170 | 31 | PROPERTY_KEY_MICROPHONE_VOUME = "MicrophoneVolume" | 30 | PROPERTY_KEY_MICROPHONE_VOUME = "MicrophoneVolume" |
1171 | 32 | PROPERTY_KEY_MUTED = "Muted" | 31 | PROPERTY_KEY_MUTED = "Muted" |
1172 | 32 | |||
1173 | 33 | def __init__(self): | 33 | def __init__(self): |
1174 | 34 | self.props = {} | 34 | self.props = {} |
1175 | 35 | 35 | ||
1176 | 36 | 36 | ||
1177 | === modified file 'tpofono/ofono/ofonomanager.py' | |||
1178 | --- tpofono/ofono/ofonomanager.py 2013-02-20 18:15:06 +0000 | |||
1179 | +++ tpofono/ofono/ofonomanager.py 2013-03-28 19:50:24 +0000 | |||
1180 | @@ -25,8 +25,10 @@ | |||
1181 | 25 | 25 | ||
1182 | 26 | logger = logging.getLogger('oFonoManager') | 26 | logger = logging.getLogger('oFonoManager') |
1183 | 27 | 27 | ||
1184 | 28 | |||
1185 | 28 | class oFonoManager(): | 29 | class oFonoManager(): |
1186 | 29 | ofono_manager_proxy = None | 30 | ofono_manager_proxy = None |
1187 | 31 | |||
1188 | 30 | def __init__(self, modem_interfaces): | 32 | def __init__(self, modem_interfaces): |
1189 | 31 | self.modem_interfaces = modem_interfaces | 33 | self.modem_interfaces = modem_interfaces |
1190 | 32 | self.modems = [] | 34 | self.modems = [] |
1191 | @@ -46,7 +48,7 @@ | |||
1192 | 46 | 48 | ||
1193 | 47 | # parse modems | 49 | # parse modems |
1194 | 48 | modems = self.GetModems() | 50 | modems = self.GetModems() |
1196 | 49 | for modem in self.GetModems(): | 51 | for modem in modems: |
1197 | 50 | self.oFonoModemAdded(modem[0], modem[1]) | 52 | self.oFonoModemAdded(modem[0], modem[1]) |
1198 | 51 | 53 | ||
1199 | 52 | except: | 54 | except: |
1200 | @@ -97,4 +99,3 @@ | |||
1201 | 97 | 99 | ||
1202 | 98 | def ModemRemoved(self, modem): | 100 | def ModemRemoved(self, modem): |
1203 | 99 | pass | 101 | pass |
1204 | 100 | |||
1205 | 101 | 102 | ||
1206 | === modified file 'tpofono/ofono/ofonomessages.py' | |||
1207 | --- tpofono/ofono/ofonomessages.py 2013-02-19 20:09:40 +0000 | |||
1208 | +++ tpofono/ofono/ofonomessages.py 2013-03-28 19:50:24 +0000 | |||
1209 | @@ -20,11 +20,10 @@ | |||
1210 | 20 | 20 | ||
1211 | 21 | import logging | 21 | import logging |
1212 | 22 | import dbus | 22 | import dbus |
1213 | 23 | import gobject | ||
1214 | 24 | from ofonomanager import oFonoManager | ||
1215 | 25 | 23 | ||
1216 | 26 | logger = logging.getLogger('oFonoMessages') | 24 | logger = logging.getLogger('oFonoMessages') |
1217 | 27 | 25 | ||
1218 | 26 | |||
1219 | 28 | class oFonoMessages: | 27 | class oFonoMessages: |
1220 | 29 | 28 | ||
1221 | 30 | PROPERTY_KEY_STATUS = "State" | 29 | PROPERTY_KEY_STATUS = "State" |
1222 | @@ -77,4 +76,3 @@ | |||
1223 | 77 | objectPath = self.ofono_message_proxy.SendMessage(to, message) | 76 | objectPath = self.ofono_message_proxy.SendMessage(to, message) |
1224 | 78 | self.pendingMessages[objectPath] = textChannel | 77 | self.pendingMessages[objectPath] = textChannel |
1225 | 79 | return objectPath | 78 | return objectPath |
1226 | 80 | |||
1227 | 81 | 79 | ||
1228 | === modified file 'tpofono/ofono/ofonomodem.py' | |||
1229 | --- tpofono/ofono/ofonomodem.py 2013-02-20 18:15:06 +0000 | |||
1230 | +++ tpofono/ofono/ofonomodem.py 2013-03-28 19:50:24 +0000 | |||
1231 | @@ -18,10 +18,11 @@ | |||
1232 | 18 | import logging | 18 | import logging |
1233 | 19 | import dbus | 19 | import dbus |
1234 | 20 | 20 | ||
1236 | 21 | __all__ = ['oFonoModem.py'] | 21 | __all__ = ['oFonoModem'] |
1237 | 22 | 22 | ||
1238 | 23 | logger = logging.getLogger('oFono.Modem') | 23 | logger = logging.getLogger('oFono.Modem') |
1239 | 24 | 24 | ||
1240 | 25 | |||
1241 | 25 | class oFonoModem: | 26 | class oFonoModem: |
1242 | 26 | def __init__(self, manager, objectPath, properties): | 27 | def __init__(self, manager, objectPath, properties): |
1243 | 27 | self._manager = manager | 28 | self._manager = manager |
1244 | 28 | 29 | ||
1245 | === modified file 'tpofono/ofono/ofonovoicemail.py' | |||
1246 | --- tpofono/ofono/ofonovoicemail.py 2013-02-19 20:09:40 +0000 | |||
1247 | +++ tpofono/ofono/ofonovoicemail.py 2013-03-28 19:50:24 +0000 | |||
1248 | @@ -21,15 +21,15 @@ | |||
1249 | 21 | 21 | ||
1250 | 22 | import logging | 22 | import logging |
1251 | 23 | import dbus | 23 | import dbus |
1252 | 24 | import gobject | ||
1253 | 25 | from ofonomanager import oFonoManager | ||
1254 | 26 | 24 | ||
1255 | 27 | logger = logging.getLogger('oFonoVoicemail') | 25 | logger = logging.getLogger('oFonoVoicemail') |
1256 | 28 | 26 | ||
1257 | 27 | |||
1258 | 29 | class oFonoVoicemail: | 28 | class oFonoVoicemail: |
1259 | 30 | PROPERTY_KEY_VOICEMAIL_WAITING = "VoicemailWaiting" | 29 | PROPERTY_KEY_VOICEMAIL_WAITING = "VoicemailWaiting" |
1260 | 31 | PROPERTY_KEY_VOICEMAIL_MESSAGE_COUNT = "VoicemailMessageCount" | 30 | PROPERTY_KEY_VOICEMAIL_MESSAGE_COUNT = "VoicemailMessageCount" |
1261 | 32 | PROPERTY_KEY_VOICEMAIL_NUMBER = "VoicemailMailboxNumber" | 31 | PROPERTY_KEY_VOICEMAIL_NUMBER = "VoicemailMailboxNumber" |
1262 | 32 | |||
1263 | 33 | def __init__(self): | 33 | def __init__(self): |
1264 | 34 | self.voicemailProps = {} | 34 | self.voicemailProps = {} |
1265 | 35 | 35 | ||
1266 | @@ -39,7 +39,11 @@ | |||
1267 | 39 | logger.info("Using modem %s" % modem.objectPath) | 39 | logger.info("Using modem %s" % modem.objectPath) |
1268 | 40 | ofono_object = self.bus.get_object('org.ofono', modem.objectPath) | 40 | ofono_object = self.bus.get_object('org.ofono', modem.objectPath) |
1269 | 41 | self.ofono_voicemail_proxy = dbus.Interface(ofono_object, interface) | 41 | self.ofono_voicemail_proxy = dbus.Interface(ofono_object, interface) |
1271 | 42 | self.bus.add_signal_receiver(self.PropertyChanged, 'PropertyChanged', interface, 'org.ofono', modem.objectPath) | 42 | self.bus.add_signal_receiver(self.PropertyChanged, |
1272 | 43 | 'PropertyChanged', | ||
1273 | 44 | interface, | ||
1274 | 45 | 'org.ofono', | ||
1275 | 46 | modem.objectPath) | ||
1276 | 43 | self.voicemailProps = self.ofono_voicemail_proxy.GetProperties() | 47 | self.voicemailProps = self.ofono_voicemail_proxy.GetProperties() |
1277 | 44 | except: | 48 | except: |
1278 | 45 | # bus not available yet | 49 | # bus not available yet |
1279 | 46 | 50 | ||
1280 | === modified file 'tpofono/presence.py' | |||
1281 | --- tpofono/presence.py 2013-02-19 20:09:40 +0000 | |||
1282 | +++ tpofono/presence.py 2013-03-28 19:50:24 +0000 | |||
1283 | @@ -20,14 +20,13 @@ | |||
1284 | 20 | # http://telepathy.freedesktop.org/spec.html#org.freedesktop.Telepathy.Connection.Interface.SimplePresence | 20 | # http://telepathy.freedesktop.org/spec.html#org.freedesktop.Telepathy.Connection.Interface.SimplePresence |
1285 | 21 | 21 | ||
1286 | 22 | import logging | 22 | import logging |
1287 | 23 | import time | ||
1288 | 24 | 23 | ||
1289 | 25 | import dbus | 24 | import dbus |
1290 | 26 | import telepathy | 25 | import telepathy |
1291 | 27 | import telepathy.constants | 26 | import telepathy.constants |
1292 | 28 | import telepathy.errors | 27 | import telepathy.errors |
1293 | 29 | 28 | ||
1295 | 30 | __all__ = ['oFonoConnection'] | 29 | __all__ = ['oFonoPresence'] |
1296 | 31 | 30 | ||
1297 | 32 | logger = logging.getLogger('oFono.Presence') | 31 | logger = logging.getLogger('oFono.Presence') |
1298 | 33 | 32 | ||
1299 | @@ -39,9 +38,9 @@ | |||
1300 | 39 | 38 | ||
1301 | 40 | self._implement_property_get( | 39 | self._implement_property_get( |
1302 | 41 | telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE, { | 40 | telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE, { |
1306 | 42 | 'Statuses' : lambda: { | 41 | 'Statuses': lambda: { |
1307 | 43 | "available":(telepathy.CONNECTION_PRESENCE_TYPE_AVAILABLE, True, False), | 42 | "available": (telepathy.CONNECTION_PRESENCE_TYPE_AVAILABLE, True, False), |
1308 | 44 | "offline":(telepathy.CONNECTION_PRESENCE_TYPE_OFFLINE, True, False) | 43 | "offline": (telepathy.CONNECTION_PRESENCE_TYPE_OFFLINE, True, False) |
1309 | 45 | } | 44 | } |
1310 | 46 | }) | 45 | }) |
1311 | 47 | self._selfPresence = "offline" | 46 | self._selfPresence = "offline" |
1312 | @@ -60,7 +59,7 @@ | |||
1313 | 60 | return self.get_simple_presences(contacts) | 59 | return self.get_simple_presences(contacts) |
1314 | 61 | 60 | ||
1315 | 62 | def SetPresence(self, status, message): | 61 | def SetPresence(self, status, message): |
1317 | 63 | logger.info("Setting Presence to '%s'" % presence) | 62 | logger.info("Setting Presence to '%s'" % status) |
1318 | 64 | logger.info("Setting Personal message to '%s'" % message) | 63 | logger.info("Setting Personal message to '%s'" % message) |
1319 | 65 | 64 | ||
1320 | 66 | message = message.encode("utf-8") | 65 | message = message.encode("utf-8") |
1321 | @@ -82,7 +81,7 @@ | |||
1322 | 82 | presence_type = telepathy.CONNECTION_PRESENCE_TYPE_OFFLINE | 81 | presence_type = telepathy.CONNECTION_PRESENCE_TYPE_OFFLINE |
1323 | 83 | 82 | ||
1324 | 84 | presences[handle] = dbus.Struct((presence_type, presence, | 83 | presences[handle] = dbus.Struct((presence_type, presence, |
1326 | 85 | personal_message), signature='uss') | 84 | personal_message), signature='uss') |
1327 | 86 | return presences | 85 | return presences |
1328 | 87 | 86 | ||
1329 | 88 | def _presence_changed(self, handle, presence, personal_message): | 87 | def _presence_changed(self, handle, presence, personal_message): |
1330 | @@ -93,4 +92,3 @@ | |||
1331 | 93 | personal_message = "" | 92 | personal_message = "" |
1332 | 94 | 93 | ||
1333 | 95 | self.PresencesChanged({handle: (presence_type, presence, personal_message)}) | 94 | self.PresencesChanged({handle: (presence_type, presence, personal_message)}) |
1334 | 96 | |||
1335 | 97 | 95 | ||
1336 | === modified file 'tpofono/protocol.py' | |||
1337 | --- tpofono/protocol.py 2013-02-19 20:09:40 +0000 | |||
1338 | +++ tpofono/protocol.py 2013-03-28 19:50:24 +0000 | |||
1339 | @@ -27,6 +27,7 @@ | |||
1340 | 27 | 27 | ||
1341 | 28 | logger = logging.getLogger('oFono.Protocol') | 28 | logger = logging.getLogger('oFono.Protocol') |
1342 | 29 | 29 | ||
1343 | 30 | |||
1344 | 30 | class oFonoProtocol(telepathy.server.Protocol): | 31 | class oFonoProtocol(telepathy.server.Protocol): |
1345 | 31 | 32 | ||
1346 | 32 | _proto = "ofono" | 33 | _proto = "ofono" |
1347 | @@ -48,12 +49,12 @@ | |||
1348 | 48 | ] | 49 | ] |
1349 | 49 | 50 | ||
1350 | 50 | _supported_interfaces = [ | 51 | _supported_interfaces = [ |
1357 | 51 | telepathy.CONNECTION_INTERFACE_ALIASING, | 52 | telepathy.CONNECTION_INTERFACE_ALIASING, |
1358 | 52 | telepathy.CONNECTION_INTERFACE_CAPABILITIES, | 53 | telepathy.CONNECTION_INTERFACE_CAPABILITIES, |
1359 | 53 | telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES, | 54 | telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES, |
1360 | 54 | telepathy.CONNECTION_INTERFACE_CONTACTS, | 55 | telepathy.CONNECTION_INTERFACE_CONTACTS, |
1361 | 55 | telepathy.CONNECTION_INTERFACE_REQUESTS, | 56 | telepathy.CONNECTION_INTERFACE_REQUESTS, |
1362 | 56 | ] | 57 | ] |
1363 | 57 | 58 | ||
1364 | 58 | def __init__(self, connection_manager): | 59 | def __init__(self, connection_manager): |
1365 | 59 | telepathy.server.Protocol.__init__(self, connection_manager, 'ofono') | 60 | telepathy.server.Protocol.__init__(self, connection_manager, 'ofono') |
PASSED: Continuous integration, rev:87 jenkins. qa.ubuntu. com/job/ telepathy- ofono-ci/ 1/ jenkins. qa.ubuntu. com/job/ telepathy- ofono-quantal- armhf-ci/ 1 jenkins. qa.ubuntu. com/job/ telepathy- ofono-quantal- i386-ci/ 1 jenkins. qa.ubuntu. com/job/ telepathy- ofono-raring- armhf-ci/ 1 jenkins. qa.ubuntu. com/job/ telepathy- ofono-raring- i386-ci/ 1
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ telepathy- ofono-ci/ 1/rebuild
http://