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 static connman_bool_t global_offlinemode;
39 struct connman_rfkill {
41 enum connman_service_type type;
42 connman_bool_t softblock;
43 connman_bool_t hardblock;
46 enum connman_technology_state {
47 CONNMAN_TECHNOLOGY_STATE_UNKNOWN = 0,
48 CONNMAN_TECHNOLOGY_STATE_OFFLINE = 1,
49 CONNMAN_TECHNOLOGY_STATE_ENABLED = 2,
50 CONNMAN_TECHNOLOGY_STATE_CONNECTED = 3,
53 struct connman_technology {
55 enum connman_service_type type;
56 enum connman_technology_state state;
58 GHashTable *rfkill_list;
63 connman_bool_t tethering;
64 char *tethering_ident;
65 char *tethering_passphrase;
67 connman_bool_t enable_persistent; /* Save the tech state */
69 struct connman_technology_driver *driver;
72 DBusMessage *pending_reply;
73 guint pending_timeout;
76 static GSList *driver_list = NULL;
78 static gint compare_priority(gconstpointer a, gconstpointer b)
80 const struct connman_technology_driver *driver1 = a;
81 const struct connman_technology_driver *driver2 = b;
83 return driver2->priority - driver1->priority;
87 * connman_technology_driver_register:
88 * @driver: Technology driver definition
90 * Register a new technology driver
92 * Returns: %0 on success
94 int connman_technology_driver_register(struct connman_technology_driver *driver)
97 struct connman_technology *technology;
99 DBG("driver %p name %s", driver, driver->name);
101 driver_list = g_slist_insert_sorted(driver_list, driver,
104 for (list = technology_list; list; list = list->next) {
105 technology = list->data;
107 if (technology->driver != NULL)
110 if (technology->type == driver->type)
111 technology->driver = driver;
118 * connman_technology_driver_unregister:
119 * @driver: Technology driver definition
121 * Remove a previously registered technology driver
123 void connman_technology_driver_unregister(struct connman_technology_driver *driver)
126 struct connman_technology *technology;
128 DBG("driver %p name %s", driver, driver->name);
130 for (list = technology_list; list; list = list->next) {
131 technology = list->data;
133 if (technology->driver == NULL)
136 if (technology->type == driver->type) {
137 technology->driver->remove(technology);
138 technology->driver = NULL;
142 driver_list = g_slist_remove(driver_list, driver);
145 static void tethering_changed(struct connman_technology *technology)
147 connman_bool_t tethering = technology->tethering;
149 connman_dbus_property_changed_basic(technology->path,
150 CONNMAN_TECHNOLOGY_INTERFACE, "Tethering",
151 DBUS_TYPE_BOOLEAN, &tethering);
154 void connman_technology_tethering_notify(struct connman_technology *technology,
155 connman_bool_t enabled)
157 DBG("technology %p enabled %u", technology, enabled);
159 if (technology->tethering == enabled)
162 technology->tethering = enabled;
164 tethering_changed(technology);
167 __connman_tethering_set_enabled();
169 __connman_tethering_set_disabled();
172 static int set_tethering(struct connman_technology *technology,
173 const char *bridge, connman_bool_t enabled)
175 const char *ident, *passphrase;
177 ident = technology->tethering_ident;
178 passphrase = technology->tethering_passphrase;
180 if (technology->driver == NULL ||
181 technology->driver->set_tethering == NULL)
184 if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
185 (ident == NULL || passphrase == NULL))
188 return technology->driver->set_tethering(technology, ident, passphrase,
192 void connman_technology_regdom_notify(struct connman_technology *technology,
198 connman_error("Failed to set regulatory domain");
200 DBG("Regulatory domain set to %s", alpha2);
202 g_free(technology->regdom);
203 technology->regdom = g_strdup(alpha2);
206 int connman_technology_set_regdom(const char *alpha2)
210 for (list = technology_list; list; list = list->next) {
211 struct connman_technology *technology = list->data;
213 if (technology->driver == NULL)
216 if (technology->driver->set_regdom)
217 technology->driver->set_regdom(technology, alpha2);
223 static void free_rfkill(gpointer data)
225 struct connman_rfkill *rfkill = data;
230 void __connman_technology_list(DBusMessageIter *iter, void *user_data)
234 for (list = technology_list; list; list = list->next) {
235 struct connman_technology *technology = list->data;
237 if (technology->path == NULL)
240 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
245 static void technologies_changed(void)
247 connman_dbus_property_changed_array(CONNMAN_MANAGER_PATH,
248 CONNMAN_MANAGER_INTERFACE, "Technologies",
249 DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL);
252 static const char *state2string(enum connman_technology_state state)
255 case CONNMAN_TECHNOLOGY_STATE_UNKNOWN:
257 case CONNMAN_TECHNOLOGY_STATE_OFFLINE:
259 case CONNMAN_TECHNOLOGY_STATE_ENABLED:
261 case CONNMAN_TECHNOLOGY_STATE_CONNECTED:
268 static void state_changed(struct connman_technology *technology)
272 str = state2string(technology->state);
276 connman_dbus_property_changed_basic(technology->path,
277 CONNMAN_TECHNOLOGY_INTERFACE, "State",
278 DBUS_TYPE_STRING, &str);
281 static const char *get_name(enum connman_service_type type)
284 case CONNMAN_SERVICE_TYPE_UNKNOWN:
285 case CONNMAN_SERVICE_TYPE_SYSTEM:
286 case CONNMAN_SERVICE_TYPE_GPS:
287 case CONNMAN_SERVICE_TYPE_VPN:
288 case CONNMAN_SERVICE_TYPE_GADGET:
290 case CONNMAN_SERVICE_TYPE_ETHERNET:
292 case CONNMAN_SERVICE_TYPE_WIFI:
294 case CONNMAN_SERVICE_TYPE_WIMAX:
296 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
298 case CONNMAN_SERVICE_TYPE_CELLULAR:
305 connman_bool_t __connman_technology_get_offlinemode(void)
307 return global_offlinemode;
310 static int connman_technology_save_offlinemode()
314 keyfile = __connman_storage_open_profile("default");
318 g_key_file_set_boolean(keyfile, "global",
319 "OfflineMode", global_offlinemode);
321 __connman_storage_close_profile("default", keyfile, TRUE);
326 static connman_bool_t connman_technology_load_offlinemode()
329 GError *error = NULL;
330 connman_bool_t offlinemode;
332 /* If there is a error, we enable offlinemode */
333 keyfile = __connman_storage_open_profile("default");
337 offlinemode = g_key_file_get_boolean(keyfile, "global",
338 "OfflineMode", &error);
341 g_clear_error(&error);
343 __connman_storage_close_profile("default", keyfile, FALSE);
348 static DBusMessage *get_properties(DBusConnection *conn,
349 DBusMessage *message, void *user_data)
351 struct connman_technology *technology = user_data;
353 DBusMessageIter array, dict;
356 reply = dbus_message_new_method_return(message);
360 dbus_message_iter_init_append(reply, &array);
362 connman_dbus_dict_open(&array, &dict);
364 str = state2string(technology->state);
366 connman_dbus_dict_append_basic(&dict, "State",
367 DBUS_TYPE_STRING, &str);
369 str = get_name(technology->type);
371 connman_dbus_dict_append_basic(&dict, "Name",
372 DBUS_TYPE_STRING, &str);
374 str = __connman_service_type2string(technology->type);
376 connman_dbus_dict_append_basic(&dict, "Type",
377 DBUS_TYPE_STRING, &str);
379 connman_dbus_dict_append_basic(&dict, "Tethering",
381 &technology->tethering);
383 if (technology->tethering_ident != NULL)
384 connman_dbus_dict_append_basic(&dict, "TetheringIdentifier",
386 &technology->tethering_ident);
388 if (technology->tethering_passphrase != NULL)
389 connman_dbus_dict_append_basic(&dict, "TetheringPassphrase",
391 &technology->tethering_passphrase);
393 connman_dbus_dict_close(&array, &dict);
398 static DBusMessage *set_property(DBusConnection *conn,
399 DBusMessage *msg, void *data)
401 struct connman_technology *technology = data;
402 DBusMessageIter iter, value;
406 DBG("conn %p", conn);
408 if (dbus_message_iter_init(msg, &iter) == FALSE)
409 return __connman_error_invalid_arguments(msg);
411 dbus_message_iter_get_basic(&iter, &name);
412 dbus_message_iter_next(&iter);
413 dbus_message_iter_recurse(&iter, &value);
415 type = dbus_message_iter_get_arg_type(&value);
417 DBG("property %s", name);
419 if (g_str_equal(name, "Tethering") == TRUE) {
421 connman_bool_t tethering;
424 if (type != DBUS_TYPE_BOOLEAN)
425 return __connman_error_invalid_arguments(msg);
427 dbus_message_iter_get_basic(&value, &tethering);
429 if (technology->tethering == tethering)
430 return __connman_error_in_progress(msg);
432 bridge = __connman_tethering_get_bridge();
434 return __connman_error_not_supported(msg);
436 err = set_tethering(technology, bridge, tethering);
438 return __connman_error_failed(msg, -err);
440 } else if (g_str_equal(name, "TetheringIdentifier") == TRUE) {
443 dbus_message_iter_get_basic(&value, &str);
445 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
446 return __connman_error_not_supported(msg);
448 technology->tethering_ident = g_strdup(str);
449 } else if (g_str_equal(name, "TetheringPassphrase") == TRUE) {
452 dbus_message_iter_get_basic(&value, &str);
454 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
455 return __connman_error_not_supported(msg);
458 return __connman_error_invalid_arguments(msg);
460 technology->tethering_passphrase = g_strdup(str);
462 return __connman_error_invalid_property(msg);
464 return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
467 static GDBusMethodTable technology_methods[] = {
468 { "GetProperties", "", "a{sv}", get_properties },
469 { "SetProperty", "sv", "", set_property },
473 static GDBusSignalTable technology_signals[] = {
474 { "PropertyChanged", "sv" },
478 static struct connman_technology *technology_find(enum connman_service_type type)
482 DBG("type %d", type);
484 for (list = technology_list; list; list = list->next) {
485 struct connman_technology *technology = list->data;
487 if (technology->type == type)
494 static struct connman_technology *technology_get(enum connman_service_type type)
496 struct connman_technology *technology;
500 DBG("type %d", type);
502 technology = technology_find(type);
503 if (technology != NULL) {
504 g_atomic_int_inc(&technology->refcount);
508 str = __connman_service_type2string(type);
512 technology = g_try_new0(struct connman_technology, 1);
513 if (technology == NULL)
516 technology->refcount = 1;
518 technology->type = type;
519 technology->path = g_strdup_printf("%s/technology/%s",
522 technology->rfkill_list = g_hash_table_new_full(g_int_hash, g_int_equal,
524 technology->device_list = NULL;
526 technology->pending_reply = NULL;
527 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
529 __connman_storage_load_technology(technology);
531 if (g_dbus_register_interface(connection, technology->path,
532 CONNMAN_TECHNOLOGY_INTERFACE,
533 technology_methods, technology_signals,
534 NULL, technology, NULL) == FALSE) {
535 connman_error("Failed to register %s", technology->path);
540 technology_list = g_slist_append(technology_list, technology);
542 technologies_changed();
544 if (technology->driver != NULL)
547 for (list = driver_list; list; list = list->next) {
548 struct connman_technology_driver *driver = list->data;
550 DBG("driver %p name %s", driver, driver->name);
552 if (driver->type != technology->type)
555 if (driver->probe(technology) == 0) {
556 technology->driver = driver;
562 DBG("technology %p", technology);
567 static void technology_put(struct connman_technology *technology)
569 DBG("technology %p", technology);
571 if (g_atomic_int_dec_and_test(&technology->refcount) == FALSE)
574 if (technology->driver) {
575 technology->driver->remove(technology);
576 technology->driver = NULL;
579 technology_list = g_slist_remove(technology_list, technology);
581 technologies_changed();
583 g_dbus_unregister_interface(connection, technology->path,
584 CONNMAN_TECHNOLOGY_INTERFACE);
586 g_slist_free(technology->device_list);
587 g_hash_table_destroy(technology->rfkill_list);
589 g_free(technology->path);
590 g_free(technology->regdom);
594 void __connman_technology_add_interface(enum connman_service_type type,
595 int index, const char *name, const char *ident)
597 struct connman_technology *technology;
600 case CONNMAN_SERVICE_TYPE_UNKNOWN:
601 case CONNMAN_SERVICE_TYPE_SYSTEM:
603 case CONNMAN_SERVICE_TYPE_ETHERNET:
604 case CONNMAN_SERVICE_TYPE_WIFI:
605 case CONNMAN_SERVICE_TYPE_WIMAX:
606 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
607 case CONNMAN_SERVICE_TYPE_CELLULAR:
608 case CONNMAN_SERVICE_TYPE_GPS:
609 case CONNMAN_SERVICE_TYPE_VPN:
610 case CONNMAN_SERVICE_TYPE_GADGET:
614 connman_info("Create interface %s [ %s ]", name,
615 __connman_service_type2string(type));
617 technology = technology_get(type);
619 if (technology == NULL || technology->driver == NULL
620 || technology->driver->add_interface == NULL)
623 technology->driver->add_interface(technology,
627 void __connman_technology_remove_interface(enum connman_service_type type,
628 int index, const char *name, const char *ident)
630 struct connman_technology *technology;
633 case CONNMAN_SERVICE_TYPE_UNKNOWN:
634 case CONNMAN_SERVICE_TYPE_SYSTEM:
636 case CONNMAN_SERVICE_TYPE_ETHERNET:
637 case CONNMAN_SERVICE_TYPE_WIFI:
638 case CONNMAN_SERVICE_TYPE_WIMAX:
639 case CONNMAN_SERVICE_TYPE_BLUETOOTH:
640 case CONNMAN_SERVICE_TYPE_CELLULAR:
641 case CONNMAN_SERVICE_TYPE_GPS:
642 case CONNMAN_SERVICE_TYPE_VPN:
643 case CONNMAN_SERVICE_TYPE_GADGET:
647 connman_info("Remove interface %s [ %s ]", name,
648 __connman_service_type2string(type));
650 technology = technology_find(type);
652 if (technology == NULL || technology->driver == NULL)
655 if (technology->driver->remove_interface)
656 technology->driver->remove_interface(technology, index);
658 technology_put(technology);
661 int __connman_technology_add_device(struct connman_device *device)
663 struct connman_technology *technology;
664 enum connman_service_type type;
666 DBG("device %p", device);
668 type = __connman_device_get_service_type(device);
669 __connman_notifier_register(type);
671 technology = technology_get(type);
672 if (technology == NULL)
675 if (technology->enable_persistent && !global_offlinemode)
676 __connman_device_enable(device);
677 /* if technology persistent state is offline */
678 if (!technology->enable_persistent)
679 __connman_device_disable(device);
681 technology->device_list = g_slist_append(technology->device_list,
687 int __connman_technology_remove_device(struct connman_device *device)
689 struct connman_technology *technology;
690 enum connman_service_type type;
692 DBG("device %p", device);
694 type = __connman_device_get_service_type(device);
695 __connman_notifier_unregister(type);
697 technology = technology_find(type);
698 if (technology == NULL)
701 technology->device_list = g_slist_remove(technology->device_list,
703 if (technology->device_list == NULL) {
704 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
705 state_changed(technology);
711 static gboolean technology_pending_reply(gpointer user_data)
713 struct connman_technology *technology = user_data;
716 /* Power request timedout, send ETIMEDOUT. */
717 if (technology->pending_reply != NULL) {
718 reply = __connman_error_failed(technology->pending_reply, ETIMEDOUT);
720 g_dbus_send_message(connection, reply);
722 dbus_message_unref(technology->pending_reply);
723 technology->pending_reply = NULL;
724 technology->pending_timeout = 0;
730 int __connman_technology_enabled(enum connman_service_type type)
732 struct connman_technology *technology;
734 technology = technology_find(type);
735 if (technology == NULL)
738 if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
739 __connman_notifier_enable(type);
740 technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED;
741 state_changed(technology);
744 if (technology->pending_reply != NULL) {
745 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
746 dbus_message_unref(technology->pending_reply);
747 technology->pending_reply = NULL;
748 technology->pending_timeout = 0;
754 int __connman_technology_enable(enum connman_service_type type, DBusMessage *msg)
756 struct connman_technology *technology;
762 DBG("type %d enable", type);
764 technology = technology_find(type);
765 if (technology == NULL) {
770 if (technology->pending_reply != NULL) {
776 technology->pending_reply = dbus_message_ref(msg);
778 * This is a bit of a trick. When msg is not NULL it means
779 * thats technology_enable was invoked from the manager API. Hence we save
782 technology->enable_persistent = TRUE;
783 __connman_storage_save_technology(technology);
786 __connman_rfkill_block(technology->type, FALSE);
788 for (list = technology->device_list; list; list = list->next) {
789 struct connman_device *device = list->data;
791 err = __connman_device_enable(device);
793 * err = 0 : Device was enabled right away.
794 * If atleast one device gets enabled, we consider
795 * the technology to be enabled.
806 if (err == -EINPROGRESS)
807 technology->pending_timeout = g_timeout_add_seconds(10,
808 technology_pending_reply, technology);
810 reply = __connman_error_failed(msg, -err);
812 g_dbus_send_message(connection, reply);
819 int __connman_technology_disabled(enum connman_service_type type)
821 struct connman_technology *technology;
823 technology = technology_find(type);
824 if (technology == NULL)
827 if (technology->pending_reply != NULL) {
828 g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID);
829 dbus_message_unref(technology->pending_reply);
830 technology->pending_reply = NULL;
833 if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
834 __connman_notifier_disable(type);
835 technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE;
836 state_changed(technology);
842 int __connman_technology_disable(enum connman_service_type type, DBusMessage *msg)
844 struct connman_technology *technology;
850 DBG("type %d disable", type);
852 technology = technology_find(type);
853 if (technology == NULL) {
858 if (technology->pending_reply != NULL) {
864 technology->pending_reply = dbus_message_ref(msg);
865 technology->enable_persistent = FALSE;
866 __connman_storage_save_technology(technology);
869 __connman_rfkill_block(technology->type, TRUE);
871 for (list = technology->device_list; list; list = list->next) {
872 struct connman_device *device = list->data;
874 err = __connman_device_disable(device);
884 if (err == -EINPROGRESS)
885 technology->pending_timeout = g_timeout_add_seconds(10,
886 technology_pending_reply, technology);
888 reply = __connman_error_failed(msg, -err);
890 g_dbus_send_message(connection, reply);
897 int __connman_technology_set_offlinemode(connman_bool_t offlinemode)
902 if (global_offlinemode == offlinemode)
905 DBG("offlinemode %s", offlinemode ? "On" : "Off");
908 * This is a bit tricky. When you set offlinemode, there is no
909 * way to differentiate between attempting offline mode and
910 * resuming offlinemode from last saved profile. We need that
911 * information in rfkill_update, otherwise it falls back on the
912 * technology's persistent state. Hence we set the offline mode here
913 * but save it & call the notifier only if its successful.
916 global_offlinemode = offlinemode;
918 /* Traverse technology list, enable/disable each technology. */
919 for (list = technology_list; list; list = list->next) {
920 struct connman_technology *technology = list->data;
923 err = __connman_technology_disable(technology->type, NULL);
925 if (!offlinemode && technology->enable_persistent)
926 err = __connman_technology_enable(technology->type, NULL);
929 if (err == 0 || err == -EINPROGRESS || err == -EALREADY) {
930 connman_technology_save_offlinemode();
931 __connman_notifier_offlinemode(offlinemode);
933 global_offlinemode = connman_technology_load_offlinemode();
938 int __connman_technology_add_rfkill(unsigned int index,
939 enum connman_service_type type,
940 connman_bool_t softblock,
941 connman_bool_t hardblock)
943 struct connman_technology *technology;
944 struct connman_rfkill *rfkill;
946 DBG("index %u type %d soft %u hard %u", index, type,
947 softblock, hardblock);
949 technology = technology_get(type);
950 if (technology == NULL)
953 rfkill = g_try_new0(struct connman_rfkill, 1);
957 rfkill->index = index;
959 rfkill->softblock = softblock;
960 rfkill->hardblock = hardblock;
962 g_hash_table_replace(technology->rfkill_list, &rfkill->index, rfkill);
965 DBG("%s is switched off.", get_name(type));
970 * If Offline mode is on, we softblock the device if it isnt already.
971 * If Offline mode is off, we rely on the persistent state of tech.
973 if (global_offlinemode) {
975 return __connman_rfkill_block(type, TRUE);
977 if (technology->enable_persistent && softblock)
978 return __connman_rfkill_block(type, FALSE);
979 /* if technology persistent state is offline */
980 if (!technology->enable_persistent && !softblock)
981 return __connman_rfkill_block(type, TRUE);
987 int __connman_technology_update_rfkill(unsigned int index,
988 enum connman_service_type type,
989 connman_bool_t softblock,
990 connman_bool_t hardblock)
992 struct connman_technology *technology;
993 struct connman_rfkill *rfkill;
995 DBG("index %u soft %u hard %u", index, softblock, hardblock);
997 technology = technology_find(type);
998 if (technology == NULL)
1001 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1005 if (rfkill->softblock == softblock &&
1006 rfkill->hardblock == hardblock)
1009 rfkill->softblock = softblock;
1010 rfkill->hardblock = hardblock;
1013 DBG("%s is switched off.", get_name(type));
1017 if (!global_offlinemode) {
1018 if (technology->enable_persistent && softblock)
1019 return __connman_rfkill_block(type, FALSE);
1020 if (!technology->enable_persistent && !softblock)
1021 return __connman_rfkill_block(type, TRUE);
1027 int __connman_technology_remove_rfkill(unsigned int index,
1028 enum connman_service_type type)
1030 struct connman_technology *technology;
1031 struct connman_rfkill *rfkill;
1033 DBG("index %u", index);
1035 technology = technology_find(type);
1036 if (technology == NULL)
1039 rfkill = g_hash_table_lookup(technology->rfkill_list, &index);
1043 g_hash_table_remove(technology->rfkill_list, &index);
1045 technology_put(technology);
1050 static int technology_load(struct connman_technology *technology)
1054 GError *error = NULL;
1055 connman_bool_t enable;
1057 DBG("technology %p", technology);
1059 keyfile = __connman_storage_open_profile("default");
1060 if (keyfile == NULL)
1063 identifier = g_strdup_printf("%s", get_name(technology->type));
1064 if (identifier == NULL)
1067 enable = g_key_file_get_boolean(keyfile, identifier, "Enable", &error);
1069 technology->enable_persistent = enable;
1071 technology->enable_persistent = FALSE;
1073 g_clear_error(&error);
1077 __connman_storage_close_profile("default", keyfile, FALSE);
1082 static int technology_save(struct connman_technology *technology)
1087 DBG("technology %p", technology);
1089 keyfile = __connman_storage_open_profile("default");
1090 if (keyfile == NULL)
1093 identifier = g_strdup_printf("%s", get_name(technology->type));
1094 if (identifier == NULL)
1097 g_key_file_set_boolean(keyfile, identifier, "Enable",
1098 technology->enable_persistent);
1103 __connman_storage_close_profile("default", keyfile, TRUE);
1108 static struct connman_storage tech_storage = {
1109 .name = "technology",
1110 .priority = CONNMAN_STORAGE_PRIORITY_LOW,
1111 .tech_load = technology_load,
1112 .tech_save = technology_save,
1115 int __connman_technology_init(void)
1119 connection = connman_dbus_get_connection();
1121 global_offlinemode = connman_technology_load_offlinemode();
1123 return connman_storage_register(&tech_storage);
1126 void __connman_technology_cleanup(void)
1130 dbus_connection_unref(connection);
1132 connman_storage_unregister(&tech_storage);