diff options
-rw-r--r-- | doc/manager-api.txt | 4 | ||||
-rw-r--r-- | include/element.h | 1 | ||||
-rw-r--r-- | src/element.c | 23 |
3 files changed, 27 insertions, 1 deletions
diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 5ff5f6a8..1f50d944 100644 --- a/doc/manager-api.txt +++ b/doc/manager-api.txt @@ -45,6 +45,10 @@ Properties string State [readonly] values are "online" if at least one connection exists and "offline" if no device is connected. + In certain situations the state might change to + the value "connected". This can only be seen if + previously no connection was present. + string Policy [readwrite] The global connection policy of a system. This diff --git a/include/element.h b/include/element.h index 5bd987b3..8bdc42c4 100644 --- a/include/element.h +++ b/include/element.h @@ -64,6 +64,7 @@ struct connman_element { gchar *path; enum connman_element_type type; gboolean enabled; + gboolean configuring; gchar *devname; struct connman_element *parent; diff --git a/src/element.c b/src/element.c index 70fc82a8..0a6a0378 100644 --- a/src/element.c +++ b/src/element.c @@ -436,6 +436,8 @@ void __connman_element_initialize(struct connman_element *element) element->index = -1; element->enabled = FALSE; + element->configuring = FALSE; + element->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, unregister_property); } @@ -988,9 +990,27 @@ static void register_element(gpointer data, gpointer user_data) g_node_append_data(node, element); + if (element->type == CONNMAN_ELEMENT_TYPE_DHCP) { + element->parent->configuring = TRUE; + + if (__connman_element_count(NULL, + CONNMAN_ELEMENT_TYPE_CONNECTION) == 0) + emit_state_change(connection, "connecting"); + } + if (element->type == CONNMAN_ELEMENT_TYPE_CONNECTION) { + struct connman_element *parent = element->parent; + + while (parent) { + parent->configuring = FALSE; + parent = parent->parent; + } + emit_connections_signal(connection); - emit_state_change(connection, "online"); + + if (__connman_element_count(NULL, + CONNMAN_ELEMENT_TYPE_CONNECTION) == 1) + emit_state_change(connection, "online"); } emit_element_signal(connection, "ElementAdded", element); @@ -1082,6 +1102,7 @@ static gboolean remove_element(GNode *node, gpointer user_data) if (__connman_element_count(NULL, CONNMAN_ELEMENT_TYPE_CONNECTION) == 0) emit_state_change(connection, "offline"); + emit_connections_signal(connection); } |