API_MacGetCustomerRegion() public method

public API_MacGetCustomerRegion ( string &r_CustomerRegion ) : Result
r_CustomerRegion string
return Result
        public ConfigureSettingsControl( LakeChabotReader reader )
        {
            if ( reader == null )
            {
                throw new ArgumentNullException( "reader", "Null reader passed to ConfigureGeneral CTOR()" );
            }

            if ( reader.Mode != rfidReader.OperationMode.BoundToReader )
            {
                throw new ArgumentOutOfRangeException( "reader", "Unbound reader passed to ConfigureGeneral()" );
            }

            InitializeComponent( );

            this.reader = reader;

            _timer           = new Timer( );
            _timer.Interval  = 5000;
            _timer.Tick     += new EventHandler( timer_Tick );

            string startupPowerState      = Properties.Settings.Default.startupPowerState;
            string startupOpMode          = Properties.Settings.Default.startupOperationalMode;
            int    startupAlgorithmNumber = Properties.Settings.Default.startupInventoryAlgorithm;

            rfid.Constants.Result result = rfid.Constants.Result.OK;

            //Interface radiobutton=============================================================
            UInt32 oemData = 0;
            rfid.Constants.Result status = reader.MacReadOemData( (ushort) enumOEM_ADDR.HOST_IF_SEL,
                                                                   ref     oemData                                );

            if (oemData == (uint)enumPORT.ENUM_PORT_USB)
            {
                rBtn_USB.Checked = true;
                rBtn_UART.Checked = false;
            }
            else
            {
                rBtn_USB.Checked = false;
                rBtn_UART.Checked = true;
            }

            // regionComboBox=============================================================
            ENUM_REGION_RESULT enumMatch = ENUM_REGION_RESULT.FAIL;

            this.macRegion = new Source_MacRegion();
            result = macRegion.load(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle);

            do
            {
                if (rfid.Constants.Result.OK != result)
                {
                    enumMatch = ENUM_REGION_RESULT.FAIL;
                    break;
                }

                UInt32 shift = 1;

                foreach (rfid.Constants.MacRegion item in Enum.GetValues(typeof(rfid.Constants.MacRegion)))
                {

                    do
                    {
                        if ((this.macRegion.MacRegionSupport & shift) <= 0)
                            break;

                        //Add support region to regionComboBox.
                        if (item == rfid.Constants.MacRegion.CUSTOMER)//Customer region uses string.
                        {
                            result = reader.API_MacGetCustomerRegion( ref strCustomerRegion );

                            switch (result)
                            {
                                case rfid.Constants.Result.OK:
                                    regionComboBox.Items.Add(strCustomerRegion);

                                    if (item == this.macRegion.MacRegion)
                                    {
                                        enumMatch = ENUM_REGION_RESULT.CUSTOMER_OK;
                                    }
                                    break;

                                case rfid.Constants.Result.NOT_SUPPORTED:
                                    //Only hide the option.
                                    if (item == this.macRegion.MacRegion)
                                    {
                                        enumMatch = ENUM_REGION_RESULT.CUSTOMER_NON_SUPPORTED;
                                    }
                                    break;

                                case rfid.Constants.Result.FAILURE:
                                default:
                                    enumMatch = ENUM_REGION_RESULT.CUSTOMER_FAIL;
                                    break;
                            }

                        }
                        else
                        {
                            //Other region uses enum.
                            regionComboBox.Items.Add(item);

                            //Check match region between support and current region setting.
                            if (item == this.macRegion.MacRegion)
                            {
                                enumMatch = ENUM_REGION_RESULT.OK;
                            }
                        }

                    }while(false);

                    shift <<= 0x01;
                }

            }while(false);

            switch (enumMatch)
            {
                case ENUM_REGION_RESULT.OK:
                    regionComboBox.SelectedIndex = regionComboBox.Items.IndexOf(this.macRegion.MacRegion);
                    break;

                case ENUM_REGION_RESULT.FAIL:
                    RegionError("Read region unsuccessfully");
                    break;

                case ENUM_REGION_RESULT.CUSTOMER_OK:
                    //Customer region uses string.
                    regionComboBox.SelectedIndex = regionComboBox.Items.IndexOf(strCustomerRegion);
                    break;

                case ENUM_REGION_RESULT.CUSTOMER_NON_SUPPORTED:
                    RegionError("Not support customer region");
                    break;

                case ENUM_REGION_RESULT.CUSTOMER_FAIL:
                    RegionError("Get customer region fail");
                    break;

                case ENUM_REGION_RESULT.NOT_MATCH:
                    RegionError("Region deosn't match \"RegionSupport\".");
                    break;
            }

            // profileComboBox=============================================================
            this.profileList = new Source_LinkProfileList ( LakeChabotReader.MANAGED_ACCESS,
                                                            this.reader.ReaderHandle );

            this.profileList.load( );

            int count = 0;

            foreach ( Source_LinkProfile linkProfile in profileList )
            {
                profileComboBox.Items.Add( count + " : " + linkProfile.ToString( ) );

                ++ count;
            }

            profileComboBox.SelectedIndex = ( int ) profileList.getActiveProfileIndex( );

            this.profileComboBox.SelectedIndexChanged += new System.EventHandler( this.profileComboBox_SelectedIndexChanged );

            // Currently out of sync with 'new' model ~ no explicit read done
            // here or source provided ~ done via reader call...
            foreach ( rfid.Constants.SingulationAlgorithm item in Enum.GetValues( typeof( rfid.Constants.SingulationAlgorithm ) ) )
            {
                algorithmComboBox.Items.Add( item );
            }
            algorithmComboBox.Items.Remove(rfid.Constants.SingulationAlgorithm.UNKNOWN);

            // skipping err checking on these shortcut methods...

            Source_QueryParms queryParms = new Source_QueryParms( );

            queryParms.load( LakeChabotReader.MANAGED_ACCESS, reader.ReaderHandle );

            algorithmComboBox.SelectedIndex = algorithmComboBox.Items.IndexOf
                (
                    queryParms.SingulationAlgorithm
                );

            algorithmComboBox.SelectedIndexChanged += new System.EventHandler( this.algorithmComboBox_SelectedIndexChanged );
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public ReturnLoss(RFID_Explorer.mainForm r_form, LakeChabotReader rm_reader)
        {
            InitializeComponent();

            string  strBmpPath = Path.Combine( Application.CommonAppDataPath, BMP_NAME);
            //string strBmpPath = Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData),
            //                                  Application.CommonAppDataPath );  //;  //Path.GetTempFileName\
               // string strBmpPath = Path.Combine( Application.CommonAppDataPath, BMP_NAME);

            m_mainForm = r_form;
            m_reader   = rm_reader;

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

            //Thread function
            dlgSetComboFreq      = new SET_COMBO_FREQ( SetComboFreq );
            dlgShowErrMsg        = new SHOW_ERR_MSG( ShowErrMsg );
            dlgShowPaint         = new SHOW_PAINT( ShowPaint );
            dlgSetCurValueToText = new SET_CUR_VALUE_TO_TEXT( SetCurValueToText );
            dlgDrawString        = new DRAW_STRING(DrawString);

            //Graphic
            PaintPanel.Controls.Add(picPaint);
            m_Graphics    = picPaint.CreateGraphics();                     //Link between Graphics and panel
            m_PaintBmp    = new Bitmap(picPaint.Width, picPaint.Height);   //Create BMP File
            m_PaintBmp.Save(strBmpPath);
            m_PaintBmp.Dispose();
            m_PaintImage  = Image.FromFile(strBmpPath);                      //Open BMP File
            m_GraphicsBmp = Graphics.FromImage(m_PaintImage);              //Link BMP File to Graphics Object
            //m_GraphicsBmp = Graphics.FromImage(m_PaintBmp);

            //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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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) );
                    }
                    cmbBoxFreq.Items.Add( ENUM_RF_COMMON.CHANNEL_ALL );
                    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 = null;
                    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");
                            btnRun.Enabled = false;
                            break;

                       case Result.FAILURE:
                       default:
                            cmbBoxRegion.Items.Add("Get customer fail");
                            btnRun.Enabled = false;
                            break;
                    }
                    cmbBoxRegion.SelectedIndex = 0;
                    break;

                case MacRegion.UNKNOWN:
                default:
                    cmbBoxFreq.Items.Add(MacRegion.UNKNOWN);
                    btnRun.Enabled      = false;
                    break;
            }

            //clark 2011.9.13
            if (m_macRegion != MacRegion.UNKNOWN)
            {
                //Customer doesn't support ENUM_RF_COMMON.CHANNEL_ALL
                if( m_macRegion == MacRegion.CUSTOMER)
                    cmbBoxFreq.SelectedIndex = 0;
                else
                    cmbBoxFreq.SelectedItem = ENUM_RF_COMMON.CHANNEL_ALL;
            }

            //Port Radio Button
            if (AddAntPort() == false)
            {
                cmbBoxFreq.Items.Add(MacRegion.UNKNOWN);
                btnRun.Enabled      = false;
                cmbAntPort.Items.Add(ENUM_ANT_PORT.UNKNOWN);

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