[Feature][ZXW-308]Data packet statistics when WiFi gets ap and sta modes, and the connected sta device gets api additions, as well as the printing of sta status with the callback function turned on

    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: I1d60213db964870e8d89f4d7bc8e49e3ce557c13
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 da282c8..2b23394 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
@@ -251,34 +251,26 @@
 * @see: NA
 * @warning: NA
 *********************************************************************/
-/*
 static void print_sta_status(sc_wifi_sta_status_t *p_msg)
 {
-	LYINFLOG("%s: %d, %s, %s, %d, %d\n", __func__, p_msg->status, p_msg->ifname, p_msg->ap_bssid, 
-	p_msg->signal_level, p_msg->reason_code);
+    LYINFLOG("%s: %d, %s, %s, %d, %d\n", __func__, p_msg->status, p_msg->ifname, p_msg->ap_bssid,
+             p_msg->signal_level, p_msg->reason_code);
 
-	if (p_msg->has_addr == 1) {
-		char addrtxt[48] = {0};
-		inet_ntop(AF_INET, &p_msg->addr, addrtxt, sizeof(addrtxt));
-		LYINFLOG("%s : addr inet_ntop: %s\n", __func__, addrtxt);
+    if (p_msg->has_addr == 1)
+    {
+        LYINFLOG("[%s]addr ip:%s, netmask:%s, subnet_bits:%d, gateway:%s, dnsp:%s, dnss:%s\n", __func__,
+                 p_msg->addr.addr, p_msg->addr.netmask, p_msg->addr.subnet_bits,
+                 p_msg->addr.gateway, p_msg->addr.dnsp, p_msg->addr.dnss);
+    }
 
-		LYINFLOG("%s : addr: %08X\n", __func__, p_msg->addr.s_addr);
-	}
-
-	if (p_msg->has_addr6 == 1) {
-		char addrtxt[48] = {0};
-		inet_ntop(AF_INET6, &p_msg->addr6, addrtxt, sizeof(addrtxt));
-		LYINFLOG("%s : addr6 inet_ntop: %s\n", __func__, addrtxt);
-
-		LYINFLOG("%s : addr6: %02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X\n",__func__, 
-		p_msg->addr6.s6_addr[0], p_msg->addr6.s6_addr[1], p_msg->addr6.s6_addr[2], p_msg->addr6.s6_addr[3], 
-		p_msg->addr6.s6_addr[4], p_msg->addr6.s6_addr[5], p_msg->addr6.s6_addr[6], p_msg->addr6.s6_addr[7], 
-		p_msg->addr6.s6_addr[8], p_msg->addr6.s6_addr[9], p_msg->addr6.s6_addr[10], p_msg->addr6.s6_addr[11], 
-		p_msg->addr6.s6_addr[12], p_msg->addr6.s6_addr[13], p_msg->addr6.s6_addr[14], p_msg->addr6.s6_addr[15]);
-	}
-	LYINFLOG("%s : sta_status end\n",__func__);
+    if (p_msg->has_addr6 == 1)
+    {
+        LYINFLOG("[%s]addr6 ip:%s, prefix:%s, prefix_bits:%d, gateway:%s, dnsp:%s, dnss:%s\n", __func__,
+                 p_msg->addr6.addr, p_msg->addr6.prefix, p_msg->addr6.prefix_bits,
+                 p_msg->addr6.gateway, p_msg->addr6.dnsp, p_msg->addr6.dnss);
+    }
+    LYINFLOG("%s : sta_status end\n", __func__);
 }
-*/
 
 /********************************************************************
 * @brief: lynq_user_sta_status_ind, wifi gets the status callback in sta mode
@@ -291,7 +283,7 @@
   sc_wifi_sta_status_t *p_msg)
 {	 
 	 LYINFLOG("%s : user_sta_status_ind_cb pre:%d, cur:%d\n", __func__, pre_status, p_msg->status);
-	 //print_sta_status(p_msg);
+	 print_sta_status(p_msg);
 }
 
 /********************************************************************
@@ -1013,6 +1005,84 @@
 }
 
 /********************************************************************
+* @brief: qser_wifi_lanhost_get_list, Get sta device information received as an ap for 2.4G or 5G
+* @param lynq_arrays [OUT]: lynq_lanhost_ts *, Get sta device information received as an ap
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_lanhost_get_list(lynq_lanhost_ts *lynq_arrays)
+{
+    int ret = -1;
+    int i = 0;
+    sc_lanhost_t array[32] = {0};
+    if (lynq_arrays == NULL)
+    {
+        LYERRLOG("[%s ] Null pointer lynq_arrays = 0x%p\n", __func__, lynq_arrays);
+        return ret;
+    }
+    lynq_arrays->array_len = 32;
+    ret = ret = sc_wifi_lanhost_get_list(array, &lynq_arrays->array_len);
+    if (0 != ret)
+    {
+        LYERRLOG("[%s ] ret = %d\n", __func__, ret);
+        return ret;
+    }
+    LYINFLOG("[%s]ap_lanhost len[%d]\n", __func__, lynq_arrays->array_len);
+    for (i = 0; i < lynq_arrays->array_len; i++)
+    {
+        LYINFLOG("[%s]Element : [%d] ifname = %s  macaddr = %s addr = %s name = %s uptime = %d\n", __func__, i,
+                 array[i].ifname, array[i].macaddr, array[i].addr, array[i].name, array[i].uptime);
+        strncpy(lynq_arrays->array[i].ifname, array[i].ifname, sizeof(lynq_arrays->array[i].ifname) - 1);
+        strncpy(lynq_arrays->array[i].macaddr, array[i].macaddr, sizeof(lynq_arrays->array[i].macaddr) - 1);
+        strncpy(lynq_arrays->array[i].addr, array[i].addr, sizeof(lynq_arrays->array[i].addr) - 1);
+        strncpy(lynq_arrays->array[i].name, array[i].name, sizeof(lynq_arrays->array[i].name) - 1);
+        lynq_arrays->array[i].uptime = array[i].uptime;
+    }
+    return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_get_ap_pkt_stats, Obtain data packets sent and received by ap for 2.4G or 5G
+* @param idx [IN]: int, Set 2.4G or 5G
+* @param pkt_stat [OUT]: lynq_wifi_pkt_stats_t *, Obtain data packets sent and received by ap
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_get_ap_pkt_stats(lynq_wifi_ap_index_e idx, lynq_wifi_pkt_stats_t *pkt_stat)
+{
+    int ret = -1;
+    sc_wifi_pkt_stats_t stat = {0};
+    if (pkt_stat == NULL)
+    {
+        LYERRLOG("[%s ] Null pointer pkt_stat = 0x%p\n", __func__, pkt_stat);
+        return ret;
+    }
+    idx = LYNQ_WIFI_AP_INDEX_AP0;
+    ret = sc_wifi_get_ap_pkt_stats((sc_wifi_ap_index_e)idx, &stat);
+    if (0 != ret)
+    {
+        LYERRLOG("[%s ] ret = %d\n", __func__, ret);
+        return ret;
+    }
+    LYINFLOG("[%s ]ap_pkt_get[%d] rx[%llu, %llu, %llu, %llu] tx[%llu, %llu, %llu, %llu]\n", __func__, idx,
+             stat.rx_packets, stat.rx_bytes, stat.rx_errors, stat.rx_dropped,
+             stat.tx_packets, stat.tx_bytes, stat.tx_errors, stat.tx_dropped);
+    pkt_stat->rx_packets = stat.rx_packets;
+    pkt_stat->rx_bytes = stat.rx_bytes;
+    pkt_stat->rx_errors = stat.rx_errors;
+    pkt_stat->rx_dropped = stat.rx_dropped;
+    pkt_stat->tx_packets = stat.tx_packets;
+    pkt_stat->tx_bytes = stat.tx_bytes;
+    pkt_stat->tx_errors = stat.tx_errors;
+    pkt_stat->tx_dropped = stat.tx_dropped;
+    return 0;
+}
+
+/********************************************************************
 * @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
@@ -1141,17 +1211,17 @@
 * @see: NA
 * @warning: NA
 *********************************************************************/
-int  qser_wifi_sta_get_status(lynq_wifi_sta_status_t *status_stat)
+int qser_wifi_sta_get_status(lynq_wifi_sta_status_t *status_stat)
 {
     int ret = -1;
     sc_wifi_sta_status_t stat;
     ret = sc_wifi_sta_get_status(&stat);
     if (0 != ret)
     {
-        LYERRLOG("[%s ] sta_param_get ret = %d\n", __func__,ret);
+        LYERRLOG("[%s ] sta_param_get ret = %d\n", __func__, ret);
         return ret;
     }
-    //print_sta_status(&stat);
+    print_sta_status(&stat);
     status_stat->status = (lynq_wifi_sta_status_e)stat.status;
     status_stat->signal_level = stat.signal_level;
     status_stat->has_addr = stat.has_addr;
@@ -1161,17 +1231,64 @@
     strncpy(status_stat->ap_bssid, stat.ap_bssid, sizeof(stat.ap_bssid) - 1);
     if (status_stat->has_addr == 1)
     {
-        //inet_ntop(AF_INET, &stat.addr, status_stat->addr, sizeof(status_stat->addr));
+        strncpy(status_stat->addr.addr, stat.addr.addr, sizeof(status_stat->addr.addr) - 1);
+        strncpy(status_stat->addr.netmask, stat.addr.netmask, sizeof(status_stat->addr.netmask) - 1);
+        status_stat->addr.subnet_bits = stat.addr.subnet_bits;
+        strncpy(status_stat->addr.gateway, stat.addr.gateway, sizeof(status_stat->addr.gateway) - 1);
+        strncpy(status_stat->addr.dnsp, stat.addr.dnsp, sizeof(status_stat->addr.dnsp) - 1);
+        strncpy(status_stat->addr.dnss, stat.addr.dnss, sizeof(status_stat->addr.dnss) - 1);
     }
     if (status_stat->has_addr6 == 1)
     {
-        //inet_ntop(AF_INET6, &stat.addr6, status_stat->addr6, sizeof(status_stat->addr6));
+        strncpy(status_stat->addr6.addr, stat.addr6.addr, sizeof(status_stat->addr6.addr) - 1);
+        strncpy(status_stat->addr6.prefix, stat.addr6.prefix, sizeof(status_stat->addr6.prefix) - 1);
+        status_stat->addr6.prefix_bits = stat.addr6.prefix_bits;
+        strncpy(status_stat->addr6.gateway, stat.addr6.gateway, sizeof(status_stat->addr6.gateway) - 1);
+        strncpy(status_stat->addr6.dnsp, stat.addr6.dnsp, sizeof(status_stat->addr6.dnsp) - 1);
+        strncpy(status_stat->addr6.dnss, stat.addr6.dnss, sizeof(status_stat->addr6.dnss) - 1);
     }
     LYINFLOG("[%s ] ret = %d \n", __func__, ret);
     return 0;
 }
 
 /********************************************************************
+* @brief: qser_wifi_get_sta_pkt_stats, Obtain data packets sent and received by sta for 2.4G or 5G
+* @param pkt_stat [OUT]: lynq_wifi_pkt_stats_t *, Obtain data packets sent and received by sta
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_get_sta_pkt_stats(lynq_wifi_pkt_stats_t *pkt_stat)
+{
+    int ret = -1;
+    sc_wifi_pkt_stats_t stat = {0};
+    if (pkt_stat == NULL)
+    {
+        LYERRLOG("[%s ] Null pointer pkt_stat = 0x%p\n", __func__, pkt_stat);
+        return ret;
+    }
+    ret = sc_wifi_get_sta_pkt_stats(&stat);
+    if (0 != ret)
+    {
+        LYERRLOG("[%s ] ret = %d\n", __func__, ret);
+        return ret;
+    }
+    LYINFLOG("[%s ]sta_pkt_get rx[%llu, %llu, %llu, %llu] tx[%llu, %llu, %llu, %llu]\n", __func__, 
+             stat.rx_packets, stat.rx_bytes, stat.rx_errors, stat.rx_dropped,
+             stat.tx_packets, stat.tx_bytes, stat.tx_errors, stat.tx_dropped);
+    pkt_stat->rx_packets = stat.rx_packets;
+    pkt_stat->rx_bytes = stat.rx_bytes;
+    pkt_stat->rx_errors = stat.rx_errors;
+    pkt_stat->rx_dropped = stat.rx_dropped;
+    pkt_stat->tx_packets = stat.tx_packets;
+    pkt_stat->tx_bytes = stat.tx_bytes;
+    pkt_stat->tx_errors = stat.tx_errors;
+    pkt_stat->tx_dropped = stat.tx_dropped;
+    return 0;
+}
+
+/********************************************************************
 * @brief: qser_wifi_sta_start_scan, Scan for ap nodes and return them through callback
 * @return : int, If equal to 0 succeeds, others fail
 * @todo: NA