From afe64c7ea9931f2442a464cb5c7d5bcd47e98560 Mon Sep 17 00:00:00 2001 From: Alok Barsode Date: Wed, 24 Aug 2011 16:44:15 +0300 Subject: [PATCH] technology: Remove 'available' state The connman technology state machine is simplified. It now has 3 states: Offline: Technology is disabled. Enabled: Technology is enabled. Connected: Technology is connected. --- doc/technology-api.txt | 3 +-- src/technology.c | 21 +++++---------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/doc/technology-api.txt b/doc/technology-api.txt index c86a58e..12b421c 100644 --- a/doc/technology-api.txt +++ b/doc/technology-api.txt @@ -21,8 +21,7 @@ Properties string State [readonly] The technology state information. - Valid states are "offline", "available", "enabled" - and "connected". + Valid states are "offline", "enabled" and "connected". string Name [readonly] diff --git a/src/technology.c b/src/technology.c index 19a096d..4d8eb03 100644 --- a/src/technology.c +++ b/src/technology.c @@ -44,9 +44,8 @@ struct connman_rfkill { enum connman_technology_state { CONNMAN_TECHNOLOGY_STATE_UNKNOWN = 0, CONNMAN_TECHNOLOGY_STATE_OFFLINE = 1, - CONNMAN_TECHNOLOGY_STATE_AVAILABLE = 2, - CONNMAN_TECHNOLOGY_STATE_ENABLED = 3, - CONNMAN_TECHNOLOGY_STATE_CONNECTED = 4, + CONNMAN_TECHNOLOGY_STATE_ENABLED = 2, + CONNMAN_TECHNOLOGY_STATE_CONNECTED = 3, }; struct connman_technology { @@ -256,8 +255,6 @@ static const char *state2string(enum connman_technology_state state) break; case CONNMAN_TECHNOLOGY_STATE_OFFLINE: return "offline"; - case CONNMAN_TECHNOLOGY_STATE_AVAILABLE: - return "available"; case CONNMAN_TECHNOLOGY_STATE_ENABLED: return "enabled"; case CONNMAN_TECHNOLOGY_STATE_CONNECTED: @@ -634,10 +631,6 @@ int __connman_technology_add_device(struct connman_device *device) if (g_atomic_int_get(&technology->blocked)) goto done; - technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE; - - state_changed(technology); - done: technology->device_list = g_slist_append(technology->device_list, @@ -797,8 +790,7 @@ int __connman_technology_disabled(enum connman_service_type type) if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) { __connman_notifier_disable(type); - - technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE; + technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE; state_changed(technology); } @@ -809,9 +801,6 @@ int __connman_technology_disabled(enum connman_service_type type) return 0; } - technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE; - state_changed(technology); - return 0; } @@ -992,7 +981,7 @@ int __connman_technology_update_rfkill(unsigned int index, return 0; technology_blocked(technology, blocked); - technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE; + technology->state = CONNMAN_TECHNOLOGY_STATE_ENABLED; state_changed(technology); } @@ -1023,7 +1012,7 @@ int __connman_technology_remove_rfkill(unsigned int index, if (blocked && g_atomic_int_dec_and_test(&technology->blocked) == TRUE) { technology_blocked(technology, FALSE); - technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE; + technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE; state_changed(technology); } -- 2.7.4