qcacmn: Add an API to check if scan is completed
Add a new scan util API to check if scan is completed and
if scan is success.
Change-Id: Id60056b999a7ec23df3d3458d4498d547f6ec4d9
CRs-Fixed: 2248972
diff --git a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h
index 394e4fb..2ff72e8 100644
--- a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h
+++ b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h
@@ -1467,4 +1467,16 @@
* Return: Band information as per frequency
*/
enum wlan_band util_scan_scm_freq_to_band(uint16_t freq);
+
+/**
+ * util_is_scan_completed() - function to get scan complete status
+ * @event: scan event
+ * @success: true if scan complete success, false otherwise
+ *
+ * API, function to get the scan result
+ *
+ * Return: true if scan complete, false otherwise
+ */
+bool util_is_scan_completed(struct scan_event *event, bool *success);
+
#endif
diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
index 4e129f1..024d8ce 100644
--- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c
+++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
@@ -987,3 +987,22 @@
return scm_update_scan_mlme_info(pdev, scan_entry);
}
+
+bool util_is_scan_completed(struct scan_event *event, bool *success)
+{
+ if ((event->type == SCAN_EVENT_TYPE_COMPLETED) ||
+ (event->type == SCAN_EVENT_TYPE_DEQUEUED) ||
+ (event->type == SCAN_EVENT_TYPE_START_FAILED)) {
+ if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
+ (event->reason == SCAN_REASON_COMPLETED))
+ *success = true;
+ else
+ *success = false;
+
+ return true;
+ }
+
+ *success = false;
+ return false;
+}
+