[T8TSK-246][wifi]change gsw sta disconnet ap active

Only Configure

Affected branch:MR3.0-xx && GSW3.0

Affected module:wifi

Is it addected on both ZXIC and MTK: only MTK

Self-test: Yes

Doc Update: YES

Change-Id: I93b0590a01c48e49fdadf9273882925ef8dd5b66
diff --git a/lib/liblynq-wifi6/libwifi6.c b/lib/liblynq-wifi6/libwifi6.c
index f6f1dc5..f56cc2d 100755
--- a/lib/liblynq-wifi6/libwifi6.c
+++ b/lib/liblynq-wifi6/libwifi6.c
@@ -541,9 +541,10 @@
     sprintf(LYNQ_DISABLE_CMD,"DISABLE_NETWORK %d",networkid);
     RLOGD("LYNQ_DISABLE_CMD is:%d\n",LYNQ_DISABLE_CMD);
     DO_OK_FAIL_REQUEST(LYNQ_DISABLE_CMD);
-    
+    DO_OK_FAIL_REQUEST(cmd_save_config);
+
     return 0;
-    
+
 }
 
 
@@ -3234,6 +3235,42 @@
     return inner_sta_start_stop(curr_state.net_no, 0, 0);
 }
 
+int lynq_wifi_sta_disconnect_ap(lynq_wifi_index_e idx, char *ssid)
+{
+    ap_info_s ap;
+    curr_status_info curr_state;
+    ap.ap_ssid[0] = '\0';
+
+    if (ssid == NULL || *ssid == '\0')
+    {
+        RLOGE("input ssid is NULL\n");
+        return -1;
+    }
+
+    CHECK_IDX(idx, CTRL_STA);
+
+
+    curr_state.ap = ≈
+    curr_state.state = NULL;
+
+    if (inner_get_status_info(CTRL_STA, &curr_state) != 0)
+    {
+        return 0;
+    }
+
+    if (strcmp(ap.ap_ssid, ssid) != 0)
+    {
+        return 0;
+    }
+
+    pthread_mutex_lock(&s_global_check_mutex);
+    s_sta_status = INNER_STA_STATUS_DISCONNECTING;
+    pthread_mutex_unlock(&s_global_check_mutex);
+    return lynq_wifi_sta_stop_network(idx, curr_state.net_no);
+
+}
+
+
 int lynq_wifi_sta_start(lynq_wifi_index_e idx)
 {
 //    const char *lynq_reconfigure_cmd = "wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 RECONFIGURE /data/wifi/wg870/wpa_supplicant.conf";
@@ -3264,6 +3301,29 @@
     curr_state.state = state;
     return inner_get_status_info(interface, &curr_state);
 }
+
+int lynq_wifi_sta_start_auto(lynq_wifi_index_e idx)
+{
+
+    const char *lynq_reconnect_cmd = "wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 reconnect";
+
+    CHECK_IDX(idx, CTRL_STA);
+    CHECK_WPA_CTRL(CTRL_STA);
+
+    ret = system_call_v("%s %s", start_stop_sta_script, "start");
+    if (ret != 0)
+    {
+        RLOGE("lynq_wifi_ap_start excute script fail");
+        return -1;
+    }
+
+//    system(lynq_enable_sta_cmd);
+    system(lynq_reconnect_cmd);
+
+    return 0;
+}
+
+
 int lynq_wifi_sta_stop(lynq_wifi_index_e idx)
 {
 //    char lynq_disable_network_cmd[MAX_CMD];
@@ -3301,7 +3361,7 @@
         RLOGD("lynq_wifi_ap_start curr state %s", state);
         usleep(SLEEP_TIME_ON_IDLE);
     }
-
+    
     return 0;
 //    return system("connmanctl disable wifi");
 }