diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2019-09-10 08:11:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2019-09-10 08:11:13 +0000 |
commit | 9e3beb21876b6e63bd8acf53e751480d7a1cc16f (patch) | |
tree | 8bff00b6b73556b99e0071e0dd2c3fc028fe5d5b | |
parent | 447d2492cd8e11a077f9c5bbb3e8cdc981c88090 (diff) | |
parent | 55c73c5d731572b1c92894ac57150555b7e61216 (diff) | |
download | connman-9e3beb21876b6e63bd8acf53e751480d7a1cc16f.tar.gz connman-9e3beb21876b6e63bd8acf53e751480d7a1cc16f.tar.bz2 connman-9e3beb21876b6e63bd8acf53e751480d7a1cc16f.zip |
Merge "Emit Service PropertyChanged when ConnectReason and DisconnectionRequested changes" into tizensubmit/tizen/20190910.081214accepted/tizen/unified/20190911.111656
-rw-r--r-- | include/service.h | 3 | ||||
-rw-r--r-- | packaging/connman.spec | 2 | ||||
-rwxr-xr-x | src/network.c | 4 | ||||
-rw-r--r-- | src/service.c | 59 |
4 files changed, 65 insertions, 3 deletions
diff --git a/include/service.h b/include/service.h index a5ee5ef8..f4f4ea27 100644 --- a/include/service.h +++ b/include/service.h @@ -187,6 +187,9 @@ struct connman_service *connman_service_get_default_connection(void); */ int connman_service_set_proxy(struct connman_service *service, const char *proxy, gboolean active); + +void connman_service_set_disconnection_requested(struct connman_service *service, + bool disconnection_requested); #endif #ifdef __cplusplus diff --git a/packaging/connman.spec b/packaging/connman.spec index 080b4655..7ce64655 100644 --- a/packaging/connman.spec +++ b/packaging/connman.spec @@ -5,7 +5,7 @@ Name: connman Version: 1.35 -Release: 32 +Release: 33 License: GPL-2.0+ Summary: Connection Manager Url: http://connman.net diff --git a/src/network.c b/src/network.c index 9e5d9619..fc57dcc8 100755 --- a/src/network.c +++ b/src/network.c @@ -1705,6 +1705,8 @@ int __connman_network_connect(struct connman_network *network) __connman_device_disconnect(network->device); #if defined TIZEN_EXT DBG("ConnMan, Connect Request [%s]", network->name); + struct connman_service *service = connman_service_lookup_from_network(network); + connman_service_set_disconnection_requested(service, false); #endif err = network->driver->connect(network); if (err < 0) { @@ -1746,6 +1748,8 @@ int __connman_network_disconnect(struct connman_network *network) network->connecting = false; #if defined TIZEN_EXT DBG("ConnMan, Disconnect request"); + struct connman_service *service = connman_service_lookup_from_network(network); + connman_service_set_disconnection_requested(service, true); #endif if (network->driver->disconnect) err = network->driver->disconnect(network); diff --git a/src/service.c b/src/service.c index d72316db..47c828d8 100644 --- a/src/service.c +++ b/src/service.c @@ -171,8 +171,11 @@ struct connman_service { * Only for EAP-FAST */ char *phase1; -#endif -#ifdef TIZEN_EXT + /* + * Description: To indicate that disconnection triggered by user. + */ + bool disconnection_requested; + enum connman_dnsconfig_method dns_config_method_ipv4; enum connman_dnsconfig_method dns_config_method_ipv6; #endif @@ -2299,6 +2302,51 @@ static void state_changed(struct connman_service *service) DBUS_TYPE_STRING, &str); } +#if defined TIZEN_EXT +static void connect_reason_changed(struct connman_service *service) +{ + if (!service->path) + return; + + if (!allow_property_changed(service)) + return; + + connman_dbus_property_changed_basic(service->path, + CONNMAN_SERVICE_INTERFACE, + "ConnectReason", + DBUS_TYPE_INT32, + &service->connect_reason); +} + +static void disconnection_requested_changed(struct connman_service *service) +{ + dbus_bool_t disconnection_requested; + + if (!service->path) + return; + + if (!allow_property_changed(service)) + return; + + disconnection_requested = service->disconnection_requested; + connman_dbus_property_changed_basic(service->path, + CONNMAN_SERVICE_INTERFACE, + "DisconnectionRequested", + DBUS_TYPE_BOOLEAN, + &disconnection_requested); +} + +void connman_service_set_disconnection_requested(struct connman_service *service, + bool disconnection_requested) +{ + if (service == NULL) + return; + + service->disconnection_requested = disconnection_requested; + disconnection_requested_changed(service); +} +#endif + static void strength_changed(struct connman_service *service) { if (service->strength == 0) @@ -5585,6 +5633,9 @@ static DBusMessage *connect_service(DBusConnection *conn, /*Reset the association status code while issue connect request*/ service->assoc_status_code = 0; + + /* Reset the disconnection_requested while issue connect request*/ + connman_service_set_disconnection_requested(service, false); #endif if (service->pending) @@ -6413,6 +6464,7 @@ static void service_initialize(struct connman_service *service) service->wps = false; #if defined TIZEN_EXT + service->disconnection_requested = false; service->storage_reload = false; /* * Description: TIZEN implements system global connection management. @@ -8390,6 +8442,9 @@ int __connman_service_connect(struct connman_service *service, DBG("service %p err %d", service, err); service->connect_reason = reason; +#if defined TIZEN_EXT + connect_reason_changed(service); +#endif if (err >= 0) return 0; |