summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-01-07 11:42:40 -0800
committerMarcel Holtmann <marcel@holtmann.org>2010-01-07 11:42:40 -0800
commit04c0be97d5b59ca4c1c0fcc626584e04b3e0f480 (patch)
tree6039594f58c18373b878999dc7d0f1a1e61427b9
parent329c7954b9f166033fb8b7689b670eb76b9066f5 (diff)
downloadconnman-04c0be97d5b59ca4c1c0fcc626584e04b3e0f480.tar.gz
connman-04c0be97d5b59ca4c1c0fcc626584e04b3e0f480.tar.bz2
connman-04c0be97d5b59ca4c1c0fcc626584e04b3e0f480.zip
Add support for setting immutable flag from configurations
-rw-r--r--include/service.h3
-rw-r--r--src/config.c3
-rw-r--r--src/connman.h4
-rw-r--r--src/service.c37
4 files changed, 40 insertions, 7 deletions
diff --git a/include/service.h b/include/service.h
index 3368ba05..3c345fa2 100644
--- a/include/service.h
+++ b/include/service.h
@@ -92,9 +92,6 @@ void connman_service_unref(struct connman_service *service);
enum connman_service_type connman_service_get_type(struct connman_service *service);
char *connman_service_get_interface(struct connman_service *service);
-int connman_service_set_favorite(struct connman_service *service,
- connman_bool_t favorite);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/config.c b/src/config.c
index 274d9c2c..4b6e3efe 100644
--- a/src/config.c
+++ b/src/config.c
@@ -392,6 +392,9 @@ static void provision_service(gpointer key, gpointer value, gpointer user_data)
if (memcmp(config->ssid, ssid, ssid_len) != 0)
return;
+ __connman_service_set_immutable(service, TRUE);
+ __connman_service_set_favorite(service, TRUE);
+
if (config->eap)
__connman_service_set_string(service, "EAP", config->eap);
diff --git a/src/connman.h b/src/connman.h
index cc3bd08f..a6619df6 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -374,6 +374,10 @@ void __connman_service_remove_from_network(struct connman_network *network);
const char *__connman_service_get_path(struct connman_service *service);
unsigned int __connman_service_get_order(struct connman_service *service);
struct connman_network *__connman_service_get_network(struct connman_service *service);
+int __connman_service_set_favorite(struct connman_service *service,
+ connman_bool_t favorite);
+int __connman_service_set_immutable(struct connman_service *service,
+ connman_bool_t immutable);
void __connman_service_set_string(struct connman_service *service,
const char *key, const char *value);
diff --git a/src/service.c b/src/service.c
index b4f8a4e8..24133d69 100644
--- a/src/service.c
+++ b/src/service.c
@@ -314,13 +314,29 @@ static void strength_changed(struct connman_service *service)
static void favorite_changed(struct connman_service *service)
{
+ if (service->path == NULL)
+ return;
+
connman_dbus_property_changed_basic(service->path,
CONNMAN_SERVICE_INTERFACE, "Favorite",
DBUS_TYPE_BOOLEAN, &service->favorite);
}
+static void immutable_changed(struct connman_service *service)
+{
+ if (service->path == NULL)
+ return;
+
+ connman_dbus_property_changed_basic(service->path,
+ CONNMAN_SERVICE_INTERFACE, "Immutable",
+ DBUS_TYPE_BOOLEAN, &service->immutable);
+}
+
static void roaming_changed(struct connman_service *service)
{
+ if (service->path == NULL)
+ return;
+
connman_dbus_property_changed_basic(service->path,
CONNMAN_SERVICE_INTERFACE, "Roaming",
DBUS_TYPE_BOOLEAN, &service->roaming);
@@ -328,6 +344,9 @@ static void roaming_changed(struct connman_service *service)
static void autoconnect_changed(struct connman_service *service)
{
+ if (service->path == NULL)
+ return;
+
connman_dbus_property_changed_basic(service->path,
CONNMAN_SERVICE_INTERFACE, "AutoConnect",
DBUS_TYPE_BOOLEAN, &service->autoconnect);
@@ -1097,7 +1116,7 @@ static DBusMessage *remove_service(DBusConnection *conn,
set_idle(service);
- connman_service_set_favorite(service, FALSE);
+ __connman_service_set_favorite(service, FALSE);
__connman_storage_save_service(service);
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
@@ -1426,13 +1445,13 @@ __connman_service_get_network(struct connman_service *service)
}
/**
- * connman_service_set_favorite:
+ * __connman_service_set_favorite:
* @service: service structure
* @favorite: favorite value
*
* Change the favorite setting of service
*/
-int connman_service_set_favorite(struct connman_service *service,
+int __connman_service_set_favorite(struct connman_service *service,
connman_bool_t favorite)
{
GSequenceIter *iter;
@@ -1455,6 +1474,16 @@ int connman_service_set_favorite(struct connman_service *service,
return 0;
}
+int __connman_service_set_immutable(struct connman_service *service,
+ connman_bool_t immutable)
+{
+ service->immutable = immutable;
+
+ immutable_changed(service);
+
+ return 0;
+}
+
void __connman_service_set_string(struct connman_service *service,
const char *key, const char *value)
{
@@ -1533,7 +1562,7 @@ int __connman_service_indicate_state(struct connman_service *service,
if (state == CONNMAN_SERVICE_STATE_READY) {
set_reconnect_state(service, TRUE);
- connman_service_set_favorite(service, TRUE);
+ __connman_service_set_favorite(service, TRUE);
reply_pending(service, 0);