diff options
author | Nishant Chaprana <n.chaprana@samsung.com> | 2019-10-01 21:19:13 +0530 |
---|---|---|
committer | saerome.kim <saerome.kim@samsung.com> | 2019-10-02 08:08:48 +0900 |
commit | 7c80cedb7f8214b60b38d040c32646c8fc3a8207 (patch) | |
tree | 309d82853498fb9457bec2caceed70be4d8c72a8 | |
parent | 8d83fc32f819aa585ac4100d4a5d23cb5d54d00f (diff) | |
download | ua-plugin-wifi-dummy-submit/tizen_5.5/20191031.000003.tar.gz ua-plugin-wifi-dummy-submit/tizen_5.5/20191031.000003.tar.bz2 ua-plugin-wifi-dummy-submit/tizen_5.5/20191031.000003.zip |
Added dummy scan_active_devices() and cancel_active_device_scan()tizen_5.5.m2_releasesubmit/tizen_5.5_mobile_hotfix/20201026.185103submit/tizen_5.5/20191031.000003submit/tizen/20191002.073539accepted/tizen/unified/20191004.003624accepted/tizen/5.5/unified/mobile/hotfix/20201027.084630accepted/tizen/5.5/unified/20191031.024840tizen_5.5_mobile_hotfixaccepted/tizen_5.5_unified_mobile_hotfix
Change-Id: I6df624f1048634c029d18d49f27134cb1c028826
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
-rw-r--r-- | packaging/ua-plugin-wifi-dummy.spec | 2 | ||||
-rw-r--r-- | src/wifi-plugin.c | 51 |
2 files changed, 50 insertions, 3 deletions
diff --git a/packaging/ua-plugin-wifi-dummy.spec b/packaging/ua-plugin-wifi-dummy.spec index 87b8207..4c36255 100644 --- a/packaging/ua-plugin-wifi-dummy.spec +++ b/packaging/ua-plugin-wifi-dummy.spec @@ -3,7 +3,7 @@ Name: ua-plugin-wifi-dummy Summary: Wi-Fi User awareness plugin for VD -Version: 0.10.0 +Version: 0.10.1 Release: 1 License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/wifi-plugin.c b/src/wifi-plugin.c index 9113fe7..7e15d77 100644 --- a/src/wifi-plugin.c +++ b/src/wifi-plugin.c @@ -43,6 +43,8 @@ static uas_state_e curr_state = UAS_STATE_NOT_READY; /**< Plugin state */ static GSList *dev_list = NULL; /**< Device lists */ static unsigned int detect_count; static int wifi_detection_type = 0; +int is_scan_running; +guint stop_active_scan_timer; static int init(const uas_callbacks_t *callbacks) { @@ -521,6 +523,51 @@ static int set_detection_threshold(int presence_threshold, int absence_threshold return UAS_STATUS_UNSUPPORTED; } +static gboolean stop_active_scan(gpointer user_data) +{ + FUNC_ENTER; + if (!stop_active_scan_timer) + return G_SOURCE_REMOVE; + + stop_active_scan_timer = 0; + + if (!uas_cbs || !uas_cbs->active_scan_cb) + return G_SOURCE_REMOVE; + + uas_cbs->active_scan_cb(UAS_ACTIVE_SCAN_COMPLETED, NULL); + FUNC_EXIT; + return G_SOURCE_REMOVE; +} + +static int scan_active_devices(int detection_period) +{ + FUNC_ENTER; + int ret = UAS_STATUS_SUCCESS; + int stop_time; + + UA_WIFI_INFO("Detection period = [%d]", detection_period); + + retv_if(detection_period < 0, UAS_STATUS_FAIL); + retv_if(0 != is_scan_running, UAS_STATUS_ALREADY_DONE); + + is_scan_running = 1; + + stop_time = detection_period*1000; + stop_active_scan_timer = g_timeout_add(stop_time, stop_active_scan, NULL); + FUNC_EXIT; + return ret; +} + +static int cancel_active_device_scan(void) +{ + FUNC_ENTER; + is_scan_running = 0; + stop_active_scan(NULL); + + FUNC_EXIT; + return UAS_STATUS_SUCCESS; +} + static uas_api_t wifi_api = { .init = init, .deinit = deinit, @@ -534,8 +581,8 @@ static uas_api_t wifi_api = { .set_low_power_mode = set_low_power_mode, .set_detection_window = set_detection_window, .set_detection_threshold = set_detection_threshold, - .scan_active_devices = NULL, - .cancel_active_device_scan = NULL + .scan_active_devices = scan_active_devices, + .cancel_active_device_scan = cancel_active_device_scan }; static int module_init(uas_api_t **api) |