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)
{
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,
.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)