str = type2string(type);
if (str != NULL)
- connman_element_add_static_property(&network->element,
+ connman_element_set_static_property(&network->element,
"Type", DBUS_TYPE_STRING, &str);
- connman_element_add_static_property(&network->element,
+ connman_element_set_static_property(&network->element,
"Strength", DBUS_TYPE_BYTE, &strength);
network->type = type;
if (network->registered == FALSE)
return 0;
- if (network->connected == FALSE && network->remember == FALSE)
+ if (network->connected == TRUE)
+ return 0;
+
+ if (network->remember == FALSE)
return 0;
signal = dbus_message_new_signal(network->element.path,
__connman_device_increase_connections(network->device);
+ __connman_device_set_network(network->device, network);
+
element = connman_element_create(NULL);
if (element != NULL) {
element->type = type;
} else {
connman_element_unregister_children(&network->element);
+ __connman_device_set_network(network->device, NULL);
+
__connman_device_decrease_connections(network->device);
}
if (val > 0)
network->priority = val;
- if (network->remember == TRUE) {
- g_free(network->wifi.security);
- network->wifi.security = g_key_file_get_string(keyfile,
+ g_free(network->wifi.security);
+ network->wifi.security = g_key_file_get_string(keyfile,
network->identifier, "WiFi.Security", NULL);
- g_free(network->wifi.passphrase);
- network->wifi.passphrase = g_key_file_get_string(keyfile,
+ g_free(network->wifi.passphrase);
+ network->wifi.passphrase = g_key_file_get_string(keyfile,
network->identifier, "WiFi.Passphrase", NULL);
- }
g_key_file_free(keyfile);
g_key_file_set_integer(keyfile, network->identifier,
"Priority", network->priority);
- if (network->remember == TRUE) {
+ if (network->remember == TRUE || network->connected == TRUE) {
if (network->wifi.security != NULL)
g_key_file_set_string(keyfile, network->identifier,
"WiFi.Security", network->wifi.security);