technology: Refactor enable/disable APIs
[platform/upstream/connman.git] / src / manager.c
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <errno.h>
27
28 #include <gdbus.h>
29
30 #include "connman.h"
31
32 connman_bool_t connman_state_idle;
33 DBusMessage *session_mode_pending = NULL;
34
35 static DBusMessage *get_properties(DBusConnection *conn,
36                                         DBusMessage *msg, void *data)
37 {
38         DBusMessage *reply;
39         DBusMessageIter array, dict;
40         connman_bool_t offlinemode, sessionmode;
41         const char *str;
42
43         DBG("conn %p", conn);
44
45         reply = dbus_message_new_method_return(msg);
46         if (reply == NULL)
47                 return NULL;
48
49         dbus_message_iter_init_append(reply, &array);
50
51         connman_dbus_dict_open(&array, &dict);
52
53         str = __connman_profile_active_path();
54         if (str != NULL)
55                 connman_dbus_dict_append_basic(&dict, "ActiveProfile",
56                                                 DBUS_TYPE_OBJECT_PATH, &str);
57
58         connman_dbus_dict_append_array(&dict, "Services",
59                         DBUS_TYPE_OBJECT_PATH, __connman_service_list, NULL);
60         connman_dbus_dict_append_array(&dict, "Technologies",
61                         DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL);
62
63         str = __connman_notifier_get_state();
64         connman_dbus_dict_append_basic(&dict, "State",
65                                                 DBUS_TYPE_STRING, &str);
66
67         offlinemode = __connman_profile_get_offlinemode();
68         connman_dbus_dict_append_basic(&dict, "OfflineMode",
69                                         DBUS_TYPE_BOOLEAN, &offlinemode);
70
71         connman_dbus_dict_append_array(&dict, "AvailableTechnologies",
72                 DBUS_TYPE_STRING, __connman_notifier_list_registered, NULL);
73         connman_dbus_dict_append_array(&dict, "EnabledTechnologies",
74                 DBUS_TYPE_STRING, __connman_notifier_list_enabled, NULL);
75         connman_dbus_dict_append_array(&dict, "ConnectedTechnologies",
76                 DBUS_TYPE_STRING, __connman_notifier_list_connected, NULL);
77
78         str = __connman_service_default();
79         if (str != NULL)
80                 connman_dbus_dict_append_basic(&dict, "DefaultTechnology",
81                                                 DBUS_TYPE_STRING, &str);
82
83         connman_dbus_dict_append_array(&dict, "AvailableDebugs",
84                         DBUS_TYPE_STRING, __connman_debug_list_available, NULL);
85         connman_dbus_dict_append_array(&dict, "EnabledDebugs",
86                         DBUS_TYPE_STRING, __connman_debug_list_enabled, NULL);
87
88         sessionmode = __connman_session_mode();
89         connman_dbus_dict_append_basic(&dict, "SessionMode",
90                                         DBUS_TYPE_BOOLEAN,
91                                         &sessionmode);
92
93         connman_dbus_dict_close(&array, &dict);
94
95         return reply;
96 }
97
98 static DBusMessage *set_property(DBusConnection *conn,
99                                         DBusMessage *msg, void *data)
100 {
101         DBusMessageIter iter, value;
102         const char *name;
103         int type;
104
105         DBG("conn %p", conn);
106
107         if (dbus_message_iter_init(msg, &iter) == FALSE)
108                 return __connman_error_invalid_arguments(msg);
109
110         dbus_message_iter_get_basic(&iter, &name);
111         dbus_message_iter_next(&iter);
112         dbus_message_iter_recurse(&iter, &value);
113
114         type = dbus_message_iter_get_arg_type(&value);
115
116         if (g_str_equal(name, "OfflineMode") == TRUE) {
117                 connman_bool_t offlinemode;
118
119                 if (type != DBUS_TYPE_BOOLEAN)
120                         return __connman_error_invalid_arguments(msg);
121
122                 dbus_message_iter_get_basic(&value, &offlinemode);
123
124                 __connman_profile_set_offlinemode(offlinemode, TRUE);
125
126                 __connman_profile_save_default();
127         } else if (g_str_equal(name, "ActiveProfile") == TRUE) {
128                 const char *str;
129
130                 dbus_message_iter_get_basic(&value, &str);
131
132                 return __connman_error_not_supported(msg);
133         } else if (g_str_equal(name, "SessionMode") == TRUE) {
134                 connman_bool_t sessionmode;
135
136                 if (type != DBUS_TYPE_BOOLEAN)
137                         return __connman_error_invalid_arguments(msg);
138
139                 dbus_message_iter_get_basic(&value, &sessionmode);
140
141                 if (session_mode_pending != NULL)
142                         return __connman_error_in_progress(msg);
143
144                 __connman_session_set_mode(sessionmode);
145
146                 if (connman_state_idle == FALSE) {
147                         session_mode_pending = msg;
148                         return NULL;
149                 }
150
151         } else
152                 return __connman_error_invalid_property(msg);
153
154         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
155 }
156
157 static DBusMessage *get_state(DBusConnection *conn,
158                                         DBusMessage *msg, void *data)
159 {
160         const char *str;
161
162         DBG("conn %p", conn);
163
164         str = __connman_notifier_get_state();
165
166         return g_dbus_create_reply(msg, DBUS_TYPE_STRING, &str,
167                                                 DBUS_TYPE_INVALID);
168 }
169
170 static DBusMessage *remove_provider(DBusConnection *conn,
171                                     DBusMessage *msg, void *data)
172 {
173         const char *path;
174         int err;
175
176         DBG("conn %p", conn);
177
178         dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
179                                                         DBUS_TYPE_INVALID);
180
181         err = __connman_provider_remove(path);
182         if (err < 0)
183                 return __connman_error_failed(msg, -err);
184
185         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
186 }
187
188 static DBusMessage *request_scan(DBusConnection *conn,
189                                         DBusMessage *msg, void *data)
190 {
191         enum connman_service_type type;
192         const char *str;
193         int err;
194
195         DBG("conn %p", conn);
196
197         dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str,
198                                                         DBUS_TYPE_INVALID);
199
200         if (g_strcmp0(str, "") == 0)
201                 type = CONNMAN_SERVICE_TYPE_UNKNOWN;
202         else if (g_strcmp0(str, "wifi") == 0)
203                 type = CONNMAN_SERVICE_TYPE_WIFI;
204         else if (g_strcmp0(str, "wimax") == 0)
205                 type = CONNMAN_SERVICE_TYPE_WIMAX;
206         else
207                 return __connman_error_invalid_arguments(msg);
208
209         err = __connman_device_request_scan(type);
210         if (err < 0) {
211                 if (err == -EINPROGRESS) {
212                         connman_error("Invalid return code from scan");
213                         err = -EINVAL;
214                 }
215
216                 return __connman_error_failed(msg, -err);
217         }
218
219         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
220 }
221
222 static DBusConnection *connection = NULL;
223
224 static enum connman_service_type technology_type;
225 static connman_bool_t technology_enabled;
226 static DBusMessage *technology_pending = NULL;
227 static guint technology_timeout = 0;
228
229 static void technology_reply(int error)
230 {
231         DBG("");
232
233         if (technology_timeout > 0) {
234                 g_source_remove(technology_timeout);
235                 technology_timeout = 0;
236         }
237
238         if (technology_pending != NULL) {
239                 if (error > 0) {
240                         DBusMessage *reply;
241
242                         reply = __connman_error_failed(technology_pending,
243                                                                 error);
244                         if (reply != NULL)
245                                 g_dbus_send_message(connection, reply);
246                 } else
247                         g_dbus_send_reply(connection, technology_pending,
248                                                         DBUS_TYPE_INVALID);
249
250                 dbus_message_unref(technology_pending);
251                 technology_pending = NULL;
252         }
253
254         technology_type = CONNMAN_SERVICE_TYPE_UNKNOWN;
255 }
256
257 static gboolean technology_abort(gpointer user_data)
258 {
259         DBG("");
260
261         technology_timeout = 0;
262
263         technology_reply(ETIMEDOUT);
264
265         return FALSE;
266 }
267
268 static void technology_notify(enum connman_service_type type,
269                                                 connman_bool_t enabled)
270 {
271         DBG("type %d enabled %d", type, enabled);
272
273         if (type == technology_type && enabled == technology_enabled)
274                 technology_reply(0);
275 }
276
277 static void session_mode_notify(void)
278 {
279         DBusMessage *reply;
280
281         reply = g_dbus_create_reply(session_mode_pending, DBUS_TYPE_INVALID);
282         g_dbus_send_message(connection, reply);
283
284         dbus_message_unref(session_mode_pending);
285         session_mode_pending = NULL;
286 }
287
288 static void idle_state(connman_bool_t idle)
289 {
290
291         DBG("idle %d", idle);
292
293         connman_state_idle = idle;
294
295         if (connman_state_idle == FALSE || session_mode_pending == NULL)
296                 return;
297
298         session_mode_notify();
299 }
300
301 static struct connman_notifier technology_notifier = {
302         .name           = "manager",
303         .priority       = CONNMAN_NOTIFIER_PRIORITY_HIGH,
304         .service_enabled= technology_notify,
305         .idle_state     = idle_state,
306 };
307
308 static DBusMessage *enable_technology(DBusConnection *conn,
309                                         DBusMessage *msg, void *data)
310 {
311         enum connman_service_type type;
312         const char *str;
313         int err;
314
315         DBG("conn %p", conn);
316
317         if (technology_pending != NULL)
318                 return __connman_error_in_progress(msg);
319
320         dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str,
321                                                         DBUS_TYPE_INVALID);
322
323         if (g_strcmp0(str, "ethernet") == 0)
324                 type = CONNMAN_SERVICE_TYPE_ETHERNET;
325         else if (g_strcmp0(str, "wifi") == 0)
326                 type = CONNMAN_SERVICE_TYPE_WIFI;
327         else if (g_strcmp0(str, "wimax") == 0)
328                 type = CONNMAN_SERVICE_TYPE_WIMAX;
329         else if (g_strcmp0(str, "bluetooth") == 0)
330                 type = CONNMAN_SERVICE_TYPE_BLUETOOTH;
331         else if (g_strcmp0(str, "cellular") == 0)
332                 type = CONNMAN_SERVICE_TYPE_CELLULAR;
333         else
334                 return __connman_error_invalid_arguments(msg);
335
336         if (__connman_notifier_is_registered(type) == FALSE)
337                 return __connman_error_not_registered(msg);
338
339         if (__connman_notifier_is_enabled(type) == TRUE)
340                 return __connman_error_already_enabled(msg);
341
342         technology_type = type;
343         technology_enabled = TRUE;
344         technology_pending = dbus_message_ref(msg);
345
346         err = __connman_technology_enable(type);
347         if (err < 0)
348                 technology_reply(-err);
349         else
350                 technology_timeout = g_timeout_add_seconds(15,
351                                                 technology_abort, NULL);
352
353         return NULL;
354 }
355
356 static DBusMessage *disable_technology(DBusConnection *conn,
357                                         DBusMessage *msg, void *data)
358 {
359         enum connman_service_type type;
360         const char *str;
361         int err;
362
363         DBG("conn %p", conn);
364
365         if (technology_pending != NULL)
366                 return __connman_error_in_progress(msg);
367
368         dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str,
369                                                         DBUS_TYPE_INVALID);
370
371         if (g_strcmp0(str, "ethernet") == 0)
372                 type = CONNMAN_SERVICE_TYPE_ETHERNET;
373         else if (g_strcmp0(str, "wifi") == 0)
374                 type = CONNMAN_SERVICE_TYPE_WIFI;
375         else if (g_strcmp0(str, "wimax") == 0)
376                 type = CONNMAN_SERVICE_TYPE_WIMAX;
377         else if (g_strcmp0(str, "bluetooth") == 0)
378                 type = CONNMAN_SERVICE_TYPE_BLUETOOTH;
379         else if (g_strcmp0(str, "cellular") == 0)
380                 type = CONNMAN_SERVICE_TYPE_CELLULAR;
381         else
382                 return __connman_error_invalid_arguments(msg);
383
384         if (__connman_notifier_is_registered(type) == FALSE)
385                 return __connman_error_not_registered(msg);
386
387         if (__connman_notifier_is_enabled(type) == FALSE)
388                 return __connman_error_already_disabled(msg);
389
390         technology_type = type;
391         technology_enabled = FALSE;
392         technology_pending = dbus_message_ref(msg);
393
394         err = __connman_technology_disable(type);
395         if (err < 0)
396                 technology_reply(-err);
397         else
398                 technology_timeout = g_timeout_add_seconds(10,
399                                                 technology_abort, NULL);
400
401         return NULL;
402 }
403
404 static DBusMessage *get_services(DBusConnection *conn,
405                                         DBusMessage *msg, void *data)
406 {
407         DBusMessage *reply;
408         DBusMessageIter iter, array;
409
410         reply = dbus_message_new_method_return(msg);
411         if (reply == NULL)
412                 return NULL;
413
414         dbus_message_iter_init_append(reply, &iter);
415
416         dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
417                         DBUS_STRUCT_BEGIN_CHAR_AS_STRING
418                         DBUS_TYPE_OBJECT_PATH_AS_STRING
419                         DBUS_TYPE_ARRAY_AS_STRING
420                                 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
421                                         DBUS_TYPE_STRING_AS_STRING
422                                         DBUS_TYPE_VARIANT_AS_STRING
423                                 DBUS_DICT_ENTRY_END_CHAR_AS_STRING
424                         DBUS_STRUCT_END_CHAR_AS_STRING, &array);
425
426         __connman_service_list_struct(&array);
427
428         dbus_message_iter_close_container(&iter, &array);
429
430         return reply;
431 }
432
433 static DBusMessage *lookup_service(DBusConnection *conn,
434                                         DBusMessage *msg, void *data)
435 {
436         const char *pattern, *path;
437         int err;
438
439         DBG("conn %p", conn);
440
441         dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &pattern,
442                                                         DBUS_TYPE_INVALID);
443
444         err = __connman_service_lookup(pattern, &path);
445         if (err < 0)
446                 return __connman_error_failed(msg, -err);
447
448         return g_dbus_create_reply(msg, DBUS_TYPE_OBJECT_PATH, &path,
449                                                         DBUS_TYPE_INVALID);
450 }
451
452 static DBusMessage *connect_service(DBusConnection *conn,
453                                         DBusMessage *msg, void *data)
454 {
455         int err;
456
457         DBG("conn %p", conn);
458
459         if (__connman_session_mode() == TRUE) {
460                 connman_info("Session mode enabled: "
461                                 "direct service connect disabled");
462
463                 return __connman_error_failed(msg, -EINVAL);
464         }
465
466         err = __connman_service_create_and_connect(msg);
467         if (err < 0) {
468                 if (err == -EINPROGRESS) {
469                         connman_error("Invalid return code from connect");
470                         err = -EINVAL;
471                 }
472
473                 return __connman_error_failed(msg, -err);
474         }
475
476         return NULL;
477 }
478
479 static DBusMessage *provision_service(DBusConnection *conn, DBusMessage *msg,
480                                         void *data)
481 {
482         int err;
483
484         DBG("conn %p", conn);
485
486         err = __connman_service_provision(msg);
487         if (err < 0)
488                 return __connman_error_failed(msg, -err);
489
490         return NULL;
491 }
492
493 static DBusMessage *connect_provider(DBusConnection *conn,
494                                         DBusMessage *msg, void *data)
495 {
496         int err;
497
498         DBG("conn %p", conn);
499
500         if (__connman_session_mode() == TRUE) {
501                 connman_info("Session mode enabled: "
502                                 "direct provider connect disabled");
503
504                 return __connman_error_failed(msg, -EINVAL);
505         }
506
507         err = __connman_provider_create_and_connect(msg);
508         if (err < 0) {
509                 if (err == -EINPROGRESS) {
510                         connman_error("Invalid return code from connect");
511                         err = -EINVAL;
512                 }
513
514                 return __connman_error_failed(msg, -err);
515         }
516
517         return NULL;
518 }
519
520 static DBusMessage *register_agent(DBusConnection *conn,
521                                         DBusMessage *msg, void *data)
522 {
523         const char *sender, *path;
524         int err;
525
526         DBG("conn %p", conn);
527
528         sender = dbus_message_get_sender(msg);
529
530         dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
531                                                         DBUS_TYPE_INVALID);
532
533         err = __connman_agent_register(sender, path);
534         if (err < 0)
535                 return __connman_error_failed(msg, -err);
536
537         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
538 }
539
540 static DBusMessage *unregister_agent(DBusConnection *conn,
541                                         DBusMessage *msg, void *data)
542 {
543         const char *sender, *path;
544         int err;
545
546         DBG("conn %p", conn);
547
548         sender = dbus_message_get_sender(msg);
549
550         dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
551                                                         DBUS_TYPE_INVALID);
552
553         err = __connman_agent_unregister(sender, path);
554         if (err < 0)
555                 return __connman_error_failed(msg, -err);
556
557         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
558 }
559
560 static DBusMessage *register_counter(DBusConnection *conn,
561                                         DBusMessage *msg, void *data)
562 {
563         const char *sender, *path;
564         unsigned int accuracy, period;
565         int err;
566
567         DBG("conn %p", conn);
568
569         sender = dbus_message_get_sender(msg);
570
571         dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
572                                                 DBUS_TYPE_UINT32, &accuracy,
573                                                 DBUS_TYPE_UINT32, &period,
574                                                         DBUS_TYPE_INVALID);
575
576         /* FIXME: add handling of accuracy parameter */
577
578         err = __connman_counter_register(sender, path, period);
579         if (err < 0)
580                 return __connman_error_failed(msg, -err);
581
582         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
583 }
584
585 static DBusMessage *unregister_counter(DBusConnection *conn,
586                                         DBusMessage *msg, void *data)
587 {
588         const char *sender, *path;
589         int err;
590
591         DBG("conn %p", conn);
592
593         sender = dbus_message_get_sender(msg);
594
595         dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
596                                                         DBUS_TYPE_INVALID);
597
598         err = __connman_counter_unregister(sender, path);
599         if (err < 0)
600                 return __connman_error_failed(msg, -err);
601
602         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
603 }
604
605 static DBusMessage *create_session(DBusConnection *conn,
606                                         DBusMessage *msg, void *data)
607 {
608         int err;
609
610         DBG("conn %p", conn);
611
612         err = __connman_session_create(msg);
613         if (err < 0)
614                 return __connman_error_failed(msg, -err);
615
616         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
617 }
618
619 static DBusMessage *destroy_session(DBusConnection *conn,
620                                         DBusMessage *msg, void *data)
621 {
622         int err;
623
624         DBG("conn %p", conn);
625
626         err = __connman_session_destroy(msg);
627         if (err < 0)
628                 return __connman_error_failed(msg, -err);
629
630         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
631 }
632
633 static DBusMessage *request_private_network(DBusConnection *conn,
634                                         DBusMessage *msg, void *data)
635 {
636         const char *sender;
637         int  err;
638
639         DBG("conn %p", conn);
640
641         sender = dbus_message_get_sender(msg);
642
643         err = __connman_private_network_request(msg, sender);
644         if (err < 0)
645                 return __connman_error_failed(msg, -err);
646
647         return NULL;
648 }
649
650 static DBusMessage *release_private_network(DBusConnection *conn,
651                                         DBusMessage *msg, void *data)
652 {
653         const char *path;
654         int err;
655
656         DBG("conn %p", conn);
657
658         dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
659                                                         DBUS_TYPE_INVALID);
660
661         err = __connman_private_network_release(path);
662         if (err < 0)
663                 return __connman_error_failed(msg, -err);
664
665         return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
666 }
667
668 static GDBusMethodTable manager_methods[] = {
669         { "GetProperties",     "",      "a{sv}", get_properties     },
670         { "SetProperty",       "sv",    "",      set_property,
671                                                 G_DBUS_METHOD_FLAG_ASYNC },
672         { "GetState",          "",      "s",     get_state          },
673         { "RemoveProvider",    "o",     "",      remove_provider    },
674         { "RequestScan",       "s",     "",      request_scan       },
675         { "EnableTechnology",  "s",     "",      enable_technology,
676                                                 G_DBUS_METHOD_FLAG_ASYNC },
677         { "DisableTechnology", "s",     "",      disable_technology,
678                                                 G_DBUS_METHOD_FLAG_ASYNC },
679         { "GetServices",       "",      "a(oa{sv})", get_services   },
680         { "LookupService",     "s",     "o",     lookup_service,    },
681         { "ConnectService",    "a{sv}", "o",     connect_service,
682                                                 G_DBUS_METHOD_FLAG_ASYNC },
683         { "ProvisionService",  "s",     "",      provision_service,
684                                                 G_DBUS_METHOD_FLAG_ASYNC },
685         { "ConnectProvider",   "a{sv}", "o",     connect_provider,
686                                                 G_DBUS_METHOD_FLAG_ASYNC },
687         { "RegisterAgent",     "o",     "",      register_agent     },
688         { "UnregisterAgent",   "o",     "",      unregister_agent   },
689         { "RegisterCounter",   "ouu",   "",      register_counter   },
690         { "UnregisterCounter", "o",     "",      unregister_counter },
691         { "CreateSession",     "a{sv}o", "o",    create_session     },
692         { "DestroySession",    "o",     "",      destroy_session    },
693         { "RequestPrivateNetwork",    "",     "oa{sv}h",
694                                                 request_private_network,
695                                                 G_DBUS_METHOD_FLAG_ASYNC },
696         { "ReleasePrivateNetwork",    "o",    "",
697                                                 release_private_network },
698         { },
699 };
700
701 static GDBusSignalTable manager_signals[] = {
702         { "PropertyChanged", "sv" },
703         { "StateChanged",    "s"  },
704         { },
705 };
706
707 int __connman_manager_init(void)
708 {
709         DBG("");
710
711         connection = connman_dbus_get_connection();
712         if (connection == NULL)
713                 return -1;
714
715         if (connman_notifier_register(&technology_notifier) < 0)
716                 connman_error("Failed to register technology notifier");
717
718         g_dbus_register_interface(connection, CONNMAN_MANAGER_PATH,
719                                         CONNMAN_MANAGER_INTERFACE,
720                                         manager_methods,
721                                         manager_signals, NULL, NULL, NULL);
722
723         connman_state_idle = TRUE;
724
725         return 0;
726 }
727
728 void __connman_manager_cleanup(void)
729 {
730         DBG("");
731
732         connman_notifier_unregister(&technology_notifier);
733
734         if (connection == NULL)
735                 return;
736
737         g_dbus_unregister_interface(connection, CONNMAN_MANAGER_PATH,
738                                                 CONNMAN_MANAGER_INTERFACE);
739
740         dbus_connection_unref(connection);
741 }