summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-07-19 20:46:34 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2009-07-19 20:46:34 (GMT)
commit3ef1a65b1731e261587529d3ec297ce1e15dd9b9 (patch)
tree23d57e7bc333b22fd8a62ed07551529a73d14071
parente5884a7a2ee413798e41825a3665dd48d2331f3b (diff)
downloadconnman-3ef1a65b1731e261587529d3ec297ce1e15dd9b9.zip
connman-3ef1a65b1731e261587529d3ec297ce1e15dd9b9.tar.gz
connman-3ef1a65b1731e261587529d3ec297ce1e15dd9b9.tar.bz2
Send signal when default technology changes
-rw-r--r--src/service.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index 923a958..3aa7a5b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -983,6 +983,30 @@ int __connman_service_set_carrier(struct connman_service *service,
return connman_service_set_favorite(service, carrier);
}
+static void default_changed(void)
+{
+ DBusMessage *signal;
+ DBusMessageIter entry, value;
+ const char *key = "DefaultTechnology";
+ const char *str = __connman_service_default();
+
+ signal = dbus_message_new_signal(CONNMAN_MANAGER_PATH,
+ CONNMAN_MANAGER_INTERFACE, "PropertyChanged");
+ if (signal == NULL)
+ return;
+
+ dbus_message_iter_init_append(signal, &entry);
+
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
+
+ dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_STRING_AS_STRING, &value);
+ dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &str);
+ dbus_message_iter_close_container(&entry, &value);
+
+ g_dbus_send_message(connection, signal);
+}
+
int __connman_service_indicate_state(struct connman_service *service,
enum connman_service_state state)
{
@@ -999,6 +1023,9 @@ int __connman_service_indicate_state(struct connman_service *service,
if (service->state == state)
return -EALREADY;
+ if (service->state == CONNMAN_SERVICE_STATE_READY)
+ default_changed();
+
if (service->state == CONNMAN_SERVICE_STATE_FAILURE &&
state == CONNMAN_SERVICE_STATE_IDLE)
return -EINVAL;
@@ -1066,6 +1093,8 @@ int __connman_service_indicate_default(struct connman_service *service)
{
DBG("service %p", service);
+ default_changed();
+
return 0;
}