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
            {
            }
        }
        /// <summary>
        /// Initiates the Symbol scanner.
        /// </summary>
        /// <returns>Whether initialization was successful</returns>
        public override bool Initialize()
        {
            // If scanner is already present then fail initialize
            if (symbolReader != null)
            {
                return(false);
            }

            // Create new scanner, first available scanner will be used.
            symbolReader = new Reader();

            // Create scanner data
            symbolReaderData = new ReaderData(ReaderDataTypes.Text,ReaderDataLengths.DefaultText);

            // Create event handler delegate

            symbolReader.ReadNotify += new EventHandler(symbolReader_ReadNotify);

            // Enable scanner, with wait cursor
            symbolReader.Actions.Enable();

            symbolReader.Actions.GetParameters();

            // Setup scanner
            symbolReader.Parameters.Feedback.Success.BeepTime = 0;
            symbolReader.Parameters.Feedback.Success.WaveFile = "\\windows\\alarm3.wav";

            // Для чтения кодов плохого качества
            symbolReader.Decoders.CODE128.Enabled       = true;
            symbolReader.Decoders.CODE128.EAN128        = true;
            symbolReader.Decoders.CODE128.SecurityLevel = CODE128.SECURITYLEVEL.LEVEL_3;
            symbolReader.Decoders.CODE128.Redundancy    = false;
            symbolReader.Decoders.CODE128.Other128      = true;
            symbolReader.Decoders.CODE128.MaximumLength = 55;

            symbolReader.Decoders.I2OF5.Enabled       = true;
            symbolReader.Decoders.I2OF5.MaximumLength = 30;

            symbolReader.Decoders.RSS14.Enabled          =
                symbolReader.Decoders.RSSEXP.Enabled     =
                    symbolReader.Decoders.RSSLIM.Enabled = true;

            symbolReader.Decoders.RSSEXP.MaximumLength = 76;

            symbolReader.Actions.SetParameters();

            // Настройка WiFi отображения
            try
            {
                xWLan     = new WLAN(FusionAccessType.STATISTICS_MODE);
                base.WiFi = new SymWiFi(xWLan);
            }
            catch (Exception e)
            {
                //xRadio = new Radio();
                //base.WiFi = new SymWiFi(xRadio);
            }

            return(true);
        }
        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();
        }
Beispiel #4
0
        private Profile getProfileByName(string profileName, WLAN myNewWlan)
        {
            Symbol.Fusion.WLAN.Profiles myProfiles = myNewWlan.Profiles;

            for (int profileIndex = 0; profileIndex < myProfiles.Length; profileIndex++)
            {
                Profile myProfile = myProfiles[profileIndex];
                if (profileName == myProfile.Name)
                {
                    return(myProfile);
                }
            }
            return(null);
        }
            //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);
            }
            public SymWiFi(WLAN x) : base()
            {
                cSym = new CustPB(this, "cSym");
                base.pgbWiFiIndicator = cSym;
                base.ConfigTextBox(31, 24, 164, 16);
                //base.STB.BringToFront();
                //base.STB.Refresh();

                //bUseFusion = true;
                //xWiFiCard = x.Adapters[0];
                try
                {
                    xWiFiCard         = x.Adapters[0];
                    x.EventResolution = 2000;
                    SetMAC(xWiFiCard.MacAddressRaw);
                }
                catch
                {
                    sMACAddr = "000000000000";
                }
            }
Beispiel #7
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);
            }
        }