コード例 #1
0
        private void Init()
        {
            try {
                WlanUtils.Throw_On_Win32_Error(wlanapi.WlanOpenHandle(wlanapi.WLAN_CLIENT_VERSION_VISTA, IntPtr.Zero, out this._ServerVersion, ref this._WlanHandle));


                WLAN_NOTIFICATION_SOURCE notifSource;
                WlanUtils.Throw_On_Win32_Error(wlanapi.WlanRegisterNotification(this._WlanHandle, WLAN_NOTIFICATION_SOURCE.All, true, this._notificationCallback, IntPtr.Zero, IntPtr.Zero, out notifSource));


                WLAN_HOSTED_NETWORK_REASON failReason = this.InitSettings();
                if (failReason != WLAN_HOSTED_NETWORK_REASON.wlan_hosted_network_reason_success)
                {
                    throw new Exception("Init Error WlanHostedNetworkInitSettings: " + failReason.ToString());
                }

                //我加的
                var netStat = QueryStatus();
                _HostedNetworkState = netStat.HostedNetworkState;
                foreach (var i in netStat.PeerList)
                {
                    WlanStation station = new WlanStation(i);
                    _Stations[station.MacAddress] = station;
                }
            } catch {
                wlanapi.WlanCloseHandle(this._WlanHandle, IntPtr.Zero);
                throw;
            }
        }
コード例 #2
0
        protected void onStationJoin(WLAN_HOSTED_NETWORK_PEER_STATE stationState)
        {
            var pStation = new WlanStation(stationState);

            this._Stations[pStation.MacAddress] = pStation;

            if (this.StationJoin != null)
            {
                this.StationJoin(this, EventArgs.Empty);
            }
        }
コード例 #3
0
 public ConnectedPeer(WlanStation peer)
     : this()
 {
     this.MacAddress = peer.MacAddress;
 }
コード例 #4
0
ファイル: WlanManager.cs プロジェクト: mtx33q/virtualrouter
        protected void onStationJoin(WLAN_HOSTED_NETWORK_PEER_STATE stationState)
        {
            var pStation = new WlanStation(stationState);
            this._Stations[pStation.MacAddress] = pStation;

            if (this.StationJoin != null)
            {
                this.StationJoin(this, EventArgs.Empty);
            }
        }