public bool ConnectSynchronously(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile, int connectTimeout)
 {
     _queueEvents = true;
     try
     {
         Connect(connectionMode, bssType, profile);
         while (_queueEvents && _eventQueueFilled.WaitOne(connectTimeout, true))
         {
             lock (_eventQueue)
             {
                 while (_eventQueue.Count != 0)
                 {
                     object obj2 = _eventQueue.Dequeue();
                     if (obj2 is WlanConnectionNotificationEventData)
                     {
                         WlanConnectionNotificationEventData data = (WlanConnectionNotificationEventData)obj2;
                         if (((data.NotifyData.notificationSource != Wlan.WlanNotificationSource.Acm) || (data.NotifyData.notificationCode != 10)) || data.ConnNotifyData.profileName != profile)
                         {
                             break;
                         }
                         return(true);
                     }
                 }
                 continue;
             }
         }
     }
     finally
     {
         _queueEvents = false;
         _eventQueue.Clear();
     }
     return(false);
 }
示例#2
0
 /// <summary>
 /// Requests a connection (association) to the specified wireless network.
 /// </summary>
 /// <remarks>
 /// The method returns immediately. Progress is reported through the <see cref="WlanNotification"/> event.
 /// </remarks>
 public void Connect(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile)
 {
     Wlan.WlanConnectionParameters connectionParams = new Wlan.WlanConnectionParameters();
     connectionParams.wlanConnectionMode = connectionMode;
     connectionParams.profile            = profile;
     connectionParams.dot11BssType       = bssType;
     connectionParams.flags = 0;
     Connect(connectionParams);
 }
 public void Connect(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile)
 {
     this.Connect(new Wlan.WlanConnectionParameters()
     {
         wlanConnectionMode = connectionMode,
         profile            = profile,
         dot11BssType       = bssType,
         flags = (Wlan.WlanConnectionFlags) 0
     });
 }
示例#4
0
 /// <summary>
 /// Connects to the specified wireless network.
 /// </summary>
 /// <remarks>
 /// The method returns immediately. Progress is reported through the <see cref="WlanNotification"/> event.
 /// </remarks>
 public void Connect(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, Wlan.Dot11Ssid ssid, Wlan.WlanConnectionFlags flags)
 {
     Wlan.WlanConnectionParameters connectionParams = new Wlan.WlanConnectionParameters();
     connectionParams.wlanConnectionMode = connectionMode;
     connectionParams.dot11SsidPtr       = Marshal.AllocHGlobal(Marshal.SizeOf(ssid));
     Marshal.StructureToPtr(ssid, connectionParams.dot11SsidPtr, false);
     connectionParams.dot11BssType = bssType;
     connectionParams.flags        = flags;
     Connect(connectionParams);
     Marshal.DestroyStructure(connectionParams.dot11SsidPtr, ssid.GetType());
     Marshal.FreeHGlobal(connectionParams.dot11SsidPtr);
 }
 private void Connect(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile)
 {
     Wlan.WlanConnectionParameters parameters2 = new Wlan.WlanConnectionParameters
     {
         wlanConnectionMode = connectionMode,
         profile            = profile,
         dot11BssType       = bssType,
         flags = 0
     };
     Wlan.WlanConnectionParameters connectionParams = parameters2;
     Connect(connectionParams);
 }
 public bool ConnectSynchronously(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile, int connectTimeout)
 {
     this.queueEvents = true;
     try
     {
         this.Connect(connectionMode, bssType, profile);
         while (this.queueEvents)
         {
             if (this.eventQueueFilled.WaitOne(connectTimeout, true))
             {
                 lock (this.eventQueue)
                 {
                     while (this.eventQueue.Count != 0)
                     {
                         object obj = this.eventQueue.Dequeue();
                         if (obj is WlanClient.WlanInterface.WlanConnectionNotificationEventData)
                         {
                             WlanClient.WlanInterface.WlanConnectionNotificationEventData notificationEventData = (WlanClient.WlanInterface.WlanConnectionNotificationEventData)obj;
                             if (notificationEventData.notifyData.notificationSource == Wlan.WlanNotificationSource.ACM)
                             {
                                 if (notificationEventData.notifyData.notificationCode == 10)
                                 {
                                     if (notificationEventData.connNotifyData.profileName == profile)
                                     {
                                         return(true);
                                     }
                                     break;
                                 }
                                 break;
                             }
                             break;
                         }
                     }
                 }
             }
             else
             {
                 break;
             }
         }
     }
     finally
     {
         this.queueEvents = false;
         this.eventQueue.Clear();
     }
     return(false);
 }
示例#7
0
 /// <summary>
 /// Connects (associates) to the specified wireless network, returning either on a success to connect
 /// or a failure.
 /// </summary>
 /// <param name="connectionMode"></param>
 /// <param name="bssType"></param>
 /// <param name="profile"></param>
 /// <param name="connectTimeout"></param>
 /// <returns></returns>
 public bool ConnectSynchronously(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile, int connectTimeout)
 {
     queueEvents = true;
     try
     {
         Connect(connectionMode, bssType, profile);
         while (queueEvents && eventQueueFilled.WaitOne(connectTimeout, true))
         {
             lock (eventQueue)
             {
                 while (eventQueue.Count != 0)
                 {
                     object e = eventQueue.Dequeue();
                     if (e is WlanConnectionNotificationEventData)
                     {
                         WlanConnectionNotificationEventData wlanConnectionData = (WlanConnectionNotificationEventData)e;
                         // Check if the conditions are good to indicate either success or failure.
                         if (wlanConnectionData.notifyData.notificationSource == Wlan.WlanNotificationSource.ACM)
                         {
                             switch ((Wlan.WlanNotificationCodeAcm)wlanConnectionData.notifyData.notificationCode)
                             {
                             case Wlan.WlanNotificationCodeAcm.ConnectionComplete:
                                 if (wlanConnectionData.connNotifyData.profileName == profile)
                                 {
                                     return(true);
                                 }
                                 break;
                             }
                         }
                         break;
                     }
                 }
             }
         }
     }
     finally
     {
         queueEvents = false;
         eventQueue.Clear();
     }
     return(false);                // timeout expired and no "connection complete"
 }
示例#8
0
 public void Connect(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, Wlan.Dot11Ssid ssid,
                     Wlan.WlanConnectionFlags flags)
 {
     _wlanInterface.Connect(connectionMode, bssType, ssid, flags);
 }
示例#9
0
 public bool ConnectSynchronously(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType,
                                  string profile, int connectTimeout)
 {
     return(_wlanInterface.ConnectSynchronously(connectionMode, bssType, profile, connectTimeout));
 }
示例#10
0
 public void Connect(Wlan.WlanConnectionMode connectionMode, Wlan.Dot11BssType bssType, string profile)
 {
     _wlanInterface.Connect(connectionMode, bssType, profile);
 }