5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
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.
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.
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
33 static DBusConnection *connection;
35 static GSList *technology_list = NULL;
37 struct connman_rfkill {
39 enum connman_service_type type;
40 connman_bool_t softblock;
41 connman_bool_t hardblock;
44 enum connman_technology_state {
45 CONNMAN_TECHNOLOGY_STATE_UNKNOWN = 0,
46 CONNMAN_TECHNOLOGY_STATE_OFFLINE = 1,
47 CONNMAN_TECHNOLOGY_STATE_ENABLED = 2,
48 CONNMAN_TECHNOLOGY_STATE_CONNECTED = 3,
51 struct connman_technology {
53 enum connman_service_type type;
54 enum connman_technology_state state;
56 GHashTable *rfkill_list;
62 connman_bool_t tethering;
63 char *tethering_ident;
64 char *tethering_passphrase;
66 connman_bool_t enable_persistent; /* Save the tech state */
68 struct connman_technology_driver *driver;
71 DBusMessage *pending_reply;
72 guint pending_timeout;
75 static GSList *driver_list = NULL;
77 static gint compare_priority(gconstpointer a, gconstpointer b)
79 const struct connman_technology_driver *driver1 = a;
80 const struct connman_technology_driver *driver2 = b;
82 return driver2->priority - driver1->priority;
86 * connman_technology_driver_register:
87 * @driver: Technology driver definition
89 * Register a new technology driver
91 * Returns: %0 on success
93 int connman_technology_driver_register(struct connman_technology_driver *driver)
96 struct connman_technology *technology;
98 DBG("driver %p name %s", driver, driver->name);
100 driver_list = g_slist_insert_sorted(driver_list, driver,
103 for (list = technology_list; list; list = list->next) {
104 technology = list->data;
106 if (technology->driver != NULL)
109 if (technology->type == driver->type)
110 technology->driver = driver;
117 * connman_technology_driver_unregister:
118 * @driver: Technology driver definition
120 * Remove a previously registered technology driver
122 void connman_technology_driver_unregister(struct connman_technology_driver *driver)
125 struct connman_technology *technology;
127 DBG("driver %p name %s", driver, driver->name);
129 for (list = technology_list; list; list = list->next) {
130 technology = list->data;
132 if (technology->driver == NULL)
135 if (technology->type == driver->type) {
136 technology->driver->remove(technology);
137 technology->driver = NULL;
141 driver_list = g_slist_remove(driver_list, driver);
144 static void tethering_changed(struct connman_technology *technology)
146 connman_bool_t tethering = technology->tethering;
148 connman_dbus_property_changed_basic(technology->path,
149 CONNMAN_TECHNOLOGY_INTERFACE, "Tethering",
150 DBUS_TYPE_BOOLEAN, &tethering);
153 void connman_technology_tethering_notify(struct connman_technology *technology,
154 connman_bool_t enabled)
156 DBG("technology %p enabled %u", technology, enabled);
158 if (technology->tethering == enabled)
161 technology->tethering = enabled;
163 tethering_changed(technology);
166 __connman_tethering_set_enabled();
168 __connman_tethering_set_disabled();
171 static int set_tethering(struct connman_technology *technology,
172 const char *bridge, connman_bool_t enabled)
174 const char *ident, *passphrase;
176 ident = technology->tethering_ident;
177 passphrase = technology->tethering_passphrase;
179 if (technology->driver == NULL ||
180 technology->driver->set_tethering == NULL)
183 if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
184 (ident == NULL || passphrase == NULL))
187 return technology->driver->set_tethering(technology, ident, passphrase,
191 void connman_technology_regdom_notify(struct connman_technology *technology,
197 connman_error("Failed to set regulatory domain");
199 DBG("Regulatory domain set to %s", alpha2);
201 g_free(technology->regdom);
202 technology->regdom = g_strdup(alpha2);
205 int connman_technology_set_regdom(const char *alpha2)
209 for (list = technology_list; list; list = list->next) {
210 struct connman_technology *technology = list->data;
212 if (technology->driver == NULL)
215 if (technology->driver->set_regdom)
216 technology->driver->set_regdom(technology, alpha2);
222 static void free_rfkill(gpointer data)
224 struct connman_rfkill *rfkill = data;
229 void __connman_technology_list(DBusMessageIter *iter, void *user_data)
233 for (list = technology_list; list; list = list->next) {
234 struct connman_technology *technology = list->data;
236 if (technology->path == NULL)
239 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
244 static void technologies_changed(void)
246 connman_dbus_property_changed_array(CONNMAN_MANAGER_PATH,
247 CONNMAN_MANAGER_INTERFACE, "Technologies",
248 DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL);
251 static const char *state2string(enum connman_technology_state state)
254 case CONNMAN_TECHNOLOGY_STATE_UNKNOWN:
256 case CONNMAN_TECHNOLOGY_STATE_OFFLINE:
258 case CONNMAN_TECHNOLOGY_STATE_ENABLED:
260 case CONNMAN_TECHNOLOGY_STATE_CONNECTED:
267 static void state_changed(struct connman_technology *technology)
271 str = state2string(technology->state);
275 connman_dbus_property_changed_basic(technology->path,
276 CONNMAN_TECHNOLOGY_INTERFACE, "State",
277 DBUS_TYPE_STRING, &str);
280 static const char *get_name(enum connman_service_type type)
283 case CONNMAN_SERVICE_TYPE_UNKNOWN:
284 case CONNMAN_SERVICE_TYPE_SYSTEM:
285 case CONNMAN_SERVICE_TYPE_GPS:
286 case CONNMAN_SERVICE_TYPE_VPN:
287 case CONNMAN_SERVICE_TYPE_GADGET:
289 case CONNMAN_SERVICE_TYPE_ETHERNET:
291 case CONNMAN_SERVICE_TYPE_WIFI:
293 case CONNMAN_SERVICE_TYPE_WIMAX:
295 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
297 case CONNMAN_SERVICE_TYPE_CELLULAR:
304 static DBusMessage *get_properties(DBusConnection *conn,
305 DBusMessage *message, void *user_data)
307 struct connman_technology *technology = user_data;
309 DBusMessageIter array, dict;
312 reply = dbus_message_new_method_return(message);
316 dbus_message_iter_init_append(reply, &array);
318 connman_dbus_dict_open(&array, &dict);
320 str = state2string(technology->state);
322 connman_dbus_dict_append_basic(&dict, "State",
323 DBUS_TYPE_STRING, &str);
325 str = get_name(technology->type);
327 connman_dbus_dict_append_basic(&dict, "Name",
328 DBUS_TYPE_STRING, &str);
330 str = __connman_service_type2string(technology->type);
332 connman_dbus_dict_append_basic(&dict, "Type",
333 DBUS_TYPE_STRING, &str);
335 connman_dbus_dict_append_basic(&dict, "Tethering",
337 &technology->tethering);
339 if (technology->tethering_ident != NULL)
340 connman_dbus_dict_append_basic(&dict, "TetheringIdentifier",
342 &technology->tethering_ident);
344 if (technology->tethering_passphrase != NULL)
345 connman_dbus_dict_append_basic(&dict, "TetheringPassphrase",
347 &technology->tethering_passphrase);
349 connman_dbus_dict_close(&array, &dict);
354 static DBusMessage *set_property(DBusConnection *conn,
355 DBusMessage *msg, void *data)
357 struct connman_technology *technology = data;
358 DBusMessageIter iter, value;
362 DBG("conn %p", conn);
364 if (dbus_message_iter_init(msg, &iter) == FALSE)
365 return __connman_error_invalid_arguments(msg);
367 dbus_message_iter_get_basic(&iter, &name);
368 dbus_message_iter_next(&iter);
369 dbus_message_iter_recurse(&iter, &value);
371 type = dbus_message_iter_get_arg_type(&value);
373 DBG("property %s", name);
375 if (g_str_equal(name, "Tethering") == TRUE) {
377 connman_bool_t tethering;
380 if (type != DBUS_TYPE_BOOLEAN)
381 return __connman_error_invalid_arguments(msg);
383 dbus_message_iter_get_basic(&value, &tethering);
385 if (technology->tethering == tethering)
386 return __connman_error_in_progress(msg);
388 bridge = __connman_tethering_get_bridge();
390 return __connman_error_not_supported(msg);
392 err = set_tethering(technology, bridge, tethering);
394 return __connman_error_failed(msg, -err);
396 } else if (g_str_equal(name, "TetheringIdentifier") == TRUE) {
399 dbus_message_iter_get_basic(&value, &str);
401 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
402 return __connman_error_not_supported(msg);
404 technology->tethering_ident = g_strdup(str);
405 } else if (g_str_equal(name, "TetheringPassphrase") == TRUE) {
408 dbus_message_iter_get_basic(&value, &str);
410 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
411 return __connman_error_not_supported(msg);
414 return __connman_error_invalid_arguments(msg);
416 technology->tethering_passphrase = g_strdup(str);
418 return __connman_error_invalid_property(msg);
420 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
423 static GDBusMethodTable technology_methods[] = {
424 { "GetProperties", "", "a{sv}", get_properties },
425 { "SetProperty", "sv", "", set_property },
429 static GDBusSignalTable technology_signals[] = {
430 { "PropertyChanged", "sv" },
434 static struct connman_technology *technology_find(enum connman_service_type type)
438 DBG("type %d", type);
440 for (list = technology_list; list; list = list->next) {
441 struct connman_technology *technology = list->data;
443 if (technology->type == type)
450 static struct connman_technology *technology_get(enum connman_service_type type)
452 struct connman_technology *technology;
456 DBG("type %d", type);
458 technology = technology_find(type);
459 if (technology != NULL) {
460 g_atomic_int_inc(&technology->refcount);
464 str = __connman_service_type2string(type);
468 technology = g_try_new0(struct connman_technology, 1);
469 if (technology == NULL)
472 technology->refcount = 1;
474 technology->type = type;
475 technology->path = g_strdup_printf("%s/technology/%s",
478 technology->rfkill_list = g_hash_table_new_full(g_int_hash, g_int_equal,
480 technology->device_list = NULL;
482 technology->pending_reply = NULL;
483 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
485 __connman_storage_load_technology(technology);
487 if (g_dbus_register_interface(connection, technology->path,
488 CONNMAN_TECHNOLOGY_INTERFACE,
489 technology_methods, technology_signals,
490 NULL, technology, NULL) == FALSE) {
491 connman_error("Failed to register %s", technology->path);
496 technology_list = g_slist_append(technology_list, technology);
498 technologies_changed();
500 if (technology->driver != NULL)
503 for (list = driver_list; list; list = list->next) {
504 struct connman_technology_driver *driver = list->data;
506 DBG("driver %p name %s", driver, driver->name);
508 if (driver->type != technology->type)
511 if (driver->probe(technology) == 0) {
512 technology->driver = driver;
518 DBG("technology %p", technology);
523 static void technology_put(struct connman_technology *technology)
525 DBG("technology %p", technology);
527 if (g_atomic_int_dec_and_test(&technology->refcount) == FALSE)
530 if (technology->driver) {
531 technology->driver->remove(technology);
532 technology->driver = NULL;
535 technology_list = g_slist_remove(technology_list, technology);
537 technologies_changed();
539 g_dbus_unregister_interface(connection, technology->path,
540 CONNMAN_TECHNOLOGY_INTERFACE);
542 g_slist_free(technology->device_list);
543 g_hash_table_destroy(technology->rfkill_list);
545 g_free(technology->path);
546 g_free(technology->regdom);
550 void __connman_technology_add_interface(enum connman_service_type type,
551 int index, const char *name, const char *ident)
553 struct connman_technology *technology;
556 case CONNMAN_SERVICE_TYPE_UNKNOWN:
557 case CONNMAN_SERVICE_TYPE_SYSTEM:
559 case CONNMAN_SERVICE_TYPE_ETHERNET:
560 case CONNMAN_SERVICE_TYPE_WIFI:
561 case CONNMAN_SERVICE_TYPE_WIMAX:
562 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
563 case CONNMAN_SERVICE_TYPE_CELLULAR:
564 case CONNMAN_SERVICE_TYPE_GPS:
565 case CONNMAN_SERVICE_TYPE_VPN:
566 case CONNMAN_SERVICE_TYPE_GADGET:
570 connman_info("Create interface %s [ %s ]", name,
571 __connman_service_type2string(type));
573 technology = technology_get(type);
575 if (technology == NULL || technology->driver == NULL
576 || technology->driver->add_interface == NULL)
579 technology->driver->add_interface(technology,
583 void __connman_technology_remove_interface(enum connman_service_type type,
584 int index, const char *name, const char *ident)
586 struct connman_technology *technology;
589 case CONNMAN_SERVICE_TYPE_UNKNOWN:
590 case CONNMAN_SERVICE_TYPE_SYSTEM:
592 case CONNMAN_SERVICE_TYPE_ETHERNET:
593 case CONNMAN_SERVICE_TYPE_WIFI:
594 case CONNMAN_SERVICE_TYPE_WIMAX:
595 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
596 case CONNMAN_SERVICE_TYPE_CELLULAR:
597 case CONNMAN_SERVICE_TYPE_GPS:
598 case CONNMAN_SERVICE_TYPE_VPN:
599 case CONNMAN_SERVICE_TYPE_GADGET:
603 connman_info("Remove interface %s [ %s ]", name,
604 __connman_service_type2string(type));
606 technology = technology_find(type);
608 if (technology == NULL || technology->driver == NULL)
611 if (technology->driver->remove_interface)
612 technology->driver->remove_interface(technology, index);
614 technology_put(technology);
617 int __connman_technology_add_device(struct connman_device *device)
619 struct connman_technology *technology;
620 enum connman_service_type type;
622 DBG("device %p", device);
624 type = __connman_device_get_service_type(device);
625 __connman_notifier_register(type);
627 technology = technology_get(type);
628 if (technology == NULL)
631 if (g_atomic_int_get(&technology->blocked))
636 technology->device_list = g_slist_append(technology->device_list,
642 int __connman_technology_remove_device(struct connman_device *device)
644 struct connman_technology *technology;
645 enum connman_service_type type;
647 DBG("device %p", device);
649 type = __connman_device_get_service_type(device);
650 __connman_notifier_unregister(type);
652 technology = technology_find(type);
653 if (technology == NULL)
656 technology->device_list = g_slist_remove(technology->device_list,
658 if (technology->device_list == NULL) {
659 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
660 state_changed(technology);
666 static gboolean technology_pending_reply(gpointer user_data)
668 struct connman_technology *technology = user_data;
671 /* Power request timedout, send ETIMEDOUT. */
672 if (technology->pending_reply != NULL) {
673 reply = __connman_error_failed(technology->pending_reply, ETIMEDOUT);
675 g_dbus_send_message(connection, reply);
677 dbus_message_unref(technology->pending_reply);
678 technology->pending_reply = NULL;
679 technology->pending_timeout = 0;
685 int __connman_technology_enabled(enum connman_service_type type)
687 struct connman_technology *technology;
689 technology = technology_find(type);
690 if (technology == NULL)
693 if (g_atomic_int_get(&technology->blocked))
696 __connman_notifier_enable(type);
698 if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
699 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
700 state_changed(technology);
703 if (technology->pending_reply != NULL) {
704 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
705 dbus_message_unref(technology->pending_reply);
706 technology->pending_reply = NULL;
707 technology->pending_timeout = 0;
713 int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg)
715 struct connman_technology *technology;
721 DBG("type %d enable", type);
723 technology = technology_find(type);
724 if (technology == NULL) {
729 if (technology->pending_reply != NULL) {
735 technology->pending_reply = dbus_message_ref(msg);
737 * This is a bit of a trick. When msg is not NULL it means
738 * thats technology_enable was invoked from the manager API. Hence we save
741 technology->enable_persistent = TRUE;
742 __connman_storage_save_technology(technology);
745 for (list = technology->device_list; list; list = list->next) {
746 struct connman_device *device = list->data;
748 err = __connman_device_enable_persistent(device);
750 * err = 0 : Device was enabled right away.
751 * If atleast one device gets enabled, we consider
752 * the technology to be enabled.
763 if (err == -EINPROGRESS)
764 technology->pending_timeout = g_timeout_add_seconds(10,
765 technology_pending_reply, technology);
767 reply = __connman_error_failed(msg, -err);
769 g_dbus_send_message(connection, reply);
776 int __connman_technology_disabled(enum connman_service_type type)
778 struct connman_technology *technology;
781 technology = technology_find(type);
782 if (technology == NULL)
785 if (technology->pending_reply != NULL) {
786 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
787 dbus_message_unref(technology->pending_reply);
788 technology->pending_reply = NULL;
791 if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
792 __connman_notifier_disable(type);
793 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
794 state_changed(technology);
797 for (list = technology->device_list; list; list = list->next) {
798 struct connman_device *device = list->data;
800 if (__connman_device_get_blocked(device) == FALSE)
807 int __connman_technology_disable(enum connman_service_type type, DBusMessage *msg)
809 struct connman_technology *technology;
815 DBG("type %d disable", type);
817 technology = technology_find(type);
818 if (technology == NULL) {
823 if (technology->pending_reply != NULL) {
829 technology->pending_reply = dbus_message_ref(msg);
830 technology->enable_persistent = FALSE;
831 __connman_storage_save_technology(technology);
834 for (list = technology->device_list; list; list = list->next) {
835 struct connman_device *device = list->data;
837 err = __connman_device_disable_persistent(device);
847 if (err == -EINPROGRESS)
848 technology->pending_timeout = g_timeout_add_seconds(10,
849 technology_pending_reply, technology);
851 reply = __connman_error_failed(msg, -err);
853 g_dbus_send_message(connection, reply);
860 int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
865 DBG("offlinemode %s", offlinemode ? "On" : "Off");
867 /* Traverse technology list, enable/disable each technology. */
868 for (list = technology_list; list; list = list->next) {
869 struct connman_technology *technology = list->data;
872 err = __connman_technology_disable(technology->type, NULL);
873 if (!offlinemode && technology->enable_persistent)
874 err = __connman_technology_enable(technology->type, NULL);
877 if (err == 0 || err == -EINPROGRESS) {
878 __connman_profile_set_offlinemode(offlinemode);
879 __connman_profile_save_default();
881 __connman_notifier_offlinemode(offlinemode);
887 static void technology_blocked(struct connman_technology *technology,
888 connman_bool_t blocked)
892 for (list = technology->device_list; list; list = list->next) {
893 struct connman_device *device = list->data;
895 __connman_device_set_blocked(device, blocked);
899 int __connman_technology_add_rfkill(unsigned int index,
900 enum connman_service_type type,
901 connman_bool_t softblock,
902 connman_bool_t hardblock)
904 struct connman_technology *technology;
905 struct connman_rfkill *rfkill;
906 connman_bool_t blocked;
908 DBG("index %u type %d soft %u hard %u", index, type,
909 softblock, hardblock);
911 technology = technology_get(type);
912 if (technology == NULL)
915 rfkill = g_try_new0(struct connman_rfkill, 1);
919 rfkill->index = index;
921 rfkill->softblock = softblock;
922 rfkill->hardblock = hardblock;
924 g_hash_table_replace(technology->rfkill_list, &rfkill->index, rfkill);
926 blocked = (softblock || hardblock) ? TRUE : FALSE;
927 if (blocked == FALSE)
930 if (g_atomic_int_exchange_and_add(&technology->blocked, 1) == 0) {
931 technology_blocked(technology, TRUE);
933 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
934 state_changed(technology);
940 int __connman_technology_update_rfkill(unsigned int index,
941 enum connman_service_type type,
942 connman_bool_t softblock,
943 connman_bool_t hardblock)
945 struct connman_technology *technology;
946 struct connman_rfkill *rfkill;
947 connman_bool_t blocked, old_blocked;
949 DBG("index %u soft %u hard %u", index, softblock, hardblock);
951 technology = technology_find(type);
952 if (technology == NULL)
955 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
959 old_blocked = (rfkill->softblock || rfkill->hardblock) ? TRUE : FALSE;
960 blocked = (softblock || hardblock) ? TRUE : FALSE;
962 rfkill->softblock = softblock;
963 rfkill->hardblock = hardblock;
965 if (blocked == old_blocked)
972 g_atomic_int_exchange_and_add(&technology->blocked, 1);
973 if (n_blocked != g_hash_table_size(technology->rfkill_list) - 1)
976 technology_blocked(technology, blocked);
977 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
978 state_changed(technology);
980 if (g_atomic_int_dec_and_test(&technology->blocked) == FALSE)
983 technology_blocked(technology, blocked);
984 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
985 state_changed(technology);
991 int __connman_technology_remove_rfkill(unsigned int index,
992 enum connman_service_type type)
994 struct connman_technology *technology;
995 struct connman_rfkill *rfkill;
996 connman_bool_t blocked;
998 DBG("index %u", index);
1000 technology = technology_find(type);
1001 if (technology == NULL)
1004 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1008 blocked = (rfkill->softblock || rfkill->hardblock) ? TRUE : FALSE;
1010 g_hash_table_remove(technology->rfkill_list, &index);
1013 g_atomic_int_dec_and_test(&technology->blocked) == TRUE) {
1014 technology_blocked(technology, FALSE);
1015 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
1016 state_changed(technology);
1022 connman_bool_t __connman_technology_get_blocked(enum connman_service_type type)
1024 struct connman_technology *technology;
1026 technology = technology_find(type);
1027 if (technology == NULL)
1030 if (g_atomic_int_get(&technology->blocked))
1036 static int technology_load(struct connman_technology *technology)
1038 const char *ident = __connman_profile_active_ident();
1041 GError *error = NULL;
1042 connman_bool_t enable;
1044 DBG("technology %p", technology);
1046 keyfile = __connman_storage_open_profile(ident);
1047 if (keyfile == NULL)
1050 identifier = g_strdup_printf("%s", get_name(technology->type));
1051 if (identifier == NULL)
1054 enable = g_key_file_get_boolean(keyfile, identifier, "Enable", &error);
1056 technology->enable_persistent = enable;
1058 technology->enable_persistent = FALSE;
1060 g_clear_error(&error);
1064 __connman_storage_close_profile(ident, keyfile, FALSE);
1069 static int technology_save(struct connman_technology *technology)
1071 const char *ident = __connman_profile_active_ident();
1075 DBG("technology %p", technology);
1077 keyfile = __connman_storage_open_profile(ident);
1078 if (keyfile == NULL)
1081 identifier = g_strdup_printf("%s", get_name(technology->type));
1082 if (identifier == NULL)
1085 g_key_file_set_boolean(keyfile, identifier, "Enable",
1086 technology->enable_persistent);
1091 __connman_storage_close_profile(ident, keyfile, TRUE);
1096 static struct connman_storage tech_storage = {
1097 .name = "technology",
1098 .priority = CONNMAN_STORAGE_PRIORITY_LOW,
1099 .tech_load = technology_load,
1100 .tech_save = technology_save,
1103 int __connman_technology_init(void)
1107 connection = connman_dbus_get_connection();
1109 return connman_storage_register(&tech_storage);
1112 void __connman_technology_cleanup(void)
1116 dbus_connection_unref(connection);
1118 connman_storage_unregister(&tech_storage);