Hello Eskimo,
Thanks for the reply.
Apologies for not mentioning the platform but yes I am talking about iOS.
Actually, I only need the information (e.g. ssid, bssid, rssi etc.) of the access points of my connected Wifi only (don't need the information of other devices.) because signal strength of different APs installed on the same floor for the same Wifi network e.g. "MyWifi" is of my concern.
Till now I have tried to use the NWBrowser(for: .bonjour(type: "_http._tcp", domain: "local."), using: browseParameters) and I am able to identify two devices (which are printers) on my network but that's not required. May be I am using the wrong service "_http._tcp" but not sure about it. It would be great if someone can help me regarding that.
Looking forward to hearing from you.
Regards,
Post
Replies
Boosts
Views
Activity
You can get the SSID and BSSID of the current Wi-Fi. See the Current Wi-Fi network section of TN3111.
Yes, I can get it but let me try to explain the scenario in detail.
I have a Wi-Fi network in a large building, let's assume on a large floor we have one router and two access points of the same wifi network e.g. "Wifi-1":
router: SSID --> "Wifi-1", BSSID --> f0:88:98:81:11:e1
access point 1: SSID --> "Wifi-1", BSSID --> f0:88:98:81:12:e2
access point 2: SSID --> "Wifi-1", BSSID --> f0:88:98:81:13:e3
Now when a user enters the building and connects with the "Wifi-1" using the password e.g. "Password1" and starts using it, assuming the user is currently close to the router and connected to it, I am able to get the info of "router" but couldn't get the info of "access point 1" & "access point 2". I used the SystemConfiguration.CaptiveNetwork and able to fetch the SSID & BSSID of router only which is:
SSID --> "Wifi-1", BSSID --> f0:88:98:81:11:e1
but at the same time, I need to get the SSID, BSSID, and RSSI (which will be calculated) of both access points too which are access point 1 and access point 2 because these are just the access points of the same Wifi.
Assuming the user starts moving towards access point 1 and reaches very close to it, now the signal strength of router is very weak or vanishes but the signal strength of access point 1 is good so the user will be connected to it seamlessly so that he can continue using the internet services. This is the point where I am able to fetch the information (SSID, BSSID & RSSI (calculated)) of access point 1 which will be:
SSID --> "Wifi-1", BSSID --> f0:88:98:81:12:e2
Now, when the user starts moving towards access point 2 and reaches closer to it the user will be connected to it, and in my app now I am able to fetch the info of it, which is:
SSID --> "Wifi-1", BSSID --> f0:88:98:81:13:e3
I am still unable to understand why the information of all these three is not being provided to me at the same time when I am connected with either of these, in my app when all are on the same network.
Below mentioned is my code snipped to get the SSID and BSSID:
import SystemConfiguration.CaptiveNetwork
struct ScanResult {
let ssid: String
let bssid: String
let capabilities: String
let level: Int
let rssi: Int
}
func getWiFiInfo() -> ScanResult? {
guard let interfaces = CNCopySupportedInterfaces() as? [String] else {
return nil
}
var scanResult: ScanResult? = nil
for interface in interfaces {
guard let interfaceInfo = CNCopyCurrentNetworkInfo(interface as CFString) as NSDictionary? else {
return nil
}
guard let ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String else {
return nil
}
guard let bssid = interfaceInfo[kCNNetworkInfoKeyBSSID as String] as? String else {
return nil
}
llet rssi: Int = 0 // Replace it with actual value
scanResult = ScanResult(ssid: ssid, bssid: bssid, capabilities: "", level: rssi, rssi: rssi)
break
}
return scanResult
}
I have tried to explain the scenario in detail.
Here is the example of an applicationn available on the AppStore named: Wifi Analyzer Network Analyze
When I connect to Wifi "Wifi-1" and tap scan option in the application it staart giving me the list of SSID and BSSID of my corruntly connnected device as well as of all the other Access points just like access point 1 & access point 1 even if I am connected to router either of these three.
Just like above application, I want to identify the other access points of my network along with SSID, BSSID and RSSI so that I can get my use cass fulfilled.
Regards,
Aqeel Ahmed
In that case, I have a question in mind:
Does getting a Network extension entitlement will help me out regarding this use case? Does the NetworkExtension framework can help me get this info somehow?
As I mentioned an application earlier: Wifi Analyzer Network Analyze I am a bit confused about how this is getting the information about all the connected devices on my Wifi Network along with BSSID (Mac Addresses) of those devices. This application is officially available on AppStore which means they are not violating any Apple policy, that's why I can't get this thing out of my mind that there must be an official way for it.
I am just sharing my thoughts to have your comments about it and the answer to my first question for my knowledge.
Looking forward to hearing from you.
Regards,
Aqeel Ahmed