Merge lp:~tiagosh/telepathy-ofono/add-ril-mc-plugin into lp:telepathy-ofono

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 146
Merged at revision: 138
Proposed branch: lp:~tiagosh/telepathy-ofono/add-ril-mc-plugin
Merge into: lp:telepathy-ofono
Diff against target: 576 lines (+461/-7)
11 files modified
CMakeLists.txt (+2/-0)
debian/control (+11/-0)
debian/copyright (+6/-0)
debian/telepathy-ofono-ril-mc-plugin.install (+1/-0)
debian/telepathy-ofono.install (+3/-0)
mc-plugin/CMakeLists.txt (+21/-0)
mc-plugin/mcp-account-manager-ofono.c (+312/-0)
mc-plugin/mcp-account-manager-ofono.h (+49/-0)
mc-plugin/mission-control-plugin.c (+39/-0)
protocol.cpp (+2/-1)
tests/dbus-test-wrapper.sh.in (+15/-6)
To merge this branch: bzr merge lp:~tiagosh/telepathy-ofono/add-ril-mc-plugin
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+259173@code.launchpad.net

Commit message

Add mc-plugin to provision ril modem accounts.

Description of the change

Add mc-plugin to provision ril modem accounts.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
140. By Tiago Salem Herrmann

Change tests to use the mission control plugin

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
141. By Tiago Salem Herrmann

replace killall by pgrep+kill and also kill mission control

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
142. By Tiago Salem Herrmann

enable test debug

143. By Tiago Salem Herrmann

wait until instances are running

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
144. By Tiago Salem Herrmann

add more debugs

145. By Tiago Salem Herrmann

dont fail if gsettings schema isn't installed

146. By Tiago Salem Herrmann

check if schema is available

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-22 09:15:36 +0000
3+++ CMakeLists.txt 2015-05-19 14:32:26 +0000
4@@ -37,6 +37,7 @@
5 find_package(PkgConfig REQUIRED)
6 pkg_check_modules(TP_QT5 REQUIRED TelepathyQt5)
7 pkg_check_modules(SQLITE3 REQUIRED sqlite3)
8+pkg_check_modules(MC_PLUGINS REQUIRED mission-control-plugins)
9
10 pkg_check_modules(PULSEAUDIO libpulse)
11 if (PULSEAUDIO_FOUND)
12@@ -117,3 +118,4 @@
13
14 add_subdirectory(schema)
15 add_subdirectory(tests)
16+add_subdirectory(mc-plugin)
17
18=== modified file 'debian/control'
19--- debian/control 2013-12-11 14:52:03 +0000
20+++ debian/control 2015-05-19 14:32:26 +0000
21@@ -7,6 +7,7 @@
22 dbus-test-runner,
23 dconf-cli,
24 gnome-keyring,
25+ libmission-control-plugins-dev (>= 1:5.14.0),
26 libofono-qt-dev (>= 1.5),
27 libqt5sql5-sqlite,
28 libtelepathy-qt5-dev (>= 0.9.3),
29@@ -33,3 +34,13 @@
30 telepathy-ofono is a Telepathy connection manager that makes it possible for
31 Telepathy clients to communicate using oFono modems, enabling features like
32 real phone calls and send and receive SMSs.
33+
34+Package: telepathy-ofono-ril-mc-plugin
35+Architecture: any
36+Depends: telepathy-ofono,
37+ ${misc:Depends},
38+ ${shlibs:Depends},
39+ libhybris-utils
40+Description: telepathy oFono mission control plugin for ril modems
41+ This telepathy mission-control plugin is used to automatically provision
42+ telepathy-ofono accounts for each available ril modem.
43
44=== modified file 'debian/copyright'
45--- debian/copyright 2013-12-04 14:31:39 +0000
46+++ debian/copyright 2015-05-19 14:32:26 +0000
47@@ -23,6 +23,12 @@
48 Copyright: 2010 Nokia Corporation and/or its subsidiary(-ies).
49 License: LGPL-2.1+
50
51+Files: mc-plugin/*
52+Copyright: 2015 Canonical Ltd
53+ 2012 Jolla Ltd
54+ 2012 Collabora Ltd
55+License: LGPL-2.1+
56+
57 License: Apache-2.0
58 Licensed under the Apache License, Version 2.0 (the "License");
59 you may not use this file except in compliance with the License.
60
61=== added file 'debian/telepathy-ofono-ril-mc-plugin.install'
62--- debian/telepathy-ofono-ril-mc-plugin.install 1970-01-01 00:00:00 +0000
63+++ debian/telepathy-ofono-ril-mc-plugin.install 2015-05-19 14:32:26 +0000
64@@ -0,0 +1,1 @@
65+usr/*/mission-control-plugins*/mcp-account-manager-ofono.so
66
67=== added file 'debian/telepathy-ofono.install'
68--- debian/telepathy-ofono.install 1970-01-01 00:00:00 +0000
69+++ debian/telepathy-ofono.install 2015-05-19 14:32:26 +0000
70@@ -0,0 +1,3 @@
71+usr/lib/telepathy/telepathy-ofono
72+usr/share/telepathy/managers/ofono.manager
73+usr/share/dbus-1/services/org.freedesktop.Telepathy.ConnectionManager.ofono.service
74
75=== added directory 'mc-plugin'
76=== added file 'mc-plugin/CMakeLists.txt'
77--- mc-plugin/CMakeLists.txt 1970-01-01 00:00:00 +0000
78+++ mc-plugin/CMakeLists.txt 2015-05-19 14:32:26 +0000
79@@ -0,0 +1,21 @@
80+set(MCP_ACCOUNT_MANAGER_NAME mcp-account-manager-ofono)
81+
82+set(MC_PLUGIN_SRC
83+ mcp-account-manager-ofono.c
84+ mission-control-plugin.c
85+)
86+
87+set(MC_PLUGIN_HDRS
88+ mcp-account-manager-ofono.h
89+)
90+
91+execute_process(COMMAND pkg-config --variable=plugindir mission-control-plugins
92+ OUTPUT_VARIABLE MC_PLUGINS_DIR)
93+string(REPLACE "\n" "" MC_PLUGINS_DIR ${MC_PLUGINS_DIR})
94+
95+include_directories(${MC_PLUGINS_INCLUDE_DIRS})
96+add_library(${MCP_ACCOUNT_MANAGER_NAME} SHARED ${MC_PLUGIN_SRC} ${MC_PLUGIN_HDRS})
97+set_target_properties(${MCP_ACCOUNT_MANAGER_NAME} PROPERTIES PREFIX "")
98+target_link_libraries(${MCP_ACCOUNT_MANAGER_NAME} ${MC_PLUGINS_LIBRARIES})
99+
100+install(TARGETS ${MCP_ACCOUNT_MANAGER_NAME} DESTINATION ${MC_PLUGINS_DIR})
101
102=== added file 'mc-plugin/mcp-account-manager-ofono.c'
103--- mc-plugin/mcp-account-manager-ofono.c 1970-01-01 00:00:00 +0000
104+++ mc-plugin/mcp-account-manager-ofono.c 2015-05-19 14:32:26 +0000
105@@ -0,0 +1,312 @@
106+/*
107+ * Copyright (C) 2015 Canonical, Ltd.
108+ * Contact: Tiago Salem Herrmann <tiago.herrmann@canonical.com>
109+ *
110+ * Based on Empathy ubuntu-online-accounts, mcp-account-manager-ring:
111+ * Contact: John Brooks <john.brooks@jollamobile.com>
112+ * Copyright (C) 2012 Jolla Ltd.
113+ * Copyright (C) 2012 Collabora Ltd.
114+ *
115+ * This library is free software; you can redistribute it and/or
116+ * modify it under the terms of the GNU Lesser General Public
117+ * License as published by the Free Software Foundation; either
118+ * version 2.1 of the License, or (at your option) any later version.
119+ *
120+ * This library is distributed in the hope that it will be useful,
121+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
122+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
123+ * Lesser General Public License for more details.
124+ *
125+ * You should have received a copy of the GNU Lesser General Public
126+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
127+ */
128+
129+#include <string.h>
130+#include <stdio.h>
131+#include "mcp-account-manager-ofono.h"
132+
133+#define PLUGIN_NAME "ofono-account"
134+#define PLUGIN_PRIORITY (MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_DEFAULT - 10)
135+#define PLUGIN_DESCRIPTION "Provide ril modem accounts for telepathy-ofono"
136+#define PLUGIN_PROVIDER "im.telepathy.Account.Storage.Ofono"
137+
138+static void account_storage_iface_init(McpAccountStorageIface *iface);
139+
140+G_DEFINE_TYPE_WITH_CODE (McpAccountManagerOfono, mcp_account_manager_ofono,
141+ G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (MCP_TYPE_ACCOUNT_STORAGE,
142+ account_storage_iface_init));
143+
144+struct ofono_account {
145+ gchar *account_name;
146+ int index;
147+ GHashTable *params;
148+};
149+typedef struct ofono_account OfonoAccount;
150+
151+struct _McpAccountManagerOfonoPrivate
152+{
153+ GList *accounts;
154+};
155+
156+void free_ofono_struct (gpointer data)
157+{
158+ OfonoAccount *account = (OfonoAccount*)data;
159+ g_hash_table_unref(account->params);
160+ g_free(account->account_name);
161+}
162+
163+static void mcp_account_manager_ofono_dispose(GObject *object)
164+{
165+ McpAccountManagerOfono *self = (McpAccountManagerOfono*) object;
166+
167+ g_list_free_full(self->priv->accounts, free_ofono_struct);
168+
169+ G_OBJECT_CLASS (mcp_account_manager_ofono_parent_class)->dispose(object);
170+}
171+
172+static void mcp_account_manager_ofono_init(McpAccountManagerOfono *self)
173+{
174+ g_debug("MC ril ofono accounts plugin initialized");
175+ gchar *output = NULL;
176+ gchar *output2 = NULL;
177+ const gchar *force_num_modems = g_getenv("FORCE_RIL_NUM_MODEMS");
178+ GError *error = NULL;
179+ int num_modems = 0;
180+ int index;
181+
182+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, MCP_TYPE_ACCOUNT_MANAGER_OFONO,
183+ McpAccountManagerOfonoPrivate);
184+
185+ if (force_num_modems) {
186+ num_modems = atoi(force_num_modems);
187+ g_debug("forced number of modems: %d", num_modems);
188+ } else {
189+ if (!g_file_test ("/usr/bin/getprop", G_FILE_TEST_IS_EXECUTABLE)) {
190+ return;
191+ }
192+ if (!g_spawn_command_line_sync("/usr/bin/getprop rild.libpath ''",
193+ &output, NULL, NULL,
194+ &error)) {
195+ g_debug("%s", error->message);
196+ g_error_free (error);
197+ return;
198+ }
199+
200+ if (strlen(g_strstrip(output)) != 0) {
201+ g_spawn_command_line_sync("/usr/bin/getprop ril.num_slots 1",
202+ &output2,
203+ NULL,
204+ NULL,
205+ &error);
206+ num_modems = atoi(output2);
207+ }
208+ }
209+
210+ GSettings *settings = NULL;
211+ GSettingsSchemaSource *source = g_settings_schema_source_get_default();
212+ if (source != NULL && g_settings_schema_source_lookup(source, "com.ubuntu.phone", TRUE) != NULL) {
213+ settings = g_settings_new("com.ubuntu.phone");
214+ }
215+ for (index = 0; index < num_modems; index++) {
216+ OfonoAccount *account = (OfonoAccount*)malloc(sizeof(OfonoAccount));
217+ char account_name[30] = {0};
218+ char ril_modem[10] = {0};
219+ account->index = index;
220+ sprintf(account_name, "ofono/ofono/account%d", index);
221+ sprintf(ril_modem, "/ril_%d", index);
222+ account->params = g_hash_table_new(g_str_hash, g_str_equal);
223+ account->account_name = g_strdup(account_name);
224+ g_hash_table_insert(account->params, g_strdup("manager"), g_strdup("ofono"));
225+ g_hash_table_insert(account->params, g_strdup("protocol"), g_strdup("ofono"));
226+ g_hash_table_insert(account->params, g_strdup("Enabled"), g_strdup("true"));
227+ g_hash_table_insert(account->params, g_strdup("ConnectAutomatically"), g_strdup("true"));
228+ g_hash_table_insert(account->params, g_strdup("always_dispatch"), g_strdup("true"));
229+ g_hash_table_insert(account->params, g_strdup("param-modem-objpath"), g_strdup(ril_modem));
230+ if (settings) {
231+ GVariant *sim_names = g_settings_get_value(settings, "sim-names");
232+ if (sim_names) {
233+ GVariantIter iter;
234+ GVariant *value;
235+ gchar *key;
236+
237+ g_variant_iter_init (&iter, sim_names);
238+ while (g_variant_iter_next (&iter, "{ss}", &key, &value)) {
239+ if (!strcmp(key, ril_modem)) {
240+ g_hash_table_insert(account->params, g_strdup("DisplayName"), g_strdup((char *)value));
241+ }
242+ g_free (key);
243+ g_free (value);
244+ }
245+ }
246+ if (sim_names) {
247+ g_variant_unref(sim_names);
248+ }
249+ }
250+
251+ self->priv->accounts = g_list_append(self->priv->accounts, account);
252+ }
253+ if (settings) {
254+ g_object_unref (settings);
255+ }
256+ if (output) {
257+ g_free(output);
258+ }
259+ if (output2) {
260+ g_free (output2);
261+ }
262+}
263+
264+static void mcp_account_manager_ofono_class_init(McpAccountManagerOfonoClass *klass)
265+{
266+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
267+ gobject_class->dispose = mcp_account_manager_ofono_dispose;
268+
269+ g_type_class_add_private(gobject_class, sizeof(McpAccountManagerOfonoPrivate));
270+}
271+
272+static GList *account_manager_ofono_list(const McpAccountStorage *storage, const McpAccountManager *am)
273+{
274+ McpAccountManagerOfono *self = (McpAccountManagerOfono*) storage;
275+ GList *accounts = NULL;
276+ OfonoAccount *account = NULL;
277+ GList *l;
278+ for (l = self->priv->accounts; l != NULL; l = l->next) {
279+ account = (OfonoAccount*)l->data;
280+ accounts = g_list_prepend(accounts, g_strdup(account->account_name));
281+ }
282+ return accounts;
283+}
284+
285+static gboolean account_manager_ofono_get(const McpAccountStorage *storage, const McpAccountManager *am,
286+ const gchar *account_name, const gchar *key)
287+{
288+ McpAccountManagerOfono *self = (McpAccountManagerOfono*) storage;
289+ GList *l;
290+ OfonoAccount *account = NULL;
291+ int found = 0;
292+ for (l = self->priv->accounts; l != NULL; l = l->next) {
293+ account = (OfonoAccount*)l->data;
294+ if (!strcmp(account_name, account->account_name)) {
295+ found = 1;
296+ break;
297+ }
298+ }
299+ if (!found) {
300+ return FALSE;
301+ }
302+
303+ if (key == NULL) {
304+ GHashTableIter iter;
305+ gpointer itkey, value;
306+ g_hash_table_iter_init(&iter, account->params);
307+ while (g_hash_table_iter_next(&iter, &itkey, &value)) {
308+ g_debug("%s: %s, %s %s", G_STRFUNC, account_name, (char*)itkey, (char*)value);
309+ mcp_account_manager_set_value(am, account_name, itkey, value);
310+ }
311+ } else {
312+ gchar *value = g_hash_table_lookup(account->params, key);
313+ g_debug("%s: %s, %s %s", G_STRFUNC, account_name, (char*)key, (char*)value);
314+ mcp_account_manager_set_value(am, account_name, key, value);
315+ }
316+ return FALSE;
317+}
318+
319+static gboolean account_manager_ofono_set(const McpAccountStorage *storage, const McpAccountManager *am,
320+ const gchar *account_name, const gchar *key, const gchar *val)
321+{
322+ return FALSE;
323+}
324+
325+static gchar *account_manager_ofono_create(const McpAccountStorage *storage, const McpAccountManager *am,
326+ const gchar *cm_name, const gchar *protocol_name, GHashTable *params, GError **error)
327+{
328+ g_set_error(error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Ofono ril account manager cannot create accounts");
329+ return NULL;
330+}
331+
332+static gboolean account_manager_ofono_delete(const McpAccountStorage *storage, const McpAccountManager *am,
333+ const gchar *account_name, const gchar *key)
334+{
335+ g_debug("%s: %s, %s", G_STRFUNC, account_name, key);
336+ return FALSE;
337+}
338+
339+static gboolean account_manager_ofono_commit(const McpAccountStorage *storage, const McpAccountManager *am)
340+{
341+ g_debug("%s", G_STRFUNC);
342+ return FALSE;
343+}
344+
345+static void account_manager_ofono_get_identifier(const McpAccountStorage *storage, const gchar *account_name,
346+ GValue *identifier)
347+{
348+ McpAccountManagerOfono *self = (McpAccountManagerOfono*) storage;
349+
350+ GList *l;
351+ OfonoAccount *account = NULL;
352+ int found = 0;
353+ for (l = self->priv->accounts; l != NULL; l = l->next) {
354+ account = (OfonoAccount*)l->data;
355+ if (!strcmp(account_name, account->account_name)) {
356+ found = 1;
357+ break;
358+ }
359+ }
360+ if (!found) {
361+ return;
362+ }
363+
364+ g_debug("%s: %s", G_STRFUNC, account_name);
365+ g_value_init(identifier, G_TYPE_UINT);
366+ g_value_set_uint(identifier, account->index);
367+}
368+
369+static guint account_manager_ofono_get_restrictions(const McpAccountStorage *storage, const gchar *account_name)
370+{
371+ McpAccountManagerOfono *self = (McpAccountManagerOfono*) storage;
372+
373+ GList *l;
374+ OfonoAccount *account = NULL;
375+ int found = 0;
376+ for (l = self->priv->accounts; l != NULL; l = l->next) {
377+ account = (OfonoAccount*)l->data;
378+ if (!strcmp(account_name, account->account_name)) {
379+ found = 1;
380+ break;
381+ }
382+ }
383+
384+ if (!found) {
385+ return G_MAXUINT;
386+ }
387+
388+ return TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS |
389+ TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED |
390+ TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PRESENCE |
391+ TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE;
392+}
393+
394+static void account_storage_iface_init(McpAccountStorageIface *iface)
395+{
396+ iface->name = PLUGIN_NAME;
397+ iface->desc = PLUGIN_DESCRIPTION;
398+ iface->priority = PLUGIN_PRIORITY;
399+ iface->provider = PLUGIN_PROVIDER;
400+
401+#define IMPLEMENT(x) iface->x = account_manager_ofono_##x
402+ IMPLEMENT (get);
403+ IMPLEMENT (list);
404+ IMPLEMENT (set);
405+ IMPLEMENT (create);
406+ IMPLEMENT (delete);
407+ IMPLEMENT (commit);
408+ IMPLEMENT (get_identifier);
409+ IMPLEMENT (get_restrictions);
410+#undef IMPLEMENT
411+}
412+
413+McpAccountManagerOfono *mcp_account_manager_ofono_new(void)
414+{
415+ return g_object_new(MCP_TYPE_ACCOUNT_MANAGER_OFONO, NULL);
416+}
417+
418
419=== added file 'mc-plugin/mcp-account-manager-ofono.h'
420--- mc-plugin/mcp-account-manager-ofono.h 1970-01-01 00:00:00 +0000
421+++ mc-plugin/mcp-account-manager-ofono.h 2015-05-19 14:32:26 +0000
422@@ -0,0 +1,49 @@
423+#ifndef __MCP_ACCOUNT_MANAGER_OFONO_H__
424+#define __MCP_ACCOUNT_MANAGER_OFONO_H__
425+
426+#include <mission-control-plugins/mission-control-plugins.h>
427+
428+G_BEGIN_DECLS
429+
430+#define MCP_TYPE_ACCOUNT_MANAGER_OFONO \
431+ (mcp_account_manager_ofono_get_type ())
432+#define MCP_ACCOUNT_MANAGER_OFONO(o) \
433+ (G_TYPE_CHECK_INSTANCE_CAST ((o), MCP_TYPE_ACCOUNT_MANAGER_OFONO, \
434+ McpAccountManagerOfono))
435+
436+#define MCP_ACCOUNT_MANAGER_OFONO_CLASS(k) \
437+ (G_TYPE_CHECK_CLASS_CAST((k), MCP_TYPE_ACCOUNT_MANAGER_OFONO, \
438+ McpAccountManagerOfonoClass))
439+
440+#define MCP_IS_ACCOUNT_MANAGER_OFONO(o) \
441+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), MCP_TYPE_ACCOUNT_MANAGER_OFONO))
442+
443+#define MCP_IS_ACCOUNT_MANAGER_OFONO_CLASS(k) \
444+ (G_TYPE_CHECK_CLASS_TYPE ((k), MCP_TYPE_ACCOUNT_MANAGER_OFONO))
445+
446+#define MCP_ACCOUNT_MANAGER_OFONO_GET_CLASS(o) \
447+ (G_TYPE_INSTANCE_GET_CLASS ((o), MCP_TYPE_ACCOUNT_MANAGER_OFONO, \
448+ McpAccountManagerOfonoClass))
449+
450+typedef struct _McpAccountManagerOfonoPrivate McpAccountManagerOfonoPrivate;
451+
452+typedef struct {
453+ GObject parent;
454+
455+ McpAccountManagerOfonoPrivate *priv;
456+} _McpAccountManagerOfono;
457+
458+typedef struct {
459+ GObjectClass parent_class;
460+} _McpAccountManagerOfonoClass;
461+
462+typedef _McpAccountManagerOfono McpAccountManagerOfono;
463+typedef _McpAccountManagerOfonoClass McpAccountManagerOfonoClass;
464+
465+GType mcp_account_manager_ofono_get_type (void) G_GNUC_CONST;
466+
467+McpAccountManagerOfono *mcp_account_manager_ofono_new (void);
468+
469+G_END_DECLS
470+
471+#endif
472
473=== added file 'mc-plugin/mission-control-plugin.c'
474--- mc-plugin/mission-control-plugin.c 1970-01-01 00:00:00 +0000
475+++ mc-plugin/mission-control-plugin.c 2015-05-19 14:32:26 +0000
476@@ -0,0 +1,39 @@
477+/*
478+ * Copyright (C) 2012 Jolla Ltd.
479+ * Contact: John Brooks <john.brooks@jollamobile.com>
480+ *
481+ * This library is free software; you can redistribute it and/or
482+ * modify it under the terms of the GNU Lesser General Public
483+ * License as published by the Free Software Foundation; either
484+ * version 2.1 of the License, or (at your option) any later version.
485+ *
486+ * This library is distributed in the hope that it will be useful,
487+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
488+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
489+ * Lesser General Public License for more details.
490+ *
491+ * You should have received a copy of the GNU Lesser General Public
492+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
493+ */
494+
495+#include <mission-control-plugins/mission-control-plugins.h>
496+#include "mcp-account-manager-ofono.h"
497+
498+GObject *
499+mcp_plugin_ref_nth_object (guint n)
500+{
501+ static void *plugin_0 = NULL;
502+
503+ switch (n) {
504+ case 0:
505+ if (plugin_0 == NULL) {
506+ plugin_0 = g_object_new (MCP_TYPE_ACCOUNT_MANAGER_OFONO, NULL);
507+ } else {
508+ g_object_ref (plugin_0);
509+ }
510+ return plugin_0;
511+ default:
512+ return NULL;
513+ }
514+}
515+
516
517=== modified file 'protocol.cpp'
518--- protocol.cpp 2014-09-23 09:44:37 +0000
519+++ protocol.cpp 2015-05-19 14:32:26 +0000
520@@ -33,7 +33,8 @@
521 setCreateConnectionCallback(memFun(this, &Protocol::createConnection));
522 Tp::ProtocolParameterList parameters;
523 Tp::ProtocolParameter parameter("modem-objpath", "s", 0);
524- parameters << parameter;
525+ Tp::ProtocolParameter parameter2("fakeEmergencyNumber", "s", 0);
526+ parameters << parameter << parameter2;
527
528 setParameters(parameters);
529 }
530
531=== modified file 'tests/dbus-test-wrapper.sh.in'
532--- tests/dbus-test-wrapper.sh.in 2014-04-02 20:18:38 +0000
533+++ tests/dbus-test-wrapper.sh.in 2015-05-19 14:32:26 +0000
534@@ -1,9 +1,13 @@
535-#!/bin/sh
536+#!/bin/sh -x
537
538 # export the home folder to somewhere in /tmp
539 TMPDIR=/tmp/tpofono_test_home
540 rm -rf $TMPDIR
541 export HOME=$TMPDIR
542+mkdir -p $TMPDIR
543+
544+# copy mcp plugin to a temporary directory
545+cp ${CMAKE_BINARY_DIR}/mc-plugin/mcp-account-manager-ofono.so $TMPDIR
546
547 # now run gnome-keyring
548 gnome-keyring-daemon -r -d
549@@ -14,17 +18,22 @@
550 export PA_DISABLED=1
551 # start telepathy-ofono with the ofono-qt mock library
552 LD_PRELOAD=@CMAKE_CURRENT_BINARY_DIR@/mock/libofono-qt.so ${CMAKE_BINARY_DIR}/telepathy-ofono &
553-
554 TP_OFONO_PID=$!
555-
556-mc-tool add ofono/ofono account0
557-mc-tool enable ofono/ofono/account0
558+sleep 2
559+
560+FORCE_RIL_NUM_MODEMS=1 MC_FILTER_PLUGIN_DIR=$TMPDIR G_MESSAGES_DEBUG=all MC_DEBUG=all MCP_DEBUG=all /usr/lib/telepathy/mission-control-5 &
561+MC_CONTROL_PID=$!
562+sleep 2
563+
564+mc-tool update ofono/ofono/account0 string:modem-objpath=/OfonoModem
565+mc-tool reconnect ofono/ofono/account0
566
567 $@
568 RESULT=$?
569
570 kill -9 $TP_OFONO_PID
571+kill -9 $MC_CONTROL_PID
572 #FIXME for some reason history-daemon is not being finished, so we have to kill it here
573-killall history-daemon
574+pgrep history-daemon | xargs kill -9
575
576 return $RESULT

Subscribers

People subscribed via source and target branches