diff options
author | taesub kim <taesub.kim@samsung.com> | 2017-09-14 09:36:09 +0900 |
---|---|---|
committer | taesub kim <taesub.kim@samsung.com> | 2017-09-19 18:22:09 +0900 |
commit | d5e8933d82e924d55d1a65987385ba81043dfc5e (patch) | |
tree | 093a375ce555b5dfe14b2c2a2ecb4c254ab15548 /src | |
parent | 974ea0024e6000dc3aa9c51aa32b66f216ec2314 (diff) | |
download | connman-d5e8933d82e924d55d1a65987385ba81043dfc5e.tar.gz connman-d5e8933d82e924d55d1a65987385ba81043dfc5e.tar.bz2 connman-d5e8933d82e924d55d1a65987385ba81043dfc5e.zip |
Add APIs to set/get auto connection mode
Change-Id: I34e42d98ab540ffb75e0ae860fb1b615ef2bddcb
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/connman.h | 6 | ||||
-rwxr-xr-x | src/manager.c | 23 | ||||
-rwxr-xr-x | src/service.c | 26 |
3 files changed, 54 insertions, 1 deletions
diff --git a/src/connman.h b/src/connman.h index 5e257bf6..658a239b 100755 --- a/src/connman.h +++ b/src/connman.h @@ -764,6 +764,12 @@ int __connman_service_disconnect(struct connman_service *service); int __connman_service_disconnect_all(void); void __connman_service_set_active_session(bool enable, GSList *list); void __connman_service_auto_connect(enum connman_service_connect_reason reason); + +#if defined TIZEN_EXT +bool __connman_service_get_auto_connect_mode(void); +void __connman_service_set_auto_connect_mode(bool enable); +#endif + bool __connman_service_remove(struct connman_service *service); bool __connman_service_is_provider_pending(struct connman_service *service); void __connman_service_set_provider_pending(struct connman_service *service, diff --git a/src/manager.c b/src/manager.c index 622ed59c..befc3733 100755 --- a/src/manager.c +++ b/src/manager.c @@ -65,6 +65,9 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessageIter array, dict; dbus_bool_t offlinemode; const char *str; +#if defined TIZEN_EXT + dbus_bool_t autoconnectmode; +#endif DBG("conn %p", conn); @@ -87,6 +90,12 @@ static DBusMessage *get_properties(DBusConnection *conn, connman_dbus_dict_append_basic(&dict, "SessionMode", DBUS_TYPE_BOOLEAN, &sessionmode); +#if defined TIZEN_EXT + autoconnectmode = __connman_service_get_auto_connect_mode(); + connman_dbus_dict_append_basic(&dict, "AutoConnectMode", + DBUS_TYPE_BOOLEAN, + &autoconnectmode); +#endif connman_dbus_dict_close(&array, &dict); @@ -147,8 +156,20 @@ static DBusMessage *set_property(DBusConnection *conn, return __connman_error_invalid_arguments(msg); dbus_message_iter_get_basic(&value, &sessionmode); + } +#if defined TIZEN_EXT + else if (g_str_equal(name, "AutoConnectMode") == TRUE) { + bool automode; - } else + if (type != DBUS_TYPE_BOOLEAN) + return __connman_error_invalid_arguments(msg); + + dbus_message_iter_get_basic(&value, &automode); + + __connman_service_set_auto_connect_mode(automode); + } +#endif + else return __connman_error_invalid_property(msg); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); diff --git a/src/service.c b/src/service.c index 4497b392..ee4ef82e 100755 --- a/src/service.c +++ b/src/service.c @@ -58,6 +58,10 @@ static unsigned int vpn_autoconnect_timeout = 0; static struct connman_service *current_default = NULL; static bool services_dirty = false; +#if defined TIZEN_EXT +static bool auto_connect_mode = TRUE; +#endif + struct connman_stats { bool valid; bool enabled; @@ -4962,6 +4966,21 @@ static gboolean run_auto_connect(gpointer data) return FALSE; } +#if defined TIZEN_EXT +bool __connman_service_get_auto_connect_mode(void) +{ + return auto_connect_mode; +} + +void __connman_service_set_auto_connect_mode(bool enable) +{ + DBG("set auto_connect_mode = %d", enable); + + if (auto_connect_mode != enable) + auto_connect_mode = enable; +} +#endif + void __connman_service_auto_connect(enum connman_service_connect_reason reason) { DBG(""); @@ -4969,6 +4988,13 @@ void __connman_service_auto_connect(enum connman_service_connect_reason reason) if (autoconnect_timeout != 0) return; +#if defined TIZEN_EXT + if (auto_connect_mode == FALSE) { + DBG("Currently, not auto connection mode"); + return; + } +#endif + if (!__connman_session_policy_autoconnect(reason)) return; |