diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-04-21 05:17:41 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-04-21 05:17:41 +0100 |
commit | bae941e82a41fba45364ec3fa3dff6221f086e46 (patch) | |
tree | 9b783e070c3a97b2747a3fc8037391fc16af36cc /src | |
parent | 90406cff092e149ef835d684e5d4d445687a2e01 (diff) | |
download | connman-bae941e82a41fba45364ec3fa3dff6221f086e46.tar.gz connman-bae941e82a41fba45364ec3fa3dff6221f086e46.tar.bz2 connman-bae941e82a41fba45364ec3fa3dff6221f086e46.zip |
Add basic handling of configuration state
Diffstat (limited to 'src')
-rw-r--r-- | src/connman.h | 3 | ||||
-rw-r--r-- | src/device.c | 7 | ||||
-rw-r--r-- | src/profile.c | 14 | ||||
-rw-r--r-- | src/service.c | 13 |
4 files changed, 20 insertions, 17 deletions
diff --git a/src/connman.h b/src/connman.h index d66e0cf7..f370e0d0 100644 --- a/src/connman.h +++ b/src/connman.h @@ -190,8 +190,6 @@ int __connman_device_set_offlinemode(connman_bool_t offlinemode); int __connman_profile_add_device(struct connman_device *device); int __connman_profile_remove_device(struct connman_device *device); -int __connman_profile_set_carrier(struct connman_device *device, - connman_bool_t carrier); #include <connman/network.h> @@ -226,6 +224,7 @@ struct connman_service *__connman_service_create_from_network(struct connman_net int __connman_service_set_carrier(struct connman_service *service, connman_bool_t carrier); +int __connman_service_indicate_configuration(struct connman_service *service); #include <connman/notifier.h> diff --git a/src/device.c b/src/device.c index b5d7cd66..b0210b0c 100644 --- a/src/device.c +++ b/src/device.c @@ -161,7 +161,10 @@ static enum connman_device_policy string2policy(const char *policy) static int set_carrier(struct connman_device *device, connman_bool_t carrier) { - __connman_profile_set_carrier(device, carrier); + struct connman_service *service; + + service = __connman_service_lookup_from_device(device); + __connman_service_set_carrier(service, carrier); if (carrier == TRUE) { enum connman_element_type type = CONNMAN_ELEMENT_TYPE_UNKNOWN; @@ -187,6 +190,8 @@ static int set_carrier(struct connman_device *device, connman_bool_t carrier) if (connman_element_register(element, &device->element) < 0) connman_element_unref(element); + + __connman_service_indicate_configuration(service); } } else connman_element_unregister_children(&device->element); diff --git a/src/profile.c b/src/profile.c index cad8a359..f12bdb84 100644 --- a/src/profile.c +++ b/src/profile.c @@ -111,20 +111,6 @@ int __connman_profile_remove_device(struct connman_device *device) return 0; } -int __connman_profile_set_carrier(struct connman_device *device, - connman_bool_t carrier) -{ - struct connman_service *service; - - DBG("device %p carrier %d", device, carrier); - - service = __connman_service_lookup_from_device(device); - if (service == NULL) - return -EINVAL; - - return __connman_service_set_carrier(service, carrier); -} - int __connman_profile_add_network(struct connman_network *network) { struct connman_service *service; diff --git a/src/service.c b/src/service.c index 084ffb03..7b765c26 100644 --- a/src/service.c +++ b/src/service.c @@ -434,6 +434,9 @@ int connman_service_set_favorite(struct connman_service *service, int __connman_service_set_carrier(struct connman_service *service, connman_bool_t carrier) { + if (service == NULL) + return -EINVAL; + switch (service->type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: case CONNMAN_SERVICE_TYPE_WIFI: @@ -451,6 +454,16 @@ int __connman_service_set_carrier(struct connman_service *service, return connman_service_set_favorite(service, carrier); } +int __connman_service_indicate_configuration(struct connman_service *service) +{ + if (service == NULL) + return -EINVAL; + + service->state = CONNMAN_SERVICE_STATE_CONFIGURATION; + + return 0; +} + /** * connman_service_lookup: * @identifier: service identifier |