コード例 #1
0
ファイル: WlanProtocol.cs プロジェクト: cssack/CsGlobals
		private static void OnWlanNotification(ref WlanInternNotificationData data, IntPtr context)
		{
			var nic = Nic.PerId(data.nicGuid);

			switch (data.notificationSource)
			{
				case NotificationSource.Acm:
					switch ((NotificationCodeAcm) data.notificationCode)
					{
						case NotificationCodeAcm.ConnectionStart:
						case NotificationCodeAcm.ConnectionComplete:
						case NotificationCodeAcm.ConnectionAttemptFail:
						case NotificationCodeAcm.Disconnecting:
						case NotificationCodeAcm.Disconnected:
							WlanInternNotificationConnectionData? connNotifyData = ParseWlanConnectionNotification(ref data);
							if (connNotifyData.HasValue)
								if (nic != null)
									nic.Wlan.OnConnectionNotification(data, connNotifyData.Value);
							break;
						case NotificationCodeAcm.ScanFail:
						{
							int expectedSize = Marshal.SizeOf(typeof (int));
							if (data.dataSize >= expectedSize)
							{
								var reasonCode = (ReasonCode) Marshal.ReadInt32(data.dataPtr);
								if (nic != null)
									nic.Wlan.OnReasonNotification(data, reasonCode);
							}
						}
							break;
					}
					break;
				case NotificationSource.Msm:
					switch ((NotificationCodeMsm) data.notificationCode)
					{
						case NotificationCodeMsm.Associating:
						case NotificationCodeMsm.Associated:
						case NotificationCodeMsm.Authenticating:
						case NotificationCodeMsm.Connected:
						case NotificationCodeMsm.RoamingStart:
						case NotificationCodeMsm.RoamingEnd:
						case NotificationCodeMsm.Disassociating:
						case NotificationCodeMsm.Disconnected:
						case NotificationCodeMsm.PeerJoin:
						case NotificationCodeMsm.PeerLeave:
						case NotificationCodeMsm.AdapterRemoval:
							WlanInternNotificationConnectionData? connNotifyData = ParseWlanConnectionNotification(ref data);
							if (connNotifyData.HasValue)
								if (nic != null)
									nic.Wlan.OnConnectionNotification(data, connNotifyData.Value);
							break;
					}
					break;
			}

			if (nic != null)
				nic.Wlan.OnNotification(data);
		}
コード例 #2
0
		internal WlanConnectionNotificationEventArgs(WlanInternNotificationData data, WlanInternNotificationConnectionData c)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
			BssType = c.dot11BssType;
			ProfileName = c.profileName;
			ProfileXml = c.profileXml;
			SecurityEnabled = c.securityEnabled;
			ConnectionMode = c.ConnectionMode;
			ReasonCode = c.wlanReasonCode;
			Ssid = c.Dot11Ssid.GetSsid();
		}
コード例 #3
0
ファイル: WlanProtocol.cs プロジェクト: cssack/CsGlobals
		private static WlanInternNotificationConnectionData? ParseWlanConnectionNotification(ref WlanInternNotificationData notifyData)
		{
			int expectedSize = Marshal.SizeOf(typeof (WlanInternNotificationConnectionData));
			if (notifyData.dataSize < expectedSize)
				return null;

			var notifyConnectionData = (WlanInternNotificationConnectionData) Marshal.PtrToStructure(notifyData.dataPtr, typeof (WlanInternNotificationConnectionData));
			if (notifyConnectionData.wlanReasonCode == ReasonCode.Success)
			{
				var profileXmlPtr = new IntPtr(notifyData.dataPtr.ToInt64() + Marshal.OffsetOf(typeof (WlanInternNotificationConnectionData), "profileXml").ToInt64());

				notifyConnectionData.profileXml = Marshal.PtrToStringUni(profileXmlPtr);
			}

			return notifyConnectionData;
		}
コード例 #4
0
		internal WlanReasonNotificationEventArgs(WlanInternNotificationData data, ReasonCode code)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
			ReasonCode = code;
		}
コード例 #5
0
ファイル: Wlan.cs プロジェクト: cssack/CsGlobals
		internal void OnNotification(WlanInternNotificationData nd)
		{
			if (nd.NotificationCode.Equals(NotificationCodeAcm.ConnectionComplete) || nd.NotificationCode.Equals(NotificationCodeAcm.Disconnected))
			{
				State.Reload();
			}
			else if (nd.NotificationCode.Equals(NotificationCodeAcm.ScanComplete))
			{
				ReloadSsidList();
				ReloadBssList();
				State.SetScanFinished(true);
			}
			else if (nd.NotificationCode.Equals(NotificationCodeAcm.ScanFail))
			{
				State.SetScanFinished(false);
			}
			else if (nd.NotificationCode.Equals(NotificationCodeAcm.Disconnected))
			{
				ConnectedWlan = null;
			}
		}
コード例 #6
0
ファイル: Wlan.cs プロジェクト: cssack/CsGlobals
		internal void OnReasonNotification(WlanInternNotificationData notificationdata, ReasonCode reason)
		{
			//var args = new WlanReasonNotificationEventArgs(notificationdata, reason);
		}
コード例 #7
0
ファイル: Wlan.cs プロジェクト: cssack/CsGlobals
		internal void OnConnectionNotification(WlanInternNotificationData notificationdata, WlanInternNotificationConnectionData value)
		{
			//var args = new WlanConnectionNotificationEventArgs(notificationdata, value);
		}
コード例 #8
0
		/// <summary>
		///     Indicates the reason for an operation failure. This field has a value of <see cref="ReasonCode.Success" />
		///     for all connection-related notifications except <see cref="NotificationCodeAcm.ConnectionComplete" />. If the
		///     connection fails, this field indicates the reason for the failure.
		/// </summary>
		internal WlanNotificationEventArgs(WlanInternNotificationData data)
		{
			Source = data.notificationSource;
			Code = data.NotificationCode;
		}