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 if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
697 __connman_notifier_enable(type);
698 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
699 state_changed(technology);
702 if (technology->pending_reply != NULL) {
703 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
704 dbus_message_unref(technology->pending_reply);
705 technology->pending_reply = NULL;
706 technology->pending_timeout = 0;
712 int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg)
714 struct connman_technology *technology;
720 DBG("type %d enable", type);
722 technology = technology_find(type);
723 if (technology == NULL) {
728 if (technology->pending_reply != NULL) {
734 technology->pending_reply = dbus_message_ref(msg);
736 * This is a bit of a trick. When msg is not NULL it means
737 * thats technology_enable was invoked from the manager API. Hence we save
740 technology->enable_persistent = TRUE;
741 __connman_storage_save_technology(technology);
744 for (list = technology->device_list; list; list = list->next) {
745 struct connman_device *device = list->data;
747 err = __connman_device_enable_persistent(device);
749 * err = 0 : Device was enabled right away.
750 * If atleast one device gets enabled, we consider
751 * the technology to be enabled.
762 if (err == -EINPROGRESS)
763 technology->pending_timeout = g_timeout_add_seconds(10,
764 technology_pending_reply, technology);
766 reply = __connman_error_failed(msg, -err);
768 g_dbus_send_message(connection, reply);
775 int __connman_technology_disabled(enum connman_service_type type)
777 struct connman_technology *technology;
780 technology = technology_find(type);
781 if (technology == NULL)
784 if (technology->pending_reply != NULL) {
785 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
786 dbus_message_unref(technology->pending_reply);
787 technology->pending_reply = NULL;
790 if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
791 __connman_notifier_disable(type);
792 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
793 state_changed(technology);
796 for (list = technology->device_list; list; list = list->next) {
797 struct connman_device *device = list->data;
799 if (__connman_device_get_blocked(device) == FALSE)
806 int __connman_technology_disable(enum connman_service_type type, DBusMessage *msg)
808 struct connman_technology *technology;
814 DBG("type %d disable", type);
816 technology = technology_find(type);
817 if (technology == NULL) {
822 if (technology->pending_reply != NULL) {
828 technology->pending_reply = dbus_message_ref(msg);
829 technology->enable_persistent = FALSE;
830 __connman_storage_save_technology(technology);
833 for (list = technology->device_list; list; list = list->next) {
834 struct connman_device *device = list->data;
836 err = __connman_device_disable_persistent(device);
846 if (err == -EINPROGRESS)
847 technology->pending_timeout = g_timeout_add_seconds(10,
848 technology_pending_reply, technology);
850 reply = __connman_error_failed(msg, -err);
852 g_dbus_send_message(connection, reply);
859 int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
864 DBG("offlinemode %s", offlinemode ? "On" : "Off");
866 /* Traverse technology list, enable/disable each technology. */
867 for (list = technology_list; list; list = list->next) {
868 struct connman_technology *technology = list->data;
871 err = __connman_technology_disable(technology->type, NULL);
872 if (!offlinemode && technology->enable_persistent)
873 err = __connman_technology_enable(technology->type, NULL);
876 if (err == 0 || err == -EINPROGRESS) {
877 __connman_profile_set_offlinemode(offlinemode);
878 __connman_profile_save_default();
880 __connman_notifier_offlinemode(offlinemode);
886 static void technology_blocked(struct connman_technology *technology,
887 connman_bool_t blocked)
891 for (list = technology->device_list; list; list = list->next) {
892 struct connman_device *device = list->data;
894 __connman_device_set_blocked(device, blocked);
898 int __connman_technology_add_rfkill(unsigned int index,
899 enum connman_service_type type,
900 connman_bool_t softblock,
901 connman_bool_t hardblock)
903 struct connman_technology *technology;
904 struct connman_rfkill *rfkill;
905 connman_bool_t blocked;
907 DBG("index %u type %d soft %u hard %u", index, type,
908 softblock, hardblock);
910 technology = technology_get(type);
911 if (technology == NULL)
914 rfkill = g_try_new0(struct connman_rfkill, 1);
918 rfkill->index = index;
920 rfkill->softblock = softblock;
921 rfkill->hardblock = hardblock;
923 g_hash_table_replace(technology->rfkill_list, &rfkill->index, rfkill);
925 blocked = (softblock || hardblock) ? TRUE : FALSE;
926 if (blocked == FALSE)
929 if (g_atomic_int_exchange_and_add(&technology->blocked, 1) == 0) {
930 technology_blocked(technology, TRUE);
932 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
933 state_changed(technology);
939 int __connman_technology_update_rfkill(unsigned int index,
940 enum connman_service_type type,
941 connman_bool_t softblock,
942 connman_bool_t hardblock)
944 struct connman_technology *technology;
945 struct connman_rfkill *rfkill;
946 connman_bool_t blocked, old_blocked;
948 DBG("index %u soft %u hard %u", index, softblock, hardblock);
950 technology = technology_find(type);
951 if (technology == NULL)
954 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
958 old_blocked = (rfkill->softblock || rfkill->hardblock) ? TRUE : FALSE;
959 blocked = (softblock || hardblock) ? TRUE : FALSE;
961 rfkill->softblock = softblock;
962 rfkill->hardblock = hardblock;
964 if (blocked == old_blocked)
971 g_atomic_int_exchange_and_add(&technology->blocked, 1);
972 if (n_blocked != g_hash_table_size(technology->rfkill_list) - 1)
975 technology_blocked(technology, blocked);
976 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
977 state_changed(technology);
979 if (g_atomic_int_dec_and_test(&technology->blocked) == FALSE)
982 technology_blocked(technology, blocked);
983 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
984 state_changed(technology);
990 int __connman_technology_remove_rfkill(unsigned int index,
991 enum connman_service_type type)
993 struct connman_technology *technology;
994 struct connman_rfkill *rfkill;
995 connman_bool_t blocked;
997 DBG("index %u", index);
999 technology = technology_find(type);
1000 if (technology == NULL)
1003 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1007 blocked = (rfkill->softblock || rfkill->hardblock) ? TRUE : FALSE;
1009 g_hash_table_remove(technology->rfkill_list, &index);
1012 g_atomic_int_dec_and_test(&technology->blocked) == TRUE) {
1013 technology_blocked(technology, FALSE);
1014 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
1015 state_changed(technology);
1021 connman_bool_t __connman_technology_get_blocked(enum connman_service_type type)
1023 struct connman_technology *technology;
1025 technology = technology_find(type);
1026 if (technology == NULL)
1029 if (g_atomic_int_get(&technology->blocked))
1035 static int technology_load(struct connman_technology *technology)
1037 const char *ident = __connman_profile_active_ident();
1040 GError *error = NULL;
1041 connman_bool_t enable;
1043 DBG("technology %p", technology);
1045 keyfile = __connman_storage_open_profile(ident);
1046 if (keyfile == NULL)
1049 identifier = g_strdup_printf("%s", get_name(technology->type));
1050 if (identifier == NULL)
1053 enable = g_key_file_get_boolean(keyfile, identifier, "Enable", &error);
1055 technology->enable_persistent = enable;
1057 technology->enable_persistent = FALSE;
1059 g_clear_error(&error);
1063 __connman_storage_close_profile(ident, keyfile, FALSE);
1068 static int technology_save(struct connman_technology *technology)
1070 const char *ident = __connman_profile_active_ident();
1074 DBG("technology %p", technology);
1076 keyfile = __connman_storage_open_profile(ident);
1077 if (keyfile == NULL)
1080 identifier = g_strdup_printf("%s", get_name(technology->type));
1081 if (identifier == NULL)
1084 g_key_file_set_boolean(keyfile, identifier, "Enable",
1085 technology->enable_persistent);
1090 __connman_storage_close_profile(ident, keyfile, TRUE);
1095 static struct connman_storage tech_storage = {
1096 .name = "technology",
1097 .priority = CONNMAN_STORAGE_PRIORITY_LOW,
1098 .tech_load = technology_load,
1099 .tech_save = technology_save,
1102 int __connman_technology_init(void)
1106 connection = connman_dbus_get_connection();
1108 return connman_storage_register(&tech_storage);
1111 void __connman_technology_cleanup(void)
1115 dbus_connection_unref(connection);
1117 connman_storage_unregister(&tech_storage);