g_slist_foreach(dev_list, __reset_devices, NULL);
- /* TODO: stop scan */
- if (UAS_STATUS_SUCCESS != ret) {
- UA_WIFI_LOCATION_ERR("Fail to stop wifi_location scan [%d]", ret);
- return ret;
- }
+ /* stop scan */
+ ret = _wifi_location_plugin_stop_scan();
+ retv_if_with_log(UAS_STATUS_SUCCESS != ret, ret, "return %d", ret);
/* Send detection stopped */
if (uas_cbs && uas_cbs->detection_state_cb) {
return ret;
}
+static int stop_detection(unsigned int detection_type)
+{
+ FUNC_ENTER;
+ int ret = UAS_STATUS_SUCCESS;
+
+ retv_if(NULL == uas_cbs, UAS_STATUS_NOT_READY);
+ retv_if(0 == (wifi_location_detection_type & detection_type),
+ UAS_STATUS_ALREADY_DONE);
+
+ /* Stop detection */
+ ret = __stop_scan();
+ retv_if_with_log(UAS_STATUS_SUCCESS != ret, ret, "return %d", ret);
+
+ wifi_location_detection_type &= ~detection_type;
+ UA_WIFI_LOCATION_INFO_C("wifi_location_detection_type = 0x%8.8X",
+ wifi_location_detection_type);
+ if (0 != wifi_location_detection_type)
+ goto done;
+
+ /* Remove stop scan timer */
+ if (0 < stop_scan_timer) {
+ g_source_remove(stop_scan_timer);
+ stop_scan_timer = 0;
+ UA_WIFI_LOCATION_INFO("Stop scan timer removed");
+ }
+
+done:
+ FUNC_EXIT;
+ return ret;
+}
+
static uas_api_t wifi_location_api = {
.init = init,
.deinit = deinit,
.add_device = NULL,
.remove_device = NULL,
.start_detection = start_detection,
- .stop_detection = NULL,
+ .stop_detection = stop_detection,
.set_low_power_mode = NULL,
.set_detection_window = NULL,
.set_detection_threshold = NULL,