From: Marcel Holtmann Date: Wed, 21 Jan 2009 18:26:44 +0000 (+0100) Subject: Introduce global "connecting" state X-Git-Tag: 0.9~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c171d0621ec983c641525d33b6b6c8766e79cb8;p=platform%2Fupstream%2Fconnman.git Introduce global "connecting" state --- diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 5ff5f6a..1f50d94 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 5bd987b..8bdc42c 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 70fc82a..0a6a037 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); }