[Feature][ZXW-257]wifi 5g Settings and sta callback Settings added

    Only Configure :No
    Affected branch: master
    Affected module: wifi
    Is it affected on both ZXIC and MTK:only ZXIC
    Self-test: Yes
    Doc Update: Yes

Change-Id: I7b007bc8c9bfef2a998d12c8f9066e8cf52dc8f5
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
index 4c65350..8e60ea1 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
@@ -20,31 +20,59 @@
     printf("[lynq-wifi-demo]  %s:%d,%d,%s - %d\n", __func__, event->idx, event->ap_sta_info.connected, event->ap_sta_info.mac, event->status);
 }
 
+void lynq_wifi_event_handle_sta_demo(lynq_wifi_sta_scan_list_t *event)
+{
+    int i = 0;
+    for (i = 0; i < event->cnt; i++)
+    {
+        printf("[lynq-wifi-demo] %s : ap[%d]:%s,%d,%d,%d,%s,%d\n", __func__, i, event->info[i].essid, event->info[i].auth,
+               event->info[i].cipher, event->info[i].channel, event->info[i].bssid, event->info[i].signal_level);
+    }
+}
+
 int main(int argc, char *argv[])
 {
-	if (argc == 2 )
+    lynq_wifi_ap_index_e type;
+    if (strcmp(argv[0], "lynq-wifi-demo") == 0)
+        type = LYNQ_WIFI_AP_INDEX_AP0; // 2.4G
+    else
+        type = LYNQ_WIFI_AP_INDEX_AP1; // 5G
+    if (argc == 2)
     {
-        if(strcmp(argv[1], "0") == 0){
-            qser_wifi_enable(); //enable wifi
-            qser_wifi_ap_stop(LYNQ_WIFI_AP_INDEX_AP0); //Disable ap mode for wlan0
-            qser_wifi_disable(); //Turn off WiFi
+        if (strcmp(argv[1], "0") == 0)
+        {
+            qser_wifi_enable();      // enable wifi
+            qser_wifi_ap_stop(type); // Disable ap mode for 2.4G/5G
+            qser_wifi_disable();     // Turn off WiFi
         }
-        else if(strcmp(argv[1], "1") == 0){
+        else if (strcmp(argv[1], "1") == 0)
+        {
             char pw[65] = {0};
             sprintf(pw, "lynq123456");
-            qser_wifi_enable(); //enable wifi
-            qser_wifi_ap_ssid_set(LYNQ_WIFI_AP_INDEX_AP0,"hello"); //Set the ssid of wlan0 to hello
-            if(strcmp(argv[0], "lynq-wifi-demo") == 0)
-                qser_wifi_ap_ssid_hide_set(LYNQ_WIFI_AP_INDEX_AP0,0);
+            qser_wifi_enable(); // enable wifi
+            if (strcmp(argv[0], "lynq-wifi-demo") == 0)
+                qser_wifi_work_mode_set(LYNQ_WIFI_WORK_MODE_AP0); // Set 2.4G, and this function must be called after the qser_wifi_enable function
             else
-                qser_wifi_ap_ssid_hide_set(LYNQ_WIFI_AP_INDEX_AP0,1);
-            qser_wifi_ap_max_sta_set(LYNQ_WIFI_AP_INDEX_AP0,22); //Example Set the maximum number of connections to 22
-            qser_wifi_ap_channel_set(LYNQ_WIFI_AP_INDEX_AP0,"CN",13); //Set the country code to CN and channel to 13
-            qser_wifi_ap_mode_set(LYNQ_WIFI_AP_INDEX_AP0,LYNQ_WIFI_MODE_80211BGN); //Set the working protocol mode of wlan0 to 80211BGN
-            qser_wifi_ap_auth_set(LYNQ_WIFI_AP_INDEX_AP0,LYNQ_WIFI_AUTH_WPA2_PSK,pw); //Set the authentication of wlan0 to wpa2 and the password to lynq123456
-            qser_wifi_ap_start(LYNQ_WIFI_AP_INDEX_AP0); //Set the ap mode of wlan0
+                qser_wifi_work_mode_set(LYNQ_WIFI_WORK_MODE_AP1); // Set 5G, and this function must be called after the qser_wifi_enable function
+            qser_wifi_ap_ssid_set(type, "hello");                 // Set the ssid of 2.4G/5G to hello
+            if (strcmp(argv[0], "lynq-wifi-demo") == 0 || strcmp(argv[0], "/usr/bin/lynq-wifi-demo") == 0)
+                qser_wifi_ap_ssid_hide_set(type, 0);
+            else
+                qser_wifi_ap_ssid_hide_set(type, 1);
+            qser_wifi_ap_max_sta_set(type, 22);      // Example Set the maximum number of connections to 22
+            qser_wifi_ap_channel_set(type, "CN", 0); // Set the country code to CN and channel to 0(acs)
+            if (strcmp(argv[0], "lynq-wifi-demo") == 0)
+                qser_wifi_ap_mode_set(type, LYNQ_WIFI_MODE_80211BGNAX_2G); // Set the working protocol mode of 2.4G/5G to 80211BGN
+            else
+            {
+                qser_wifi_ap_bandwidth_set(type, LYNQ_WIFI_BANDWIDTH_HT80);
+                qser_wifi_ap_mode_set(type, LYNQ_WIFI_MODE_80211ANACAX_5G);
+            }
+            qser_wifi_ap_auth_set(type, LYNQ_WIFI_AUTH_WPA2_PSK, pw); // Set the authentication of 2.4G/5G to wpa2 and the password to lynq123456
+            qser_wifi_ap_start(type);                                 // Set the ap mode of 2.4G/5G
         }
-        else if(strcmp(argv[1], "2") == 0){
+        else if (strcmp(argv[1], "2") == 0)
+        {
             char pw[65] = {0};
             char ssid[33] = {0};
             bool hidden = 0;
@@ -54,76 +82,90 @@
             lynq_wifi_auth_e auth_mode;
             lynq_wifi_bandwidth_type_e bandwidth;
             int ret = -1;
-            qser_wifi_enable(); //enable wifi
-            ret = qser_wifi_ap_ssid_get(LYNQ_WIFI_AP_INDEX_AP0,ssid); //Gets the ssid of wlan0
-            printf("[lynq-wifi-demo]  ssid=%s ret = %d\n",ssid, ret);
-            ret = qser_wifi_ap_ssid_hide_get(LYNQ_WIFI_AP_INDEX_AP0,&hidden); //Gets whether the ssid state is hidden
-            printf("[lynq-wifi-demo]  hidden=%d ret = %d\n",hidden, ret);
-            ret = qser_wifi_ap_max_sta_get(LYNQ_WIFI_AP_INDEX_AP0,&max_sta_num); //Gets the maximum sta number for wlan0
-            printf("[lynq-wifi-demo]  max_sta_num = %d ret = %d\n",max_sta_num, ret);
-            ret = qser_wifi_ap_mode_get(LYNQ_WIFI_AP_INDEX_AP0,&mode); //Gets the working protocol mode for wlan0
-            printf("[lynq-wifi-demo]  mode = %d ret = %d\n",mode, ret);
-            ret = qser_wifi_ap_auth_get(LYNQ_WIFI_AP_INDEX_AP0,&auth_mode,pw); //Get wlan0's password security authentication and password
-            printf("[lynq-wifi-demo]  pw = %s auth_mode = %d ret = %d\n",pw, auth_mode, ret);
-            ret = qser_wifi_ap_channel_get(LYNQ_WIFI_AP_INDEX_AP0,country_code,&channel); //Get the country code and channel of wlan0
-            printf("[lynq-wifi-demo]  country_code = %s channel = %d ret = %d\n",country_code, channel, ret);
-            ret = qser_wifi_ap_bandwidth_get(LYNQ_WIFI_AP_INDEX_AP0,&bandwidth); //Gets the bandwidth of wlan0
-            printf("[lynq-wifi-demo]  bandwidth = %d ret = %d\n",bandwidth, ret);
+            qser_wifi_enable();                      // enable wifi
+            ret = qser_wifi_ap_ssid_get(type, ssid); // Gets the ssid of 2.4G/5G
+            printf("[lynq-wifi-demo]  ssid=%s ret = %d\n", ssid, ret);
+            ret = qser_wifi_ap_ssid_hide_get(type, &hidden); // Gets whether the ssid state is hidden
+            printf("[lynq-wifi-demo]  hidden=%d ret = %d\n", hidden, ret);
+            ret = qser_wifi_ap_max_sta_get(type, &max_sta_num); // Gets the maximum sta number for 2.4G/5G
+            printf("[lynq-wifi-demo]  max_sta_num = %d ret = %d\n", max_sta_num, ret);
+            ret = qser_wifi_ap_mode_get(type, &mode); // Gets the working protocol mode for 2.4G/5G
+            printf("[lynq-wifi-demo]  mode = %d ret = %d\n", mode, ret);
+            ret = qser_wifi_ap_auth_get(type, &auth_mode, pw); // Get 2.4G/5G's password security authentication and password
+            printf("[lynq-wifi-demo]  pw = %s auth_mode = %d ret = %d\n", pw, auth_mode, ret);
+            ret = qser_wifi_ap_channel_get(type, country_code, &channel); // Get the country code and channel of 2.4G/5G
+            printf("[lynq-wifi-demo]  country_code = %s channel = %d ret = %d\n", country_code, channel, ret);
+            ret = qser_wifi_ap_bandwidth_get(type, &bandwidth); // Gets the bandwidth of 2.4G/5G
+            printf("[lynq-wifi-demo]  bandwidth = %d ret = %d\n", bandwidth, ret);
         }
-        else if(strcmp(argv[1], "3") == 0){
-            qser_wifi_enable(); //enable wifi
+        else if (strcmp(argv[1], "3") == 0)
+        {
+            qser_wifi_enable(); // enable wifi
             char ssid[33] = {0};
-            qser_wifi_register_handle(lynq_wifi_event_handle_demo, (void*)ssid);
-            while(1)
+            qser_wifi_register_handle(lynq_wifi_event_handle_demo, NULL, (void *)ssid);
+            while (1)
             {
                 sleep(1);
             }
         }
-        else if(strcmp(argv[1], "4") == 0){
+        else if (strcmp(argv[1], "4") == 0)
+        {
             int ret = -1;
             char ssid[33] = {0};
-            char cmdstr[128]={0};
+            char cmdstr[128] = {0};
             lynq_wifi_sta_param_t stat = {0};
-            qser_wifi_enable(); //enable wifi
-            qser_wifi_register_handle(lynq_wifi_event_handle_demo, (void*)ssid);
-            qser_wifi_ap_start(LYNQ_WIFI_AP_INDEX_AP0); //Set the ap mode of wlan0
+            qser_wifi_enable(); // enable wifi
+            if (strcmp(argv[0], "lynq-wifi-demo") == 0)
+                qser_wifi_work_mode_set(LYNQ_WIFI_WORK_MODE_AP0); // Set 2.4G, and this function must be called after the qser_wifi_enable function
+            else
+                qser_wifi_work_mode_set(LYNQ_WIFI_WORK_MODE_AP1); // Set 5G, and this function must be called after the qser_wifi_enable function
+            qser_wifi_register_handle(NULL, lynq_wifi_event_handle_sta_demo, (void *)ssid);
+            qser_wifi_ap_start(type); // Set the ap mode of 2.4G/5G
             qser_wifi_sta_start();
-            qser_wifi_sta_start_scan();
-            memset(cmdstr,0,sizeof(cmdstr));
-		
+            qser_wifi_sta_start_scan(); // When this function is executed once, sta's scan is called once
+            memset(cmdstr, 0, sizeof(cmdstr));
+
             while (1)
             {
-                printf("[lynq-wifi-demo]Enter the ssid and password as shown in the following example:ssid auth paris pw ||sta_param_get ||sta_stop\n");
+                printf("[lynq-wifi-demo]Enter the ssid and password as shown in the following example:ssid auth paris pw ||sta_param_get || sta_scan ||sta_stop\n");
                 if (NULL != fgets(cmdstr, sizeof(cmdstr) - 1, stdin))
                 {
                     if (1 >= strlen(cmdstr))
                     {
                         continue;
                     }
-                    if(0 == strncmp(cmdstr, "sta_param_get", strlen(cmdstr) - 1))
+                    if (0 == strncmp(cmdstr, "sta_param_get", strlen(cmdstr) - 1))
                     {
                         ret = qser_wifi_sta_param_get(&stat);
                         printf("[wifi_demo]sta_param_get[%s, %d, %d, %s] ret=%d\n", stat.ssid, stat.auth, stat.pairwise, stat.passwd, ret);
                         continue;
                     }
-                    else if(0 == strncmp(cmdstr, "sta_stop", strlen(cmdstr) - 1))
+                    else if (0 == strncmp(cmdstr, "sta_scan", strlen(cmdstr) - 1))
+                    {
+                        qser_wifi_sta_start_scan(); // When this function is executed once, sta's scan is called once
+                        printf("[lynq-wifi-demo] sta_scan \n");
+                        continue;
+                    }
+                    else if (0 == strncmp(cmdstr, "sta_stop", strlen(cmdstr) - 1))
                     {
                         qser_wifi_sta_stop();
                         printf("[lynq-wifi-demo]end \n");
                         break;
                     }
-                    else{
+                    else
+                    {
                         sscanf(cmdstr, "%s %d %d %s", stat.ssid, &stat.auth, &stat.pairwise, stat.passwd);
                         ret = qser_wifi_sta_param_set(&stat);
                         printf("[lynq-wifi-demo]  qser_wifi_sta_param_set ret = %d\n", ret);
-                        if(ret == 0)
+                        if (ret == 0)
                             qser_wifi_sta_start();
-                        printf("[lynq-wifi-demo]cmdstr = %s\n",cmdstr);
-                    }                  
+                        printf("[lynq-wifi-demo]cmdstr = %s\n", cmdstr);
+                    }
                 }
             }
         }
-        else{
+        else
+        {
             printf("  [lynq-wifi-demo]Parameter error, please re-enter\n");
         }
     }
@@ -138,6 +180,5 @@
         return 0;
     }
 
-	return 0;
+    return 0;
 }
-
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
index a7ed3d5..0c3fdb5 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
@@ -15,9 +15,20 @@
 extern "C" {
 #endif
 
+#define LYNQ_WIFI_MAX_SCAN_INFO_CNT 30
+typedef enum
+{
+	LYNQ_WIFI_WORK_MODE_MIN = -1,
+	LYNQ_WIFI_WORK_MODE_AP0 = 0,  //2.4G single ap / ap+sta
+	LYNQ_WIFI_WORK_MODE_AP1,  //5G single ap / ap+sta
+	LYNQ_WIFI_WORK_MODE_MAX
+} lynq_wifi_work_mode_e;
+
 typedef enum {
-	LYNQ_WIFI_AP_INDEX_AP0 = 0,       /* Index 0 of AP/AP-STA/AP-AP Mode */
-	LYNQ_WIFI_AP_INDEX_AP1            /* Index 1 of AP/AP-STA/AP-AP Mode */
+	LYNQ_WIFI_AP_INDEX_MIN = -1,
+	LYNQ_WIFI_AP_INDEX_AP0 = 0,  //2.4G
+	LYNQ_WIFI_AP_INDEX_AP1,	 //5G
+	LYNQ_WIFI_AP_INDEX_MAX
 } lynq_wifi_ap_index_e;
 
 typedef enum
@@ -30,7 +41,9 @@
 	LYNQ_WIFI_MODE_80211AN,
 	LYNQ_WIFI_MODE_80211AC,
 	LYNQ_WIFI_MODE_80211BGNAX_2G,
-	LYNQ_WIFI_AP_MODE_MAX
+	LYNQ_WIFI_MODE_80211ANAC, //5G
+	LYNQ_WIFI_MODE_80211ANACAX_5G,
+	LYNQ_WIFI_MODE_MAX
 } lynq_wifi_mode_type_e;
 
 typedef enum LYNQ_WIFI_BANDWIDTH_ENUM
@@ -101,8 +114,26 @@
 	 char passwd[64 + 1];
  } lynq_wifi_sta_param_t;
 
-typedef void (*lynq_wifi_event_handle)(lynq_wifi_event_s *event, void *arg);
+typedef struct
+{
+	char bssid[18];//mac
+	char essid[33];
+	unsigned char signal_level; //0-4, max 4
+	unsigned char channel; //1-13
+	lynq_wifi_auth_e auth;
+	lynq_wifi_auth_wpa_psk_e cipher;
+}lynq_wifi_sta_scan_info_t;
 
+typedef struct
+{
+	int cnt;
+	lynq_wifi_sta_scan_info_t info[LYNQ_WIFI_MAX_SCAN_INFO_CNT];
+}lynq_wifi_sta_scan_list_t;
+
+typedef void (*lynq_wifi_event_handle)(lynq_wifi_event_s *event, void *arg);
+typedef void (*lynq_wifi_event_handle_sta)(lynq_wifi_sta_scan_list_t *event);
+
+int  qser_wifi_work_mode_set(lynq_wifi_work_mode_e type);
 int  qser_wifi_enable(void);
 int  qser_wifi_disable(void);
 int  qser_wifi_ap_ssid_set(lynq_wifi_ap_index_e idx, const char *ssid);
@@ -122,7 +153,7 @@
 int  qser_wifi_ap_start(lynq_wifi_ap_index_e idx);
 int  qser_wifi_ap_stop(lynq_wifi_ap_index_e idx);
 int  qser_wifi_ap_restart(lynq_wifi_ap_index_e idx);
-int  qser_wifi_register_handle(lynq_wifi_event_handle event_handle, void *arg);
+int  qser_wifi_register_handle(lynq_wifi_event_handle event_handle, lynq_wifi_event_handle_sta event_handle_sta, void *arg);
 int  qser_wifi_sta_param_set(lynq_wifi_sta_param_t *lynq_stat);
 int  qser_wifi_sta_param_get(lynq_wifi_sta_param_t *lynq_stat);
 int  qser_wifi_sta_start_scan(void);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
index 664fcbe..8ea6835 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
@@ -11,13 +11,14 @@
 #include "sc_wifi.h"
 #include "lynq-qser-wifi.h"
 
-static  lynq_wifi_event_handle wifi_event_handle = NULL;
+static lynq_wifi_event_handle wifi_event_handle = NULL;
+static lynq_wifi_event_handle_sta wifi_event_handle_sta = NULL;
 static void *global_arg = NULL;
-static lynq_wifi_event_s global_event ;
+static lynq_wifi_event_s global_event;
 
 /********************************************************************
 * @brief: lynq_to_sc_auth_mode, The encryption mode of wifi is changed from api to platform
-* @return : NA
+* @return :sc_wifi_auth_e, all
 * @todo: NA
 * @see: NA
 * @warning: NA
@@ -46,12 +47,12 @@
             type = SC_WIFI_AUTH_MIN;
             break;
     }
-	return type;
-} 
+    return type;
+}
 
 /********************************************************************
-* @brief: sc_to_lynq_auth_mode, The encryption mode of wifi is changed from platform to api
-* @return : NA
+* @brief: sc_to_lynq_auth_mode, The wifi protocol moves from platform to api
+* @return :lynq_wifi_auth_e, all
 * @todo: NA
 * @see: NA
 * @warning: NA
@@ -80,8 +81,76 @@
             type = LYNQ_WIFI_AUTH_MIN;
             break;
     }
-	return type;
-} 
+    return type;
+}
+
+/********************************************************************
+* @brief: lynq_to_sc_mode, The wifi protocol is transferred from api to platform
+* @return :sc_wifi_ap_mode_type_e, all
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static sc_wifi_ap_mode_type_e lynq_to_sc_mode(lynq_wifi_mode_type_e mode)
+{
+    sc_wifi_ap_mode_type_e type;
+    switch (mode)
+    {
+        case LYNQ_WIFI_MODE_80211BGN:
+            type = SC_WIFI_AP_MODE_80211BGN;
+            break;
+        case LYNQ_WIFI_MODE_80211BGNAX_2G:
+            type = SC_WIFI_AP_MODE_80211BGNAX_2G;
+            break;
+        case LYNQ_WIFI_MODE_80211AN:
+            type = SC_WIFI_AP_MODE_80211AN;
+            break;
+        case LYNQ_WIFI_MODE_80211ANAC:
+            type = SC_WIFI_AP_MODE_80211ANAC;
+            break;
+        case LYNQ_WIFI_MODE_80211ANACAX_5G:
+            type = SC_WIFI_AP_MODE_80211ANACAX_5G;
+            break;
+        default:
+            type = SC_WIFI_AP_MODE_MIN;
+            break;
+    }
+    return type;
+}
+
+/********************************************************************
+* @brief: sc_to_lynq_mode, The encryption mode of wifi is changed from platform to api
+* @return :lynq_wifi_mode_type_e, all
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static lynq_wifi_mode_type_e sc_to_lynq_mode(sc_wifi_ap_mode_type_e mode)
+{
+    lynq_wifi_mode_type_e type;
+    switch (mode)
+    {
+        case SC_WIFI_AP_MODE_80211BGN:
+            type = LYNQ_WIFI_MODE_80211BGN;
+            break;
+        case SC_WIFI_AP_MODE_80211BGNAX_2G:
+            type = LYNQ_WIFI_MODE_80211BGNAX_2G;
+            break;
+        case SC_WIFI_AP_MODE_80211AN:
+            type = LYNQ_WIFI_MODE_80211AN;
+            break;
+        case SC_WIFI_AP_MODE_80211ANAC:
+            type = LYNQ_WIFI_MODE_80211ANAC;
+            break;
+        case SC_WIFI_AP_MODE_80211ANACAX_5G:
+            type = LYNQ_WIFI_MODE_80211ANACAX_5G;
+            break;
+        default:
+            type = LYNQ_WIFI_MODE_MIN;
+            break;
+    }
+    return type;
+}
 
 /********************************************************************
 * @brief: lynq_user_status, wifi startup callback
@@ -208,31 +277,76 @@
 *********************************************************************/
 static void lynq_user_sta_scan_result_ind(sc_wifi_sta_scan_list_t *p_msg)
 {
-	int i = 0;
-	LYINFLOG("%s : user_sta_scan_result_ind_cb:%d\n", __func__, p_msg->cnt);
-	if (p_msg->cnt <= 0) {
-		return;
-	}
-	for (i = 0; i < p_msg->cnt; i++) {
-		LYINFLOG("%s : ap[%d]:%s,%d,%d,%d,%s,%d\n", __func__, i, p_msg->info[i].essid, sc_to_lynq_auth_mode(p_msg->info[i].auth), 
-			p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level);
-	}
+    int i = 0;
+    LYINFLOG("%s : user_sta_scan_result_ind_cb:%d\n", __func__, p_msg->cnt);
+    if (p_msg->cnt <= 0)
+    {
+        return;
+    }
+    if (wifi_event_handle_sta != NULL)
+    {
+        lynq_wifi_sta_scan_list_t event;
+        event.cnt = p_msg->cnt;
+        for (i = 0; i < event.cnt; i++)
+        {
+            strncpy(event.info[i].essid, p_msg->info[i].essid, sizeof(p_msg->info[i].essid));
+            strncpy(event.info[i].bssid, p_msg->info[i].bssid, sizeof(p_msg->info[i].bssid));
+            event.info[i].auth = sc_to_lynq_auth_mode(p_msg->info[i].auth);
+            event.info[i].cipher = (lynq_wifi_auth_wpa_psk_e)p_msg->info[i].cipher;
+            event.info[i].channel = p_msg->info[i].channel;
+            event.info[i].signal_level = p_msg->info[i].signal_level;
+        }
+        wifi_event_handle_sta(&event);
+    }
+    else
+    {
+        for (i = 0; i < p_msg->cnt; i++)
+        {
+            LYINFLOG("%s : ap[%d]:%s,%d,%d,%d,%s,%d\n", __func__, i, p_msg->info[i].essid, sc_to_lynq_auth_mode(p_msg->info[i].auth),
+                     p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level);
+        }
+    }
+}
+
+/********************************************************************
+* @brief: qser_wifi_work_mode_set, 2.4g or 5g working mode Settings
+* @param type [IN]: lynq_wifi_work_mode_e, 2.4G or 5G working mode Settings
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_work_mode_set(lynq_wifi_work_mode_e type)
+{
+    int ret = -1;
+    ret = sc_wifi_work_mode_set((sc_wifi_work_mode_e)type);
+    if (0 != ret)
+    {
+        LYERRLOG("[%s ] work_mode ret = %d\n", __func__,ret);
+        return ret;
+    }
+    LYINFLOG("[%s ]\n", __func__);
+    return 0;
 }
 
 /********************************************************************
 * @brief: qser_wifi_register_handle, Register callback functions
+* @param event_handle [IN]: lynq_wifi_event_handle, Register the ap event callback function
+* @param event_handle_sta [IN]: Register sta's event callback function
+* @param arg [IN]: void *, Not currently used, but cannot pass a null pointer
 * @return :int, If equal to 0 succeeds, others fail
 * @todo: NA
 * @see: NA
 * @warning: NA
 *********************************************************************/
-int qser_wifi_register_handle(lynq_wifi_event_handle event_handle, void *arg)
+int qser_wifi_register_handle(lynq_wifi_event_handle event_handle, lynq_wifi_event_handle_sta event_handle_sta, void *arg)
 {
-    if(event_handle == NULL || arg == NULL)
+    if((event_handle == NULL && event_handle_sta == NULL) || arg == NULL)
     {
         LYERRLOG("[%s ] NUll pointer event_handle = 0x%p arg = 0x%p\n", __func__, event_handle, arg);
         return -1;
     }
+    wifi_event_handle_sta = event_handle_sta;
     wifi_event_handle = event_handle;
     global_arg = arg;
     return 0;
@@ -321,14 +435,14 @@
     ret = sc_wifi_disable();
     if (0 != ret)
     {
-        LYERRLOG("[%s ] disable : %d ret = %d\n", __func__,ret);
+        LYERRLOG("[%s ] disable ret = %d\n", __func__,ret);
         return ret;
     }
 
     ret = sc_wifi_uninit();
     if (0 != ret)
     {
-        LYERRLOG("[%s ] uninit: %d ret = %d\n", __func__,ret);
+        LYERRLOG("[%s ] uninit ret = %d\n", __func__,ret);
         return ret;
     }
     LYINFLOG("[%s ]\n", __func__);
@@ -336,8 +450,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_ssid_set, Set the name of the ssid of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_ssid_set, Set the name of the ssid of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param ssid [IN]: const char *, Set the ssid name
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -363,8 +477,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_ssid_get, Get the name of the ssid of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_ssid_get, Get the name of the ssid of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param ssid [OUT]: char *, Get the ssid name
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -387,8 +501,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_ssid_hide_set, Set whether the ssid of wlan0 or wlan1 is hidden
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_ssid_hide_set, Set whether the ssid of 2.4G or 5G is hidden
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param hide [IN]: bool, Set whether the ssid is hidden
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -409,8 +523,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_ssid_hide_get, Get whether the ssid of wlan0 or wlan1 is hidden
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_ssid_hide_get, Get whether the ssid of 2.4G or 5G is hidden
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param hide [OUT]: bool *, Get whether the ssid is hidden
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -438,8 +552,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_mode_set, Set the working protocol mode of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_mode_set, Set the working protocol mode of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param mode [IN]: lynq_wifi_mode_type_e, Set the working protocol mode
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -449,20 +563,7 @@
 int  qser_wifi_ap_mode_set(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e mode)
 {
     int ret = -1;
-    sc_wifi_ap_mode_type_e type;
-    switch(mode)
-    {
-        case LYNQ_WIFI_MODE_80211BGN:
-            type = SC_WIFI_AP_MODE_80211BGN;
-            break;
-        case LYNQ_WIFI_MODE_80211BGNAX_2G:
-            type = SC_WIFI_AP_MODE_80211BGNAX_2G;
-            break;
-        default:
-            type = SC_WIFI_AP_MODE_MIN;
-            break;
-    }
-    ret = sc_wifi_ap_mode_set((sc_wifi_ap_index_e)idx, type);
+    ret = sc_wifi_ap_mode_set((sc_wifi_ap_index_e)idx, lynq_to_sc_mode(mode));
     if (0 != ret)
     {
         LYERRLOG("[%s ] ret = %d\n", __func__,ret);
@@ -473,8 +574,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_mode_get, Get the working protocol mode of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_mode_get, Get the working protocol mode of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param mode [OUT]: lynq_wifi_mode_type_e *, Get the working protocol mode
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -497,26 +598,13 @@
         return ret;
     }
     LYINFLOG("[%s ] idx = %d mode = %d \n", __func__, idx, param.mode);
-    lynq_wifi_mode_type_e type;
-    switch(param.mode)
-    {
-        case SC_WIFI_AP_MODE_80211BGN:
-            type = LYNQ_WIFI_MODE_80211BGN;
-            break;
-        case SC_WIFI_AP_MODE_80211BGNAX_2G:
-            type = LYNQ_WIFI_MODE_80211BGNAX_2G;
-            break;
-        default:
-            type = LYNQ_WIFI_MODE_MIN;
-            break;
-    }
-    *mode = type;
+    *mode = sc_to_lynq_mode(param.mode);
     return 0;
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_bandwidth_set, Set the bandwidth of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_bandwidth_set, Set the bandwidth of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param bandwidth [IN]: lynq_wifi_bandwidth_type_e, Set the bandwidth
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -537,8 +625,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_bandwidth_get, Get the bandwidth of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_bandwidth_get, Get the bandwidth of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param bandwidth [OUT]: lynq_wifi_bandwidth_type_e *, Get the bandwidth
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -566,8 +654,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_channel_set, Set the channel for wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_channel_set, Set the channel for 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param country_code [IN]: const char *, Set country code
 * @param channel [IN]: int, Set the channel
 * @return : int, If equal to 0 succeeds, others fail
@@ -594,8 +682,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_channel_get, Get the channel for wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_channel_get, Get the channel for 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param country_code [OUT]: char *, Get country code
 * @param channel [OUT]: int *, Get the channel
 * @return : int, If equal to 0 succeeds, others fail
@@ -625,8 +713,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_auth_set, Set the security authentication mode and password of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_auth_set, Set the security authentication mode and password of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param auth_mode [IN]: lynq_wifi_auth_e, Set the security authentication mode
 * @param auth_passwd [IN]: const char *, Set password
 * @return : int, If equal to 0 succeeds, others fail
@@ -657,8 +745,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_auth_get, Get the security authentication mode and password of wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_auth_get, Get the security authentication mode and password of 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param auth_mode [OUT]: lynq_wifi_auth_e *, Get the security authentication mode
 * @param auth_passwd [OUT]: char *, Get password
 * @return : int, If equal to 0 succeeds, others fail
@@ -689,8 +777,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_max_sta_set, Set the maximum number of STAs for wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_max_sta_set, Set the maximum number of STAs for 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param max_sta_num [IN]: int, Set the maximum number
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -711,8 +799,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_max_sta_get, Get the maximum number of STAs for wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_max_sta_get, Get the maximum number of STAs for 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @param max_sta_num [OUT]: int *, Get the maximum number
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
@@ -740,8 +828,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_start, Set the ap mode of wlan0 or wlan1 to enable
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_start, Set the ap mode of 2.4G or 5G to enable
+* @param idx [IN]: int, Set 2.4G or 5G
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
 * @see: NA
@@ -761,8 +849,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_stop, Disable ap mode for wlan0 or wlan1
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_stop, Disable ap mode for 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
 * @see: NA
@@ -782,8 +870,8 @@
 }
 
 /********************************************************************
-* @brief: qser_wifi_ap_restart, Set the ap mode of wlan0 or wlan1 to restart
-* @param idx [IN]: int, Set wlan0 or wlan1
+* @brief: qser_wifi_ap_restart, Set the ap mode of 2.4G or 5G to restart
+* @param idx [IN]: int, Set 2.4G or 5G
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA
 * @see: NA