use of ca.weblite.objc.Client in project buck by facebook.
the class MacWifiSsidFinder method findCurrentSsid.
/**
* Finds the SSID of the default Wi-Fi interface using Mac OS X APIs.
*/
public static Optional<String> findCurrentSsid() {
LOG.debug("Getting current SSID..");
// Grab a handle to the Objective-C runtime.
Client objcClient = Client.getInstance();
// Try the OS X 10.10 and later supported API, then fall
// back to the OS X 10.6 API.
Pointer wifiClientClass = RuntimeUtils.cls("CWWiFiClient");
Optional<Proxy> defaultInterface;
if (wifiClientClass != null) {
LOG.verbose("Getting default interface using +[CWWiFiClient sharedWiFiClient]");
defaultInterface = getDefaultWifiInterface(objcClient, wifiClientClass);
} else {
LOG.verbose("Getting default interface using +[CWInterface defaultInterface]");
// CWInterface *defaultInterface = [CWInterface interface];
defaultInterface = Optional.ofNullable(objcClient.sendProxy("CWInterface", "interface"));
}
return getSsidFromInterface(defaultInterface);
}