Example #1
0
 internal void OnIhvNotification(IhvEventArgs e)
 {
     if (IhvNotification != null)
     {
         IhvNotification(this, e);
     }
 }
Example #2
0
        internal void OnWlanNotification(ref WlanNotificationData data, IntPtr context)
        {
            WlanInterface wlanIface = null;
            WlanEventArgs wlanEvent = WlanEventArgs.Empty;

            if (interfaceMap.ContainsKey(data.InterfaceGuid))
            {
                wlanIface = interfaceMap[data.InterfaceGuid];
                wlanEvent.InterfaceGuid = wlanIface.Guid;
            }
            wlanEvent.NotificationSource = data.NotificationSource;
            wlanEvent.NotificationCode   = data.NotificationCode;

            switch (data.NotificationSource)
            {
            case WlanNotificationSource.Acm:
                switch ((WlanAcmNotificationCode)data.NotificationCode)
                {
                case WlanAcmNotificationCode.ConnectionStart:
                case WlanAcmNotificationCode.ConnectionAttemptFail:
                case WlanAcmNotificationCode.Disconnecting:
                case WlanAcmNotificationCode.Disconnected:
                    break;

                case WlanAcmNotificationCode.ConnectionComplete:
                    WlanConnectionNotificationData?conNotif = ParseWlanConnectionNotificationData(ref data);
                    if (conNotif.HasValue && wlanIface != null)
                    {
                        AcmConnectionEventArgs conArgs = new AcmConnectionEventArgs();
                        conArgs.ConnectionData   = conNotif.Value;
                        conArgs.NotificationCode = WlanAcmNotificationCode.ConnectionComplete;
                        wlanIface.OnAcmConnectionCompleted(conArgs);
                    }
                    break;

                case WlanAcmNotificationCode.ScanFail:
                    //TODO parse WLAN_REASON_CODE in field Data
                    break;

                case WlanAcmNotificationCode.BssTypeChange:
                    //TODO parse DOT11_BSS_TYPE in field Data
                    break;

                case WlanAcmNotificationCode.PowerSettingChange:
                    //TODO parse WLAN_POWER_SETTING in field Data
                    break;

                case WlanAcmNotificationCode.ProfileNameChange:
                    //TODO parse two null-terminated WCHAR strings in field Data
                    break;

                case WlanAcmNotificationCode.AdhocNetworkStateChange:
                    //TODO parse WLAN_ADHOC_NETWORK_STATE in field Data
                    break;

                case WlanAcmNotificationCode.ScreenPowerChange:
                    //TODO parse BOOL in field Data
                    break;
                }
                OnAcmNotification(new AcmEventArgs());
                break;

            case WlanNotificationSource.Msm:
                switch ((WlanMsmNotificationCode)data.NotificationCode)
                {
                case WlanMsmNotificationCode.Associating:
                case WlanMsmNotificationCode.Associated:
                case WlanMsmNotificationCode.Authenticating:
                case WlanMsmNotificationCode.Connected:
                case WlanMsmNotificationCode.RoamingStart:
                case WlanMsmNotificationCode.RoamingEnd:
                case WlanMsmNotificationCode.Disassociating:
                case WlanMsmNotificationCode.Disconnected:
                case WlanMsmNotificationCode.PeerJoin:
                case WlanMsmNotificationCode.PeerLeave:
                case WlanMsmNotificationCode.AdapterRemoval:
                    //TODO parse WLAN_MSM_NOTIFICATION_DATA in field Data
                    break;

                case WlanMsmNotificationCode.AdapterOperationModeChange:
                    //TODO parse ULONG in field Data
                    break;

                case WlanMsmNotificationCode.SignalQualityChange:
                    //TODO parse ULONG for WLAN_SIGNAL_QUALITY in field Data
                    break;

                case WlanMsmNotificationCode.RadioStateChange: {
                    WlanPhyRadioState            radioState = Util.ParseStruct <WlanPhyRadioState>(data.Data, data.DataSize);
                    MsmRadioStateChangeEventArgs eventArgs  = new MsmRadioStateChangeEventArgs();
                    eventArgs.RadioState = radioState;
                    wlanIface.OnMsmRadioStateChange(eventArgs);
                }
                break;
                }
                OnMsmNotification(new MsmEventArgs());
                break;

            case WlanNotificationSource.OneX:
                OnOneXNotification(new OneXEventArgs());
                break;     //TODO

            case WlanNotificationSource.Security:
                OnSecurityNotification(new SecurityEventArgs());
                break;     //TODO

            case WlanNotificationSource.Ihv: {
                IhvEventArgs eventArgs = new IhvEventArgs();
                eventArgs.Data     = data.Data;
                eventArgs.DataSize = data.DataSize;
                OnIhvNotification(eventArgs);
            }
            break;         //TODO

            case WlanNotificationSource.HostedNetwork:
                if (HostedNetwork != null)
                {
                    switch ((WlanHostedNetworkNotificationCode)data.NotificationCode)
                    {
                    case WlanHostedNetworkNotificationCode.PeerStateChange: {
                        WlanHostedNetworkDataPeerStateChange peerStateChange = Util.ParseStruct <WlanHostedNetworkDataPeerStateChange>(data.Data, data.DataSize);
                        HnwkPeerStateChangeEventArgs         eventArgs       = new HnwkPeerStateChangeEventArgs();
                        eventArgs.PeerState = peerStateChange;
                        HostedNetwork.OnHnwkPeerStateChange(eventArgs);
                    }
                    break;

                    case WlanHostedNetworkNotificationCode.RadioStateChange: {
                        WlanHostedNetworkRadioState   radioState = Util.ParseStruct <WlanHostedNetworkRadioState>(data.Data, data.DataSize);
                        HnwkRadioStateChangeEventArgs eventArgs  = new HnwkRadioStateChangeEventArgs();
                        eventArgs.RadioState = radioState;
                        HostedNetwork.OnHnwkRadioStateChange(eventArgs);
                    }
                    break;

                    case WlanHostedNetworkNotificationCode.StateChange: {
                        WlanHostedNetworkStateChange stateChange = Util.ParseStruct <WlanHostedNetworkStateChange>(data.Data, data.DataSize);
                        HnwkStateChangeEventArgs     eventArgs   = new HnwkStateChangeEventArgs();
                        eventArgs.State = stateChange;
                        HostedNetwork.OnHnwkStateChange(eventArgs);
                    }
                    break;
                    }
                    wlanEvent.InterfaceGuid = HostedNetwork.Guid;
                    OnHwnkNotification(new HnwkEventArgs());
                }
                break;
            }
            OnWlanNotification(wlanEvent);
        }