示例#1
0
//===============================Event==============================================
        private void RFTest_FormClosing(object sender, FormClosingEventArgs e)
        {
            //If do something, can't close the window.
            FunctionControl.FunctionState newState =
                m_mainForm.ActiveControler == null ? FunctionControl.FunctionState.Unknown : m_mainForm.ActiveControler.State;

            if (newState == FunctionControl.FunctionState.Unknown ||
                newState != FunctionControl.FunctionState.Idle ||
                m_bInRfOn == true)
            {
                e.Cancel = true;
                return;
            }

            //Set Frequency to hopping
            m_btChannelFlag = 0;
            m_reader.API_TestSetFrequencyConfiguration(m_btChannelFlag, m_uiExactFrequecny);

            //Remove Event
            m_mainForm.BindAllFunctionControlers(FunctionStateChanged, false);
        }
示例#2
0
        public RFTest(RFID_Explorer.mainForm r_form, LakeChabotReader rm_reader)
        {
            InitializeComponent();

            m_mainForm = r_form;
            m_reader   = rm_reader;

            //Initial value
            ckboxErrorKeepRunning.Checked = m_mainForm.bErrorKeepRunning;

            //Read Data from module
            m_reader.API_TestGetAntennaPortConfiguration(ref m_btPhysicalPort, ref m_usPowerLevel);
            m_reader.API_TestGetFrequencyConfiguration(ref m_btChannelFlag, ref m_uiExactFrequecny);
            m_reader.API_TestGetRandomDataPulseTime(ref m_uiPulseOnTime, ref m_uiPulseOffTime);

            //regionComboBox
            try
            {
                m_macRegion = m_reader.RegulatoryRegion;

            }
            catch (rfidReaderException exp)
            {
                cmbBoxRegion.Text = exp.Message;
            }
            cmbBoxRegion.Items.Add(m_macRegion);
            cmbBoxRegion.SelectedIndex = 0;

            //Frequency
            switch(m_macRegion)
            {
                case MacRegion.US:
                    foreach ( ENUM_RF_US item in Enum.GetValues(typeof(ENUM_RF_US)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.EU:
                    foreach ( ENUM_RF_EU item in Enum.GetValues(typeof(ENUM_RF_EU)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.JP:
                    foreach ( ENUM_RF_JP item in Enum.GetValues(typeof(ENUM_RF_JP)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.EU2:
                    foreach ( ENUM_RF_EU2 item in Enum.GetValues(typeof(ENUM_RF_EU2)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.TW:
                    foreach ( ENUM_RF_TW item in Enum.GetValues(typeof(ENUM_RF_TW)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.CN:
                    foreach ( ENUM_RF_CN item in Enum.GetValues(typeof(ENUM_RF_CN)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.KR:
                    foreach ( ENUM_RF_KR item in Enum.GetValues(typeof(ENUM_RF_KR)) )
                    {
                       cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.AU:
                    foreach ( ENUM_RF_AU item in Enum.GetValues(typeof(ENUM_RF_AU)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.BR:
                    foreach ( ENUM_RF_BR item in Enum.GetValues(typeof(ENUM_RF_BR)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.HK:
                    foreach ( ENUM_RF_HK item in Enum.GetValues(typeof(ENUM_RF_HK)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.MY:
                    foreach ( ENUM_RF_MY item in Enum.GetValues(typeof(ENUM_RF_MY)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.SG:
                    foreach ( ENUM_RF_SG item in Enum.GetValues(typeof(ENUM_RF_SG)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.TH:
                    foreach ( ENUM_RF_TH item in Enum.GetValues(typeof(ENUM_RF_TH)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.IL:
                    foreach ( ENUM_RF_IL item in Enum.GetValues(typeof(ENUM_RF_IL)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.RU:
                    foreach ( ENUM_RF_RU item in Enum.GetValues(typeof(ENUM_RF_RU)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.IN:
                    foreach ( ENUM_RF_IN item in Enum.GetValues(typeof(ENUM_RF_IN)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.SA:
                    foreach ( ENUM_RF_SA item in Enum.GetValues(typeof(ENUM_RF_SA)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.JO:
                    foreach ( ENUM_RF_JO item in Enum.GetValues(typeof(ENUM_RF_JO)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                case MacRegion.MX:
                    foreach ( ENUM_RF_MX item in Enum.GetValues(typeof(ENUM_RF_MX)) )
                    {
                        cmbBoxFreq.Items.Add( String.Format("{0:000.000}", (float)item/1000) );
                    }
                    break;

                //clark 2011.9.13
                case MacRegion.CUSTOMER:
                    //Set cmbBoxFreq's type to Non-ReadOnly.
                    cmbBoxFreq.DropDownStyle = ComboBoxStyle.DropDown;
                    cmbBoxFreq.Items.Add( "000.000" );

                    string strCustomerRegion = "";
                    Result result = m_reader.API_MacGetCustomerRegion( ref strCustomerRegion );

                    cmbBoxRegion.Items.Clear();
                    switch(result)
                    {
                        case Result.OK:
                            //Show customer config name
                            cmbBoxRegion.Items.Add(strCustomerRegion);
                            break;

                        case Result.NOT_SUPPORTED:
                            cmbBoxRegion.Items.Add("Not support customer");
                            btnRfOn.Enabled      = false;
                            btnRfOff.Enabled     = false;
                            btnRF.Enabled = false;//btnRF Combine
                            btnInventory.Enabled = false;
                            btnPulse.Enabled     = false;
                            btnClear.Enabled     = false;
                            break;

                       case Result.FAILURE:
                       default:
                            cmbBoxRegion.Items.Add("Get customer fail");
                            btnRfOn.Enabled      = false;
                            btnRfOff.Enabled     = false;
                            btnRF.Enabled = false;//btnRF Combine
                            btnInventory.Enabled = false;
                            btnPulse.Enabled     = false;
                            btnClear.Enabled     = false;
                            break;
                    }
                    cmbBoxRegion.SelectedIndex = 0;
                    break;

                case MacRegion.UNKNOWN:
                default:
                    cmbBoxFreq.Items.Add(MacRegion.UNKNOWN);
                    btnRfOn.Enabled      = false;
                    btnRfOff.Enabled     = false;
                    btnRF.Enabled = false;//btnRF Combine
                    btnInventory.Enabled = false;
                    btnPulse.Enabled     = false;
                    btnClear.Enabled     = false;
                    break;
            }
            cmbBoxFreq.SelectedIndex   = 0;

            //RF Channel Radio Button
            if (m_btChannelFlag == 0)
                rdoBtnMultiChannel.Checked = true;
            else
                rdoBtnSingleChannel.Checked = true;

            //Port Radio Button
            if (AddAntPort() == false)
            {
                cmbBoxFreq.Items.Add(MacRegion.UNKNOWN);
                btnRfOn.Enabled      = false;
                btnRfOff.Enabled     = false;
                btnRF.Enabled = false;//btnRF Combine
                btnInventory.Enabled = false;
                btnPulse.Enabled     = false;
                cmbAntPort.Items.Add(ENUM_ANT_PORT.UNKNOWN);

                cmbAntPort.SelectedIndex = cmbAntPort.Items.IndexOf(ENUM_ANT_PORT.UNKNOWN);
                return;
            }

            //Pulse Time
            numPulseOnTime.Maximum  = PULSE_TIME_MAX/1000;
            numPulseOnTime.Minimum  = PULSE_TIME_MIN/1000;
            numPulseOffTime.Maximum = PULSE_TIME_MAX/1000;
            numPulseOffTime.Minimum = PULSE_TIME_MIN/1000;
            numPulseOnTime.Value    = (m_uiPulseOnTime > 0)  ? m_uiPulseOnTime/ 1000  : numPulseOnTime.Minimum;     //us to ms
            numPulseOffTime.Value   = (m_uiPulseOffTime > 0) ? m_uiPulseOffTime/ 1000 : numPulseOffTime.Minimum;   //us to ms

            //Set Event
            m_mainForm.CurrentContextChanged += new EventHandler(CurrentContextChanged);
            m_mainForm.BindAllFunctionControlers(FunctionStateChanged, true);
        }
示例#3
0
        public RFTest(RFID_Explorer.mainForm r_form, LakeChabotReader rm_reader)
        {
            InitializeComponent();

            m_mainForm = r_form;
            m_reader   = rm_reader;

            //Initial value
            ckboxErrorKeepRunning.Checked = m_mainForm.bErrorKeepRunning;


            //Read Data from module
            m_reader.API_TestGetAntennaPortConfiguration(ref m_btPhysicalPort, ref m_usPowerLevel);
            m_reader.API_TestGetFrequencyConfiguration(ref m_btChannelFlag, ref m_uiExactFrequecny);
            m_reader.API_TestGetRandomDataPulseTime(ref m_uiPulseOnTime, ref m_uiPulseOffTime);


            //regionComboBox
            try
            {
                m_macRegion = m_reader.RegulatoryRegion;
            }
            catch (rfidReaderException exp)
            {
                cmbBoxRegion.Text = exp.Message;
            }
            cmbBoxRegion.Items.Add(m_macRegion);
            cmbBoxRegion.SelectedIndex = 0;


            //Frequency
            switch (m_macRegion)
            {
            case MacRegion.US:
                foreach (ENUM_RF_US item in Enum.GetValues(typeof(ENUM_RF_US)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.EU:
                foreach (ENUM_RF_EU item in Enum.GetValues(typeof(ENUM_RF_EU)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.JP:
                foreach (ENUM_RF_JP item in Enum.GetValues(typeof(ENUM_RF_JP)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.EU2:
                foreach (ENUM_RF_EU2 item in Enum.GetValues(typeof(ENUM_RF_EU2)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.TW:
                foreach (ENUM_RF_TW item in Enum.GetValues(typeof(ENUM_RF_TW)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.CN:
                foreach (ENUM_RF_CN item in Enum.GetValues(typeof(ENUM_RF_CN)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.KR:
                foreach (ENUM_RF_KR item in Enum.GetValues(typeof(ENUM_RF_KR)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.AU:
                foreach (ENUM_RF_AU item in Enum.GetValues(typeof(ENUM_RF_AU)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.BR:
                foreach (ENUM_RF_BR item in Enum.GetValues(typeof(ENUM_RF_BR)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.HK:
                foreach (ENUM_RF_HK item in Enum.GetValues(typeof(ENUM_RF_HK)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.MY:
                foreach (ENUM_RF_MY item in Enum.GetValues(typeof(ENUM_RF_MY)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.SG:
                foreach (ENUM_RF_SG item in Enum.GetValues(typeof(ENUM_RF_SG)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.TH:
                foreach (ENUM_RF_TH item in Enum.GetValues(typeof(ENUM_RF_TH)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.IL:
                foreach (ENUM_RF_IL item in Enum.GetValues(typeof(ENUM_RF_IL)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.RU:
                foreach (ENUM_RF_RU item in Enum.GetValues(typeof(ENUM_RF_RU)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.IN:
                foreach (ENUM_RF_IN item in Enum.GetValues(typeof(ENUM_RF_IN)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.SA:
                foreach (ENUM_RF_SA item in Enum.GetValues(typeof(ENUM_RF_SA)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.JO:
                foreach (ENUM_RF_JO item in Enum.GetValues(typeof(ENUM_RF_JO)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            case MacRegion.MX:
                foreach (ENUM_RF_MX item in Enum.GetValues(typeof(ENUM_RF_MX)))
                {
                    cmbBoxFreq.Items.Add(String.Format("{0:000.000}", (float)item / 1000));
                }
                break;

            //clark 2011.9.13
            case MacRegion.CUSTOMER:
                //Set cmbBoxFreq's type to Non-ReadOnly.
                cmbBoxFreq.DropDownStyle = ComboBoxStyle.DropDown;
                cmbBoxFreq.Items.Add("000.000");

                string strCustomerRegion = "";
                Result result            = m_reader.API_MacGetCustomerRegion(ref strCustomerRegion);

                cmbBoxRegion.Items.Clear();
                switch (result)
                {
                case Result.OK:
                    //Show customer config name
                    cmbBoxRegion.Items.Add(strCustomerRegion);
                    break;

                case Result.NOT_SUPPORTED:
                    cmbBoxRegion.Items.Add("Not support customer");
                    btnRfOn.Enabled      = false;
                    btnRfOff.Enabled     = false;
                    btnRF.Enabled        = false; //btnRF Combine
                    btnInventory.Enabled = false;
                    btnPulse.Enabled     = false;
                    btnClear.Enabled     = false;
                    break;


                case Result.FAILURE:
                default:
                    cmbBoxRegion.Items.Add("Get customer fail");
                    btnRfOn.Enabled      = false;
                    btnRfOff.Enabled     = false;
                    btnRF.Enabled        = false; //btnRF Combine
                    btnInventory.Enabled = false;
                    btnPulse.Enabled     = false;
                    btnClear.Enabled     = false;
                    break;
                }
                cmbBoxRegion.SelectedIndex = 0;
                break;

            case MacRegion.UNKNOWN:
            default:
                cmbBoxFreq.Items.Add(MacRegion.UNKNOWN);
                btnRfOn.Enabled      = false;
                btnRfOff.Enabled     = false;
                btnRF.Enabled        = false;//btnRF Combine
                btnInventory.Enabled = false;
                btnPulse.Enabled     = false;
                btnClear.Enabled     = false;
                break;
            }
            cmbBoxFreq.SelectedIndex = 0;



            //RF Channel Radio Button
            if (m_btChannelFlag == 0)
            {
                rdoBtnMultiChannel.Checked = true;
            }
            else
            {
                rdoBtnSingleChannel.Checked = true;
            }



            //Port Radio Button
            if (AddAntPort() == false)
            {
                cmbBoxFreq.Items.Add(MacRegion.UNKNOWN);
                btnRfOn.Enabled      = false;
                btnRfOff.Enabled     = false;
                btnRF.Enabled        = false;//btnRF Combine
                btnInventory.Enabled = false;
                btnPulse.Enabled     = false;
                cmbAntPort.Items.Add(ENUM_ANT_PORT.UNKNOWN);

                cmbAntPort.SelectedIndex = cmbAntPort.Items.IndexOf(ENUM_ANT_PORT.UNKNOWN);
                return;
            }



            //Pulse Time
            numPulseOnTime.Maximum  = PULSE_TIME_MAX / 1000;
            numPulseOnTime.Minimum  = PULSE_TIME_MIN / 1000;
            numPulseOffTime.Maximum = PULSE_TIME_MAX / 1000;
            numPulseOffTime.Minimum = PULSE_TIME_MIN / 1000;
            numPulseOnTime.Value    = (m_uiPulseOnTime > 0)  ? m_uiPulseOnTime / 1000  : numPulseOnTime.Minimum;   //us to ms
            numPulseOffTime.Value   = (m_uiPulseOffTime > 0) ? m_uiPulseOffTime / 1000 : numPulseOffTime.Minimum;  //us to ms


            //Set Event
            m_mainForm.CurrentContextChanged += new EventHandler(CurrentContextChanged);
            m_mainForm.BindAllFunctionControlers(FunctionStateChanged, true);
        }