2024年1月19日发(作者:)

private static WiFiDirectConnectionListener WiFiDirectListener { get { if (_listener == null) _listener = new WiFiDirectConnectionListener(); return _listener; } } public static uint GetConnectedClients() { uint uiRet = 0; if (NetworkOperatorTetheringManager != null) {

uiRet = Count; } return uiRet; } public static bool GetWifiState() { bool bRet = false; if (NetworkOperatorTetheringManager != null) { if (ingOperationalState == ) { bRet = true; } } return bRet; } ///

/// 开起WiFi /// /// /// /// public static bool StartWiFi(string ssid, string pass) { try { t(new { Title = "StartWiFi", SSID = ssid, Pass = pass }); try { // This can raise an exception if the machine does not support WiFi. Sorry. tionRequested += OnConnectionRequested; } catch (Exception ex) { t("StartWiFi Listener", ex); return false; } StopWiFi(); StateDiscoverability = ; nomousGroupOwnerEnabled = true; led = true; = ssid; var creds = new rdCredential(); rd = pass;

theringAsync(); (2000); } (500); } _networkOperatorTetheringManager = null; return true; } catch (Exception ex) { t("StopWiFi", ex); return false; } } ///

/// 外部设备链接WiFi监听事件 /// /// /// private static void OnConnectionRequested(WiFiDirectConnectionListener sender, WiFiDirectConnectionRequestedEventArgs connectionEventArgs) { try { WiFiDirectConnectionRequest request = nectionRequest(); t(new { Title = "OnConnectionRequested", Data = }); } catch (Exception ex) { t("OnConnectionRequested", ex); } } #endregion }}