Added dummy scan_active_devices() and cancel_active_device_scan() accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.024840 accepted/tizen/5.5/unified/mobile/hotfix/20201027.084630 accepted/tizen/unified/20191004.003624 submit/tizen/20191002.073539 submit/tizen_5.5/20191031.000003 submit/tizen_5.5_mobile_hotfix/20201026.185103 tizen_5.5.m2_release
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 1 Oct 2019 15:49:13 +0000 (21:19 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 1 Oct 2019 23:08:48 +0000 (08:08 +0900)
Change-Id: I6df624f1048634c029d18d49f27134cb1c028826
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
packaging/ua-plugin-wifi-dummy.spec
src/wifi-plugin.c

index 87b8207..4c36255 100644 (file)
@@ -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
index 9113fe7..7e15d77 100644 (file)
@@ -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)