summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-08-07 06:27:27 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-08-07 06:27:27 -0700
commit870b814aa2117c051c270bd6ed16977144ce38da (patch)
tree123ef858ba95025c423ef9d627786b270cccd641
parent4f1cb744489bcda149204bd4a65b7def26bd585f (diff)
downloadconnman-870b814aa2117c051c270bd6ed16977144ce38da.tar.gz
connman-870b814aa2117c051c270bd6ed16977144ce38da.tar.bz2
connman-870b814aa2117c051c270bd6ed16977144ce38da.zip
Add support for AutoConnect property of services
-rw-r--r--doc/service-api.txt5
-rw-r--r--src/service.c22
2 files changed, 27 insertions, 0 deletions
diff --git a/doc/service-api.txt b/doc/service-api.txt
index 7a350eea..a1dffa57 100644
--- a/doc/service-api.txt
+++ b/doc/service-api.txt
@@ -204,6 +204,11 @@ Properties string State [readonly]
method. So for now it will be considered a read
only property.
+ boolean AutoConnect [readonly]
+
+ If set to true, this service will auto-connect
+ when not other connection is available.
+
string IPv4.Method [readwrite]
The IPv4 configuration method. Possible values here
diff --git a/src/service.c b/src/service.c
index fb95cf0b..16b6d7ef 100644
--- a/src/service.c
+++ b/src/service.c
@@ -47,6 +47,7 @@ struct connman_service {
connman_bool_t favorite;
connman_bool_t hidden;
connman_bool_t ignore;
+ connman_bool_t autoconnect;
GTimeVal modified;
unsigned int order;
char *name;
@@ -395,6 +396,9 @@ static DBusMessage *get_properties(DBusConnection *conn,
connman_dbus_dict_append_variant(&dict, "Favorite",
DBUS_TYPE_BOOLEAN, &service->favorite);
+ connman_dbus_dict_append_variant(&dict, "AutoConnect",
+ DBUS_TYPE_BOOLEAN, &service->autoconnect);
+
if (service->name != NULL)
connman_dbus_dict_append_variant(&dict, "Name",
DBUS_TYPE_STRING, &service->name);
@@ -557,6 +561,9 @@ static connman_bool_t is_connecting(struct connman_service *service)
static connman_bool_t is_ignore(struct connman_service *service)
{
+ if (service->autoconnect == FALSE)
+ return TRUE;
+
if (service->ignore == TRUE)
return TRUE;
@@ -1620,6 +1627,8 @@ struct connman_service *__connman_service_create_from_device(struct connman_devi
service->type = __connman_device_get_service_type(device);
+ service->autoconnect = FALSE;
+
service->device = device;
service_register(service);
@@ -1841,6 +1850,19 @@ struct connman_service *__connman_service_create_from_network(struct connman_net
service->type = convert_network_type(network);
+ switch (service->type) {
+ case CONNMAN_SERVICE_TYPE_UNKNOWN:
+ case CONNMAN_SERVICE_TYPE_ETHERNET:
+ case CONNMAN_SERVICE_TYPE_WIMAX:
+ case CONNMAN_SERVICE_TYPE_BLUETOOTH:
+ case CONNMAN_SERVICE_TYPE_CELLULAR:
+ service->autoconnect = FALSE;
+ break;
+ case CONNMAN_SERVICE_TYPE_WIFI:
+ service->autoconnect = TRUE;
+ break;
+ }
+
service->state = CONNMAN_SERVICE_STATE_IDLE;
update_from_network(service, network);