technology: Remove 'available' state
authorAlok Barsode <alok.barsode@linux.intel.com>
Wed, 24 Aug 2011 13:44:15 +0000 (16:44 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 25 Aug 2011 09:14:22 +0000 (11:14 +0200)
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
src/technology.c

index c86a58e..12b421c 100644 (file)
@@ -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]
 
index 19a096d..4d8eb03 100644 (file)
@@ -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);
        }