From 9964b9d58eff591ccd49defe2163520906af6db9 Mon Sep 17 00:00:00 2001 From: npyl Date: Sun, 19 Aug 2018 20:49:05 +0300 Subject: [PATCH] Work for #17 : Now we have ssid --- src/darwin.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/darwin.mm b/src/darwin.mm index 84402749c..948659d9e 100644 --- a/src/darwin.mm +++ b/src/darwin.mm @@ -652,10 +652,24 @@ int update_meminfo() { #ifdef BUILD_WLAN void update_wlan_stats(struct net_stat *ns) { + CWWiFiClient *client = [CWWiFiClient sharedWiFiClient]; + CWInterface *interface = [client interfaceWithName:[NSString stringWithUTF8String:ns->dev]]; + if (!interface) + return; + + const char *essid = [interface ssid].UTF8String; + + if (essid == nullptr) + return; + + /* + * Setup + */ + memcpy(ns->essid, essid, sizeof(char)*strlen(essid)); } -#endif +#endif /* BUILD_WLAN */ int update_net_stats() { struct net_stat *ns;