5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
6 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #define CONNMAN_API_SUBJECT_TO_CHANGE
35 #include <connman/plugin.h>
36 #include <connman/device.h>
37 #include <connman/network.h>
38 #include <connman/dbus.h>
39 #include <connman/log.h>
41 #define uninitialized_var(x) x = x
43 #define OFONO_SERVICE "org.ofono"
45 #define OFONO_MANAGER_INTERFACE OFONO_SERVICE ".Manager"
46 #define OFONO_MODEM_INTERFACE OFONO_SERVICE ".Modem"
47 #define OFONO_SIM_INTERFACE OFONO_SERVICE ".SimManager"
48 #define OFONO_NETREG_INTERFACE OFONO_SERVICE ".NetworkRegistration"
49 #define OFONO_CM_INTERFACE OFONO_SERVICE ".ConnectionManager"
50 #define OFONO_CONTEXT_INTERFACE OFONO_SERVICE ".ConnectionContext"
52 #define MODEM_ADDED "ModemAdded"
53 #define MODEM_REMOVED "ModemRemoved"
54 #define PROPERTY_CHANGED "PropertyChanged"
55 #define CONTEXT_ADDED "ContextAdded"
56 #define CONTEXT_REMOVED "ContextRemoved"
58 #define GET_PROPERTIES "GetProperties"
59 #define SET_PROPERTY "SetProperty"
60 #define GET_MODEMS "GetModems"
66 OFONO_API_NETREG = 0x2,
70 static DBusConnection *connection;
72 static GHashTable *modem_hash;
77 struct connman_device *device;
81 connman_bool_t powered;
82 connman_bool_t online;
85 connman_bool_t set_powered;
86 connman_bool_t set_online;
88 /* SimManager Interface */
92 DBusPendingCall *call_set_property;
93 DBusPendingCall *call_get_properties;
96 typedef void (*set_property_cb)(struct modem_data *data,
97 connman_bool_t success);
98 typedef void (*get_properties_cb)(struct modem_data *data,
99 DBusMessageIter *dict);
101 struct property_info {
102 struct modem_data *modem;
104 const char *interface;
105 const char *property;
106 set_property_cb set_property_cb;
107 get_properties_cb get_properties_cb;
110 static void set_property_reply(DBusPendingCall *call, void *user_data)
112 struct property_info *info = user_data;
115 connman_bool_t success = TRUE;
117 DBG("%s path %s %s.%s", info->modem->path,
118 info->path, info->interface, info->property);
120 info->modem->call_set_property = NULL;
122 dbus_error_init(&error);
124 reply = dbus_pending_call_steal_reply(call);
126 if (dbus_set_error_from_message(&error, reply)) {
127 connman_error("Failed to change property: %s %s.%s: %s %s",
128 info->path, info->interface, info->property,
129 error.name, error.message);
130 dbus_error_free(&error);
134 if (info->set_property_cb != NULL)
135 (*info->set_property_cb)(info->modem, success);
137 dbus_message_unref(reply);
139 dbus_pending_call_unref(call);
142 static int set_property(struct modem_data *modem,
143 const char *path, const char *interface,
144 const char *property, int type, void *value,
145 set_property_cb notify)
147 DBusMessage *message;
148 DBusMessageIter iter;
149 struct property_info *info;
151 DBG("%s path %s %s.%s", modem->path, path, interface, property);
153 if (modem->call_set_property != NULL) {
154 connman_error("Pending SetProperty");
158 message = dbus_message_new_method_call(OFONO_SERVICE, path,
159 interface, SET_PROPERTY);
163 dbus_message_iter_init_append(message, &iter);
164 connman_dbus_property_append_basic(&iter, property, type, value);
166 if (dbus_connection_send_with_reply(connection, message,
167 &modem->call_set_property, TIMEOUT) == FALSE) {
168 connman_error("Failed to change property: %s %s.%s",
169 path, interface, property);
170 dbus_message_unref(message);
174 if (modem->call_set_property == NULL) {
175 connman_error("D-Bus connection not available");
176 dbus_message_unref(message);
180 info = g_try_new0(struct property_info, 1);
182 dbus_message_unref(message);
188 info->interface = interface;
189 info->property = property;
190 info->set_property_cb = notify;
192 dbus_pending_call_set_notify(modem->call_set_property,
193 set_property_reply, info, g_free);
195 dbus_message_unref(message);
200 static void get_properties_reply(DBusPendingCall *call, void *user_data)
202 struct property_info *info = user_data;
203 DBusMessageIter array, dict;
207 DBG("%s path %s %s", info->modem->path, info->path, info->interface);
209 info->modem->call_get_properties = NULL;
211 dbus_error_init(&error);
213 reply = dbus_pending_call_steal_reply(call);
215 if (dbus_set_error_from_message(&error, reply)) {
216 connman_error("Failed to get properties: %s %s: %s %s",
217 info->path, info->interface,
218 error.name, error.message);
219 dbus_error_free(&error);
224 if (dbus_message_iter_init(reply, &array) == FALSE)
227 if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_ARRAY)
230 dbus_message_iter_recurse(&array, &dict);
232 if (info->get_properties_cb != NULL)
233 (*info->get_properties_cb)(info->modem, &dict);
237 dbus_message_unref(reply);
239 dbus_pending_call_unref(call);
242 static int get_properties(const char *path, const char *interface,
243 get_properties_cb notify,
244 struct modem_data *modem)
246 DBusMessage *message;
247 struct property_info *info;
249 DBG("%s path %s %s", modem->path, path, interface);
251 if (modem->call_get_properties != NULL) {
252 connman_error("Pending GetProperties");
256 message = dbus_message_new_method_call(OFONO_SERVICE, path,
257 interface, GET_PROPERTIES);
261 if (dbus_connection_send_with_reply(connection, message,
262 &modem->call_get_properties, TIMEOUT) == FALSE) {
263 connman_error("Failed to call %s.GetProperties()", interface);
264 dbus_message_unref(message);
268 if (modem->call_get_properties == NULL) {
269 connman_error("D-Bus connection not available");
270 dbus_message_unref(message);
274 info = g_try_new0(struct property_info, 1);
276 dbus_message_unref(message);
282 info->interface = interface;
283 info->get_properties_cb = notify;
285 dbus_pending_call_set_notify(modem->call_get_properties,
286 get_properties_reply, info, g_free);
288 dbus_message_unref(message);
293 static void modem_set_online_reply(struct modem_data *modem,
294 connman_bool_t success)
296 DBG("%s", modem->path);
298 if (success == TRUE) {
300 * Don't handle do anything on success here. oFono will send
301 * the change via PropertyChanged singal.
306 modem->set_online = FALSE;
309 static int modem_set_online(struct modem_data *modem)
311 DBG("%s", modem->path);
313 modem->set_online = TRUE;
315 return set_property(modem, modem->path,
316 OFONO_MODEM_INTERFACE,
317 "Online", DBUS_TYPE_BOOLEAN,
319 modem_set_online_reply);
322 static int modem_set_powered(struct modem_data *modem)
324 DBG("%s", modem->path);
326 modem->set_powered = TRUE;
328 return set_property(modem, modem->path,
329 OFONO_MODEM_INTERFACE,
330 "Powered", DBUS_TYPE_BOOLEAN,
335 static connman_bool_t has_interface(uint8_t interfaces,
338 if ((interfaces & api) == api)
344 static uint8_t extract_interfaces(DBusMessageIter *array)
346 DBusMessageIter entry;
347 uint8_t interfaces = 0;
349 dbus_message_iter_recurse(array, &entry);
351 while (dbus_message_iter_get_arg_type(&entry) == DBUS_TYPE_STRING) {
354 dbus_message_iter_get_basic(&entry, &name);
356 if (g_str_equal(name, OFONO_SIM_INTERFACE) == TRUE)
357 interfaces |= OFONO_API_SIM;
358 else if (g_str_equal(name, OFONO_NETREG_INTERFACE) == TRUE)
359 interfaces |= OFONO_API_NETREG;
360 else if (g_str_equal(name, OFONO_CM_INTERFACE) == TRUE)
361 interfaces |= OFONO_API_CM;
363 dbus_message_iter_next(&entry);
369 static connman_bool_t ready_to_create_device(struct modem_data *modem)
372 * There are three different modem types which behave slightly
374 * - GSM modems will expose the SIM interface then the
376 * - DUN modems will expose first a unique serial number (BDADDR)
377 * and then the CM interface.
378 * - CDMA modems will expose CM first and sometime later
379 * a unique serial number.
381 * This functions tests if we have the necessary information gathered
382 * before we are able to create a device.
385 if (modem->device != NULL)
388 if (modem->imsi != NULL || modem->serial != NULL)
394 static void create_device(struct modem_data *modem)
396 struct connman_device *device;
397 char *uninitialized_var(ident);
399 DBG("%s", modem->path);
401 if (modem->imsi != NULL)
403 else if (modem->serial != NULL)
404 ident = modem->serial;
406 if (connman_dbus_validate_ident(ident) == FALSE)
407 ident = connman_dbus_encode_string(ident);
409 ident = g_strdup(ident);
411 device = connman_device_create(ident, CONNMAN_DEVICE_TYPE_CELLULAR);
415 DBG("device %p", device);
417 connman_device_set_ident(device, ident);
419 connman_device_set_string(device, "Path", modem->path);
421 connman_device_set_data(device, modem);
423 if (connman_device_register(device) < 0) {
424 connman_error("Failed to register cellular device");
425 connman_device_unref(device);
429 modem->device = device;
435 static void destroy_device(struct modem_data *modem)
437 DBG("%s", modem->path);
439 connman_device_set_powered(modem->device, FALSE);
441 connman_device_unregister(modem->device);
442 connman_device_unref(modem->device);
444 modem->device = NULL;
447 static gboolean context_changed(DBusConnection *connection,
448 DBusMessage *message,
454 static gboolean cm_context_added(DBusConnection *connection,
455 DBusMessage *message,
461 static gboolean cm_context_removed(DBusConnection *connection,
462 DBusMessage *message,
468 static gboolean netreg_changed(DBusConnection *connection, DBusMessage *message,
474 static gboolean cm_changed(DBusConnection *connection, DBusMessage *message,
480 static void update_sim_imsi(struct modem_data *modem,
483 DBG("%s imsi %s", modem->path, imsi);
485 if (g_strcmp0(modem->imsi, imsi) == 0)
489 modem->imsi = g_strdup(imsi);
492 static gboolean sim_changed(DBusConnection *connection, DBusMessage *message,
495 const char *path = dbus_message_get_path(message);
496 struct modem_data *modem;
497 DBusMessageIter iter, value;
500 modem = g_hash_table_lookup(modem_hash, path);
504 if (dbus_message_iter_init(message, &iter) == FALSE)
507 dbus_message_iter_get_basic(&iter, &key);
509 dbus_message_iter_next(&iter);
510 dbus_message_iter_recurse(&iter, &value);
512 if (g_str_equal(key, "SubscriberIdentity") == TRUE) {
515 dbus_message_iter_get_basic(&value, &imsi);
517 update_sim_imsi(modem, imsi);
519 if (modem->online == FALSE) {
520 modem_set_online(modem);
521 } else if (has_interface(modem->interfaces,
522 OFONO_API_CM) == TRUE) {
523 if (ready_to_create_device(modem) == TRUE)
524 create_device(modem);
531 static void sim_properties_reply(struct modem_data *modem,
532 DBusMessageIter *dict)
534 DBG("%s", modem->path);
536 while (dbus_message_iter_get_arg_type(dict) == DBUS_TYPE_DICT_ENTRY) {
537 DBusMessageIter entry, value;
540 dbus_message_iter_recurse(dict, &entry);
541 dbus_message_iter_get_basic(&entry, &key);
543 dbus_message_iter_next(&entry);
544 dbus_message_iter_recurse(&entry, &value);
546 if (g_str_equal(key, "SubscriberIdentity") == TRUE) {
549 dbus_message_iter_get_basic(&value, &imsi);
551 update_sim_imsi(modem, imsi);
553 if (modem->online == FALSE) {
554 modem_set_online(modem);
558 if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) {
559 if (ready_to_create_device(modem) == TRUE)
560 create_device(modem);
565 dbus_message_iter_next(dict);
569 static int sim_get_properties(struct modem_data *modem)
571 return get_properties(modem->path, OFONO_SIM_INTERFACE,
572 sim_properties_reply, modem);
575 static gboolean modem_changed(DBusConnection *connection, DBusMessage *message,
578 const char *path = dbus_message_get_path(message);
579 struct modem_data *modem;
580 DBusMessageIter iter, value;
583 modem = g_hash_table_lookup(modem_hash, path);
587 if (dbus_message_iter_init(message, &iter) == FALSE)
590 dbus_message_iter_get_basic(&iter, &key);
592 dbus_message_iter_next(&iter);
593 dbus_message_iter_recurse(&iter, &value);
595 if (g_str_equal(key, "Powered") == TRUE) {
596 dbus_message_iter_get_basic(&value, &modem->powered);
598 DBG("%s Powered %d", modem->path, modem->powered);
600 if (modem->powered == FALSE)
601 modem_set_powered(modem);
602 } else if (g_str_equal(key, "Online") == TRUE) {
603 dbus_message_iter_get_basic(&value, &modem->online);
605 DBG("%s Online %d", modem->path, modem->online);
606 } else if (g_str_equal(key, "Interfaces") == TRUE) {
607 modem->interfaces = extract_interfaces(&value);
609 DBG("%s Interfaces 0x%02x", modem->path,
612 if (has_interface(modem->interfaces, OFONO_API_SIM) == TRUE) {
613 if (modem->imsi == NULL &&
614 modem->set_powered == FALSE) {
616 * Only use do GetProperties() when
617 * device has not been powered up.
619 sim_get_properties(modem);
624 if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) {
625 if (ready_to_create_device(modem) == TRUE)
626 create_device(modem);
628 if (modem->device != NULL)
629 destroy_device(modem);
631 } else if (g_str_equal(key, "Serial") == TRUE) {
634 dbus_message_iter_get_basic(&value, &serial);
636 g_free(modem->serial);
637 modem->serial = g_strdup(serial);
639 DBG("%s Serial %s", modem->path, modem->serial);
641 if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) {
642 if (ready_to_create_device(modem) == TRUE)
643 create_device(modem);
650 static void add_modem(const char *path, DBusMessageIter *prop)
652 struct modem_data *modem;
656 modem = g_hash_table_lookup(modem_hash, path);
659 * When oFono powers up we ask for the modems and oFono is
660 * reporting with modem_added signal the modems. Only
666 modem = g_try_new0(struct modem_data, 1);
670 modem->path = g_strdup(path);
672 g_hash_table_insert(modem_hash, g_strdup(path), modem);
674 while (dbus_message_iter_get_arg_type(prop) == DBUS_TYPE_DICT_ENTRY) {
675 DBusMessageIter entry, value;
678 dbus_message_iter_recurse(prop, &entry);
679 dbus_message_iter_get_basic(&entry, &key);
681 dbus_message_iter_next(&entry);
682 dbus_message_iter_recurse(&entry, &value);
684 if (g_str_equal(key, "Powered") == TRUE) {
685 dbus_message_iter_get_basic(&value, &modem->powered);
687 DBG("%s Powered %d", modem->path, modem->powered);
688 } else if (g_str_equal(key, "Online") == TRUE) {
689 dbus_message_iter_get_basic(&value, &modem->online);
691 DBG("%s Online %d", modem->path, modem->online);
692 } else if (g_str_equal(key, "Interfaces") == TRUE) {
693 modem->interfaces = extract_interfaces(&value);
695 DBG("%s Interfaces 0x%02x", modem->path,
697 } else if (g_str_equal(key, "Serial") == TRUE) {
700 dbus_message_iter_get_basic(&value, &serial);
701 modem->serial = g_strdup(serial);
703 DBG("%s Serial %s", modem->path, modem->serial);
706 dbus_message_iter_next(prop);
709 if (modem->powered == FALSE) {
710 modem_set_powered(modem);
711 } else if (has_interface(modem->interfaces, OFONO_API_SIM) == TRUE) {
712 sim_get_properties(modem);
713 } else if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) {
714 if (ready_to_create_device(modem) == TRUE)
715 create_device(modem);
719 static void remove_modem(gpointer data)
721 struct modem_data *modem = data;
723 DBG("%s", modem->path);
725 if (modem->call_set_property != NULL)
726 dbus_pending_call_cancel(modem->call_set_property);
728 if (modem->call_get_properties != NULL)
729 dbus_pending_call_cancel(modem->call_get_properties);
731 if (modem->device != NULL)
732 destroy_device(modem);
734 g_free(modem->serial);
741 static gboolean modem_added(DBusConnection *connection,
742 DBusMessage *message, void *user_data)
744 DBusMessageIter iter, properties;
749 if (dbus_message_iter_init(message, &iter) == FALSE)
752 dbus_message_iter_get_basic(&iter, &path);
754 dbus_message_iter_next(&iter);
755 dbus_message_iter_recurse(&iter, &properties);
757 add_modem(path, &properties);
762 static gboolean modem_removed(DBusConnection *connection,
763 DBusMessage *message, void *user_data)
765 DBusMessageIter iter;
770 if (dbus_message_iter_init(message, &iter) == FALSE)
773 dbus_message_iter_get_basic(&iter, &path);
775 g_hash_table_remove(modem_hash, path);
780 static void manager_get_modems_reply(DBusPendingCall *call, void *user_data)
784 DBusMessageIter array, dict;
788 reply = dbus_pending_call_steal_reply(call);
790 dbus_error_init(&error);
792 if (dbus_set_error_from_message(&error, reply) == TRUE) {
793 connman_error("%s", error.message);
794 dbus_error_free(&error);
798 if (dbus_message_iter_init(reply, &array) == FALSE)
801 dbus_message_iter_recurse(&array, &dict);
803 while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_STRUCT) {
804 DBusMessageIter value, properties;
807 dbus_message_iter_recurse(&dict, &value);
808 dbus_message_iter_get_basic(&value, &path);
810 dbus_message_iter_next(&value);
811 dbus_message_iter_recurse(&value, &properties);
813 add_modem(path, &properties);
815 dbus_message_iter_next(&dict);
819 dbus_message_unref(reply);
821 dbus_pending_call_unref(call);
824 static int manager_get_modems(void)
826 DBusMessage *message;
827 DBusPendingCall *call;
831 message = dbus_message_new_method_call(OFONO_SERVICE, "/",
832 OFONO_MANAGER_INTERFACE, GET_MODEMS);
836 if (dbus_connection_send_with_reply(connection, message,
837 &call, TIMEOUT) == FALSE) {
838 connman_error("Failed to call GetModems()");
839 dbus_message_unref(message);
844 connman_error("D-Bus connection not available");
845 dbus_message_unref(message);
849 dbus_pending_call_set_notify(call, manager_get_modems_reply,
852 dbus_message_unref(message);
857 static void ofono_connect(DBusConnection *conn, void *user_data)
861 modem_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
862 g_free, remove_modem);
863 if (modem_hash == NULL)
866 manager_get_modems();
869 static void ofono_disconnect(DBusConnection *conn, void *user_data)
873 if (modem_hash == NULL)
876 g_hash_table_destroy(modem_hash);
880 static int network_probe(struct connman_network *network)
882 DBG("network %p", network);
887 static void network_remove(struct connman_network *network)
889 DBG("network %p", network);
892 static int network_connect(struct connman_network *network)
894 DBG("network %p", network);
899 static int network_disconnect(struct connman_network *network)
901 DBG("network %p", network);
906 static struct connman_network_driver network_driver = {
908 .type = CONNMAN_NETWORK_TYPE_CELLULAR,
909 .probe = network_probe,
910 .remove = network_remove,
911 .connect = network_connect,
912 .disconnect = network_disconnect,
915 static int modem_probe(struct connman_device *device)
917 struct modem_data *modem = connman_device_get_data(device);
919 DBG("%s device %p", modem->path, device);
924 static void modem_remove(struct connman_device *device)
926 struct modem_data *modem = connman_device_get_data(device);
928 DBG("%s device %p", modem->path, device);
931 static int modem_enable(struct connman_device *device)
933 struct modem_data *modem = connman_device_get_data(device);
935 DBG("%s device %p", modem->path, device);
940 static int modem_disable(struct connman_device *device)
942 struct modem_data *modem = connman_device_get_data(device);
944 DBG("%s device %p", modem->path, device);
949 static struct connman_device_driver modem_driver = {
951 .type = CONNMAN_DEVICE_TYPE_CELLULAR,
952 .probe = modem_probe,
953 .remove = modem_remove,
954 .enable = modem_enable,
955 .disable = modem_disable,
959 static guint modem_added_watch;
960 static guint modem_removed_watch;
961 static guint modem_watch;
962 static guint cm_watch;
963 static guint sim_watch;
964 static guint context_added_watch;
965 static guint context_removed_watch;
966 static guint netreg_watch;
967 static guint context_watch;
969 static int ofono_init(void)
975 connection = connman_dbus_get_connection();
976 if (connection == NULL)
979 watch = g_dbus_add_service_watch(connection,
980 OFONO_SERVICE, ofono_connect,
981 ofono_disconnect, NULL, NULL);
983 modem_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
984 OFONO_MANAGER_INTERFACE,
989 modem_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
990 OFONO_MANAGER_INTERFACE,
995 modem_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
996 OFONO_MODEM_INTERFACE,
1001 cm_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
1007 sim_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
1008 OFONO_SIM_INTERFACE,
1013 context_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
1019 context_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
1025 context_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
1026 OFONO_CONTEXT_INTERFACE,
1031 netreg_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
1032 OFONO_NETREG_INTERFACE,
1038 if (watch == 0 || modem_added_watch == 0 || modem_removed_watch == 0 ||
1039 modem_watch == 0 || cm_watch == 0 || sim_watch == 0 ||
1040 context_added_watch == 0 ||
1041 context_removed_watch == 0 ||
1042 context_watch == 0 || netreg_watch == 0) {
1047 err = connman_network_driver_register(&network_driver);
1051 err = connman_device_driver_register(&modem_driver);
1053 connman_network_driver_unregister(&network_driver);
1060 g_dbus_remove_watch(connection, netreg_watch);
1061 g_dbus_remove_watch(connection, context_watch);
1062 g_dbus_remove_watch(connection, context_removed_watch);
1063 g_dbus_remove_watch(connection, context_added_watch);
1064 g_dbus_remove_watch(connection, sim_watch);
1065 g_dbus_remove_watch(connection, cm_watch);
1066 g_dbus_remove_watch(connection, modem_watch);
1067 g_dbus_remove_watch(connection, modem_removed_watch);
1068 g_dbus_remove_watch(connection, modem_added_watch);
1069 g_dbus_remove_watch(connection, watch);
1070 dbus_connection_unref(connection);
1075 static void ofono_exit(void)
1079 if (modem_hash != NULL) {
1080 g_hash_table_destroy(modem_hash);
1084 connman_device_driver_unregister(&modem_driver);
1085 connman_network_driver_unregister(&network_driver);
1087 g_dbus_remove_watch(connection, netreg_watch);
1088 g_dbus_remove_watch(connection, context_watch);
1089 g_dbus_remove_watch(connection, context_removed_watch);
1090 g_dbus_remove_watch(connection, context_added_watch);
1091 g_dbus_remove_watch(connection, sim_watch);
1092 g_dbus_remove_watch(connection, cm_watch);
1093 g_dbus_remove_watch(connection, modem_watch);
1094 g_dbus_remove_watch(connection, modem_added_watch);
1095 g_dbus_remove_watch(connection, modem_removed_watch);
1096 g_dbus_remove_watch(connection, watch);
1098 dbus_connection_unref(connection);
1101 CONNMAN_PLUGIN_DEFINE(ofono, "oFono telephony plugin", VERSION,
1102 CONNMAN_PLUGIN_PRIORITY_DEFAULT, ofono_init, ofono_exit)