public ConfigureAlgorithm_Edit( LakeChabotReader reader, Source_QueryParms parms )
        {
            InitializeComponent( );

            // The algorithmDisplay is the obj that needs the zero arg constructor
            // so it works via the gui builder in VS... and so needs secondary
            // calls to set the reader and parms...

            algorithmDisplay.setReader( reader );
            algorithmDisplay.setSource( parms );
            algorithmDisplay.MasterEnabled = true; // edit on

            algorithmDisplay.displayData( );
        }
Example #2
0
        public void Copy(Source_QueryParms from)
        {
            // Val parm

            this.TagGroupSelected = from.TagGroupSelected;
            this.TagGroupSession  = from.TagGroupSession;
            this.TagGroupTarget   = from.TagGroupTarget;

            if (from.SingulationAlgorithm == SingulationAlgorithm.FIXEDQ)
            {
                this.nativeSingulationParms = new rfid.Structures.FixedQParms( );

                this.sourceParameters = new Source_SingulationParametersFixedQ
                                        (
                    (rfid.Structures.FixedQParms) this.nativeSingulationParms
                                        );

                (( Source_SingulationParametersFixedQ )this.sourceParameters).Copy
                (
                    ( Source_SingulationParametersFixedQ )from.SingulationAlgorithmParameters
                );
            }
            else if (from.SingulationAlgorithm == SingulationAlgorithm.DYNAMICQ)
            {
                this.nativeSingulationParms = new rfid.Structures.DynamicQParms( );

                this.sourceParameters = new Source_SingulationParametersDynamicQ
                                        (
                    (rfid.Structures.DynamicQParms) this.nativeSingulationParms
                                        );

                (( Source_SingulationParametersDynamicQ )this.sourceParameters).Copy
                (
                    ( Source_SingulationParametersDynamicQ )from.SingulationAlgorithmParameters
                );
            }
            else
            {
                Console.WriteLine("ERR : Algorithm.Copy( Source_QueryParms from )");
            }
        }
        // This is so the widget can be used inside a form window
        // but ( warning ) requires setReader and setSource calls
        // prior to use of other methods or >> BOOM <<
        public ConfigureAlgorithm_Display( )
        {
            InitializeComponent( );

            this.parmsActive = new Source_QueryParms( );

            this.MasterEnabled = false;

            foreach (SingulationAlgorithm item in Enum.GetValues(typeof(SingulationAlgorithm)))
            {
                this.activeAlgorithm.Items.Add(item);
            }
            this.activeAlgorithm.Items.Remove(SingulationAlgorithm.UNKNOWN);

            this.activeAlgorithm.DropDownStyle = ComboBoxStyle.DropDown;
            this.commonParmsPanel.VisibleChanged += new System.EventHandler( this.commonParmsPanel_VisibleChanged );

            foreach (Selected item in Enum.GetValues(typeof(Selected)))
            {
                this.tagGroupSelected.Items.Add(item);
            }
            this.tagGroupSelected.Items.Remove(Selected.UNKNOWN);
            //clark 2011.7.8 Doesn't support reseerved.
            this.tagGroupSelected.Items.Remove(Selected.RESERVED);

            foreach (Session item in Enum.GetValues(typeof(Session)))
            {
                this.tagGroupSession.Items.Add(item);
            }
            this.tagGroupSession.Items.Remove(Session.UNKNOWN);

            foreach (SessionTarget item in Enum.GetValues(typeof(SessionTarget)))
            {
                this.tagGroupTarget.Items.Add(item);
            }
            this.tagGroupTarget.Items.Remove(SessionTarget.UNKNOWN);
        }
        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;

            //Interface radiobutton=============================================================

            do
            {
                UInt32                uiModelNameMajor  = 0;
                string                strModule         = string.Empty;
                rfid.Constants.Result result            = rfid.Constants.Result.OK;

                //Get Model Name
                result  = reader.MacReadOemData((ushort)((int)enumOEM_ADDR.MODEL_NAME_MAIN), ref uiModelNameMajor);
                if (rfid.Constants.Result.OK != result)
                {
                    btn_Update.Enabled = false;
                    break;
                }

                strModule= String.Format( "RU-{0}{1}{2}",
                                          (char)((uiModelNameMajor >> 16) & 0xFF),
                                          (char)((uiModelNameMajor >>  8) & 0xFF),
                                          (char)( uiModelNameMajor        & 0xFF)   );

                if (strModule == "RU-824")
                {
                    rBtn_USB.Checked   = true;
                    btn_Update.Enabled = false;
                    rBtn_UART.Enabled  = false;
                    break;
                }

                if (uiModelNameMajor == 0x4D303258)//0x4D303258==M02X
                {
                    rBtn_UART.Checked = true;
                    btn_Update.Enabled = false;
                    rBtn_USB.Enabled = false;
                    break;
                }

                UInt32 oemData = 0;
                result = reader.MacReadOemData( (ushort) enumOEM_ADDR.HOST_IF_SEL, ref oemData);
                if (rfid.Constants.Result.OK != result)
                {
                    btn_Update.Enabled = false;
                    break;
                }

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

            }while(false);

            //regionComboBox=============================================================
            LoadRegion();

            // 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 );
        }
        protected override void OnVisibleChanged( EventArgs e )
        {
            base.OnVisibleChanged( e );

            if ( this.Visible )
            {
                statusTextBox.Text = "";
                this.initCall = false;

                //Query Parms
                Source_QueryParms queryParms = new Source_QueryParms( );

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

                externalQueryParamsMod = true;

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

                externalQueryParamsMod = false;
            }
        }
        // Set the utilized parameters ( by ref only ) and reset
        // all bindings to utilize it...
        public void setSource( Source_QueryParms parms )
        {
            this.activeAlgorithm.DataBindings.Clear( );
            this.tagGroupSelected.DataBindings.Clear( );
            this.tagGroupSession.DataBindings.Clear( );
            this.tagGroupTarget.DataBindings.Clear( );

            this.parmsMaster = parms;

            this.activeAlgorithm.DataBindings.Add ( "SelectedItem", this.parmsMaster, "SingulationAlgorithm" );
            this.tagGroupSelected.DataBindings.Add( "SelectedItem", this.parmsMaster, "TagGroupSelected" );
            this.tagGroupSession.DataBindings.Add( "SelectedItem", this.parmsMaster, "TagGroupSession" );
            this.tagGroupTarget.DataBindings.Add( "SelectedItem", this.parmsMaster, "TagGroupTarget" );
        }
        public void Copy( Source_QueryParms from )
        {
            // Val parm

            this.TagGroupSelected = from.TagGroupSelected;
            this.TagGroupSession  = from.TagGroupSession;
            this.TagGroupTarget   = from.TagGroupTarget;

            if (from.SingulationAlgorithm == SingulationAlgorithm.FIXEDQ)
            {
                this.nativeSingulationParms = new rfid.Structures.FixedQParms( );

                this.sourceParameters = new Source_SingulationParametersFixedQ
                    (
                        ( rfid.Structures.FixedQParms ) this.nativeSingulationParms
                    );

                    ( ( Source_SingulationParametersFixedQ ) this.sourceParameters ).Copy
                        (
                            ( Source_SingulationParametersFixedQ ) from.SingulationAlgorithmParameters
                        );
            }
            else if (from.SingulationAlgorithm == SingulationAlgorithm.DYNAMICQ)
            {
                this.nativeSingulationParms = new rfid.Structures.DynamicQParms( );

                this.sourceParameters = new Source_SingulationParametersDynamicQ
                    (
                        ( rfid.Structures.DynamicQParms ) this.nativeSingulationParms
                    );

                    ( ( Source_SingulationParametersDynamicQ ) this.sourceParameters ).Copy
                        (
                            ( Source_SingulationParametersDynamicQ ) from.SingulationAlgorithmParameters
                        );
            }
            else
            {
                Console.WriteLine( "ERR : Algorithm.Copy( Source_QueryParms from )" );
            }
        }
        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 );
        }
        protected override void OnVisibleChanged( EventArgs e )
        {
            base.OnVisibleChanged( e );

            if ( this.Visible )
            {
                statusTextBox.Text = "";

                this.initCall = true;

                //Region
                if
                ( rfid.Constants.Result.OK !=
                  macRegion.load( LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle )
                )
                {
                    this.macRegion.MacRegion = rfid.Constants.MacRegion.UNKNOWN;
                }

                //clark 2011.4.26  Check range.
                if (macRegion.MacRegion > 0 && (uint)macRegion.MacRegion < RegionCount)
                {
                    regionComboBox.SelectedIndex = (int)this.macRegion.MacRegion;
                }

                this.initCall = false;

                //Query Parms
                Source_QueryParms queryParms = new Source_QueryParms( );

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

                externalQueryParamsMod = true;

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

                externalQueryParamsMod = false;
            }
        }