is there any way to find the "guest wifi network" connected?

I have created the macOS application and I am using "CoreWLAN" framework to list all available wifi networks using the classes "CWInterface" and "CWNetwork" and able to get the current connected interface details like, SSID, BSSID, RSSI etc.


UseCase: I have created a new guest network in the router and connected in MAC (ex: "Test_Guest") , now I have to find whether the connected network is Guest network or not?


Is there any other frameworks can find this behaviour in the wifi network and that should be acceptable by the AppStore.


Thanks in advance.

Replies

It sounds like you are wanting to get the currently connected SSID instead of scanning for all the nearby networks. Is that correct?


If that is correct, you are on the right path using CoreWLAN. Get the SSID of the currently connected network like this:


CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient] interface];
NSLog(@"Connected SSID: %@", wifiInterface.ssid);


Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Thanks for your response.


It sounds like you are wanting to get the currently connected SSID instead of scanning for all the nearby networks. Is that correct?

No. I am able to get the currently connected SSID and also scanned available networks.


Question:


We need to know whether "SSID" is of Guest Network.


How to differentiate the guest network if connected?

What do you mean by “guest network”?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

What do you mean by “guest network”?


Let me tell you in detail, I have logged into a "Netgear" router (via router address 192.168.1.1) and Click on Guest network

Enable guest network - Enable SSID Broadcast - Click on apply. Now, the network "NETGEAR_Guest" is created.

I will connect my mac to "NETGEAR_Guest" .


So I want to know the currently connected network is Guest network or other network. I tried with CoreWLAN framework but i don't see any parameter that defines the network type as i explained earlier.


Is this possible? Please let me know.

As far as I know, access point ‘guest’ networks are simply Wi-Fi networks that require no authentication. You can certainly look for that using CoreWLAN.

It’s possible that there’s some subtle Wi-Fi metadata that specifically identifies a guest network. I can’t speak to that because I don’t have a deep familiarity with the Wi-Fi standands. However, if you can point me to info about the specific Wi-Fi level info you care about, I can’t certainly take a look to see if that’s available via CoreWLAN.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
import Cocoa
import CoreWLAN

class Discovery {

    var currentInterface: CWInterface
    var interfacesNames: [String] = []
    var networks: Set = []

    // Failable init using default interface
    init?() {
        if let defaultInterface = CWWiFiClient.shared().interface(),
            let name = defaultInterface.interfaceName {
            self.currentInterface = defaultInterface
            self.interfacesNames.append(name)
            self.findNetworks()
           
        } else {
            return nil
        }
    }

    // Init with the literal interface name, like "en1"
    init(interfaceWithName name: String) {
        self.currentInterface = CWInterface(interfaceName: name)
        self.interfacesNames.append(name)
        self.findNetworks()
    }

    // Fetch detectable WIFI networks
   func findNetworks() {
        do {
            self.networks = try currentInterface.scanForNetworks(withSSID: nil)
        } catch let error as NSError {
            print("Error: \(error.localizedDescription)")
        }
    }
   
    // Fetch current connected wifi network
    func getCurrentConnectedWifiNetwork() -> [String: Any] {
        var currentNetwork: [String: Any] = [:]
        currentNetwork["ssid"] = currentInterface.ssid()
        currentNetwork["security"] = currentInterface.security().rawValue
        currentNetwork["channelNumber"] = currentInterface.wlanChannel()?.channelNumber
        currentNetwork["IPAddress"] = getIPAddress(interfaceName: currentInterface.interfaceName!)
        currentNetwork["rssi"] = currentInterface.rssiValue()

        return currentNetwork
       
    }

I have created the "Discovery" class to get the connected wifi network details (SSID, Security, Channel Number, IPAddress, RSSI) and From viewController calling the below function.


if let discoveryObject = Discovery() {
            let currentConnectedWifi = discoveryObject.getCurrentConnectedWifiNetwork()
            print("\nConnected wifi network: \n\n\(currentConnectedWifi)\n")
}

The console log for the network "NETGEAR10" (not a guest wifi network)


["channelNumber": 13, "IPAddress": "192.168.1.4", "security": 4, "ssid": "NETGEAR10", "rssi": -36]


Now, created a guest wifi network name as "NETGEAR_Guest" and the details are,


["rssi": -38, "channelNumber": 13, "ssid": "NETGEAR_Guest", "security": 4, "IPAddress": "192.168.1.4"]


I need to know what exact metadata is available to identify the guest network in CoreWLAN andhelp is much needed. Thank you.

I need to know what exact metadata is available to identify the guest network

Ah, um, that’s what I’m asking you!

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"