Chromium Code Reviews| Index: src/service.c |
| diff --git a/src/service.c b/src/service.c |
| index dd17cc9a0f871bb888164dfd4d54809471a66d30..c867f3f75a421751f96edcb328b22f3c32e88447 100644 |
| --- a/src/service.c |
| +++ b/src/service.c |
| @@ -65,6 +65,7 @@ struct connman_service { |
| char *certpath; |
| char *authpath; |
| char *profile; |
| + enum connman_service_connectivity_state connectivity_state; |
|
Eric Shienbrood
2010/11/19 17:52:56
Can you move this up to be with the other enums?
Jason Glasgow
2010/11/19 19:48:19
Done.
|
| /* TODO(sleffler) overlay storage */ |
| struct { |
| @@ -75,7 +76,6 @@ struct connman_service { |
| enum connman_network_activation_state activation_state; |
| enum connman_network_cellular_technology network_technology; |
| enum connman_network_cellular_roaming_state roaming_state; |
| - connman_bool_t restricted_pool; |
| } cellular; |
| struct { |
| unsigned int wep_key_len; |
| @@ -428,6 +428,22 @@ static const char *roaming_state2string( |
| return NULL; |
| } |
| +static const char *connectivity_state2string( |
| + enum connman_service_connectivity_state connectivity) |
| +{ |
| + switch(connectivity) { |
| + case CONNMAN_SERVICE_CONNECTIVITY_STATE_UNKNOWN: |
| + return "unknown"; |
| + case CONNMAN_SERVICE_CONNECTIVITY_STATE_UNRESTRICTED: |
| + return "unrestricted"; |
| + case CONNMAN_SERVICE_CONNECTIVITY_STATE_RESTRICTED: |
| + return "restricted"; |
| + case CONNMAN_SERVICE_CONNECTIVITY_STATE_NONE: |
| + return "none"; |
| + } |
| + return NULL; |
| +} |
| + |
| static struct connman_service *get_active_service(void) |
| { |
| struct connman_service *service; |
| @@ -669,6 +685,11 @@ static DBusMessage *get_properties(DBusConnection *conn, |
| connman_dbus_dict_append_variant(&dict, "Name", |
| DBUS_TYPE_STRING, &service->name); |
| + str = connectivity_state2string(service->connectivity_state); |
| + if (str != NULL) |
| + connman_dbus_dict_append_variant(&dict, "ConnectivityState", |
| + DBUS_TYPE_STRING, &str); |
| + |
| device = connman_service_get_device(service); |
| if (device != NULL) { |
| const char *path = connman_device_get_path(device); |
| @@ -729,9 +750,6 @@ static DBusMessage *get_properties(DBusConnection *conn, |
| "Cellular.UsageUrl", DBUS_TYPE_STRING, |
| &service->cellular.usage_url); |
| } |
| - connman_dbus_dict_append_variant(&dict, |
| - "Cellular.RestrictedPool", DBUS_TYPE_BOOLEAN, |
| - &service->cellular.restricted_pool); |
| break; |
| case CONNMAN_SERVICE_TYPE_WIFI: |
| connman_dbus_dict_append_variant(&dict, "WiFi.HiddenSSID", |
| @@ -1607,17 +1625,20 @@ void __connman_service_set_registration_info( |
| } |
| } |
| -void connman_service_set_restricted_pool(struct connman_service *service, |
| - connman_bool_t restricted) |
| +void connman_service_set_connectivity_state(struct connman_service *service, |
| + enum connman_service_connectivity_state connectivity) |
| { |
| - connman_bool_t orestricted = service->cellular.restricted_pool; |
| - service->cellular.restricted_pool = restricted; |
| - if (orestricted != restricted) |
| + enum connman_service_connectivity_state |
| + oconnectivity = service->connectivity_state; |
| + const char *state_str = connectivity_state2string(connectivity); |
| + |
| + service->connectivity_state = connectivity; |
| + if (oconnectivity != connectivity) |
| (void) connman_dbus_send_property_changed_variant( |
| service->path, |
| CONNMAN_SERVICE_INTERFACE, |
| - "Cellular.RestrictedPool", |
| - DBUS_TYPE_BOOLEAN, &restricted); |
| + "ConnectivityState", |
|
Eric Shienbrood
2010/11/19 17:52:56
Can you update service-api.txt to document this pr
Jason Glasgow
2010/11/19 19:48:19
Thank you.
Done.
|
| + DBUS_TYPE_STRING, &state_str); |
| } |
| static void remove_timeout(struct connman_service *service) |