add wifi pkt
Change-Id: I6f06bf2f76e402d51ce70098c5f15c3702618eb8
diff --git a/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c b/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c
index 74e1c16..3b4de85 100644
--- a/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c
+++ b/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c
@@ -290,5 +290,55 @@
return 0;
}
+int mbtk_wifi_get_pkt(mbtk_wifi_pkt_stats_t* pkt_stat)
+{
+ if(NULL == pkt_stat)
+ {
+ return -1;
+ }
+
+ char buf[1024] = {0};
+ char* ptr = NULL;
+ char* ptr2 = NULL;
+ unsigned long long ull_temp = 0;
+ FILE* fp = NULL;
+ fp = popen("cat /proc/net/dev | grep wlan0", "r");
+ if(NULL == fgets(buf, 1024, fp))
+ {
+ return -1;
+ }
+ pclose(fp);
+
+ LOGD("pkt:%s, len:%d\n", buf, strlen(buf));
+
+
+ pkt_stat->rx_bytes = strtoull(buf + 7, &ptr, 10);
+
+ pkt_stat->rx_packets = strtoull(ptr, &ptr2, 10);
+
+ pkt_stat->rx_errors = strtoull(ptr2, &ptr, 10);
+
+ pkt_stat->rx_dropped = strtoull(ptr, &ptr2, 10);
+
+ ull_temp = strtoull(ptr2, &ptr, 10);
+
+ ull_temp = strtoull(ptr, &ptr2, 10);
+
+ ull_temp = strtoull(ptr2, &ptr, 10);
+
+ ull_temp = strtoull(ptr, &ptr2, 10);
+
+ pkt_stat->tx_bytes = strtoull(ptr2, &ptr, 10);
+
+ pkt_stat->tx_packets = strtoull(ptr, &ptr2, 10);
+
+ pkt_stat->tx_errors = strtoull(ptr2, &ptr, 10);
+
+ pkt_stat->tx_dropped = strtoull(ptr, &ptr2, 10);
+
+
+
+ return 0;
+}