Beispiel #1
0
        public void ControlarRadioWiFi(bool ligar)
        {
            try
            {
                WLAN myCommandModeWlan = null;

                myCommandModeWlan = new WLAN(FusionAccessType.COMMAND_MODE);

                if (myCommandModeWlan != null)
                {
                    if (ligar)
                    {
                        myCommandModeWlan.Adapters[0].PowerState = Adapter.PowerStates.ON;

                        Profile myProfile = getProfileByName("VITAL", myCommandModeWlan);
                        //Profile myProfile = getProfileByName("teste", myCommandModeWlan);
                        if (myProfile != null)
                        {
                            Symbol.Fusion.FusionResults result = myProfile.Connect(true);
                        }
                    }
                    else
                    {
                        myCommandModeWlan.Adapters[0].PowerState = Adapter.PowerStates.OFF;
                    }
                }

                myCommandModeWlan.Dispose();
                myCommandModeWlan = null;
            }
            catch
            {
            }
        }
        private void checkWifiAdapter()
        {
            try
            {
                myConfig = new Config(FusionAccessType.COMMAND_MODE);
                myWlan   = new WLAN(FusionAccessType.COMMAND_MODE);
            }
            catch (OperationFailureException ex)
            {
                MessageBox.Show("Ошибка при настройке WiFi", "Ошибка");
            }

            try
            {
                if (myWlan != null)
                {
                    myWlan.Adapters[0].PowerState        = Adapter.PowerStates.ON;
                    myWlan.Adapters[0].CountryCode       = "RU";
                    myWlan.Adapters[0].IEEE80211dEnabled = false;
                }
            }
            catch (OperationFailureException ex)
            {
                MessageBox.Show("Ошибка при настройке WiFi", "Ошибка");
            }

            myConfig.Dispose();
            myWlan.Dispose();
        }
            //private void SigQChanged(object sender, EventArgs e)
            //{
            //    WLANStatus xStatus = ((Radio)(this.xWiFiCard)).GetNextStatus();

            //    if ((xStatus != null) && (xStatus.Change == ChangeType.SIGNAL))
            //        base.SignalPercent = ((Radio)(this.xWiFiCard)).Signal.Percent;
            //    WiFiStat.GetIP();
            //    WiFiStat.sESSID = ((Radio)(xWiFiCard)).ESSID.Text;
            //    base.STB.Invalidate();
            //}

            // nReg = 0 - Disable WiFi
            // nReg = 1 - Enable WiFi
            // nReg = 2 - Reset WiFi
            public override bool ResetWiFi(int nReg)
            {
                bool
                    ShowState,
                    ret = false;
                WLAN
                    xWLAN_IN_COM = null;

                if (bUseFusion)
                {
                    if (nReg == 2)
                    {
                        ShowState = IsShownState;
                        ShowWiFi(null,false);
                        try
                        {
                            xWLAN_IN_COM = new WLAN(FusionAccessType.COMMAND_MODE);
                            if (xWLAN_IN_COM != null)
                            {
                                xWLAN_IN_COM.Adapters[0].PowerState = Adapter.PowerStates.OFF;
                                Thread.Sleep(2000);
                                xWLAN_IN_COM.Adapters[0].PowerState = Adapter.PowerStates.ON;
                                Thread.Sleep(7000);
                                ret = true;
                            }
                        }
                        catch
                        {
                        }
                        finally
                        {
                            if (xWLAN_IN_COM != null)
                            {
                                xWLAN_IN_COM.Dispose();
                                xWLAN_IN_COM = null;
                            }
                            ShowWiFi(null,ShowState);
                        }
                        //FusionResults fr = xWiFiCard.RenewDHCP();
                        //ret = (fr == FusionResults.SUCCESS) ? true : false;
                    }
                }
                return(ret);
            }
        /// <summary>
        /// Terminates the Symbol scanner.
        /// </summary>
        public override void Terminate()
        {
            // If we have a scanner
            if (symbolReader != null)
            {
                // Disable the scanner
                symbolReader.Actions.Disable();

                // Free it up
                symbolReader.Dispose();

                // Indicate we no longer have one
                symbolReader = null;
            }

            // If we have a scanner data object
            if (symbolReaderData != null)
            {
                // Free it up
                symbolReaderData.Dispose();

                // Indicate we no longer have one
                symbolReaderData = null;
            }
            if (xSymKeyPad != null)
            {
                xSymKeyPad.AlphaNotify    -= ALPNotify;
                xSymKeyPad.KeyStateNotify -= Sym48_KeyStateNotify;
                xSymKeyPad.Dispose();
            }
            if (xWLan != null)
            {
                xWLan.Dispose();
            }
            //if (xRadio != null)
            //    xRadio.Dispose();
        }
Beispiel #5
0
        public bool VerificarRadioWiFi()
        {
            try
            {
                WLAN myCommandModeWlan = null;

                myCommandModeWlan = new WLAN(FusionAccessType.COMMAND_MODE);

                bool status = false;
                if (myCommandModeWlan != null)
                {
                    status = myCommandModeWlan.Adapters[0].PowerState == Adapter.PowerStates.ON;
                }

                myCommandModeWlan.Dispose();
                myCommandModeWlan = null;

                return(status);
            }
            catch
            {
                return(false);
            }
        }