RFID.RFIDInterface.Source_QueryParms.load C# (CSharp) Method

load() public method

public load ( rfid transport, UInt32 readerHandle ) : rfid.Constants.Result
transport rfid
readerHandle System.UInt32
return rfid.Constants.Result
        public rfid.Constants.Result load(
            rfid.Linkage transport,
            UInt32       readerHandle
        )
        {
            Result result;

            result = transport.API_l8K6CGetQueryTagGroup( ref this.nativeTagGroup);

            if (Result.OK != result)
            {
                return result;
            }

            SingulationAlgorithm algorithm = SingulationAlgorithm.UNKNOWN;

            result = transport.API_l8K6CGetCurrentSingulationAlgorithm(ref algorithm);

            if (Result.OK != result)
            {
                return result;
            }

            switch (algorithm)
            {
                case SingulationAlgorithm.FIXEDQ:
                    {
                        this.nativeSingulationParms = new FixedQParms();
                    }
                    break;
                case SingulationAlgorithm.DYNAMICQ:
                    {
                        this.nativeSingulationParms = new DynamicQParms();
                    }
                    break;
                //case SingulationAlgorithm.DYNAMICQ_ADJUST:
                //    {

                //    }
                //    break;
                //case SingulationAlgorithm.DYNAMICQ_THRESHOLD:
                //    {

                //    }
                //    break;

                default:
                    {
                        return Result.DRIVER_MISMATCH;
                    }
            }

            result = transport.API_l8K6CGetSingulationAlgorithmParameters
                (
                    algorithm,
                    ref this.nativeSingulationParms
                );

            if ( Result.OK == result )
            {

                Type algoType = this.nativeSingulationParms.GetType();

                if (algoType == typeof(rfid.Structures.FixedQParms))
                {
                    this.sourceParameters = new Source_SingulationParametersFixedQ
                        (
                            ( rfid.Structures.FixedQParms ) this.nativeSingulationParms
                        );
                }
                else if (algoType == typeof(rfid.Structures.DynamicQParms))
                {
                    this.sourceParameters = new Source_SingulationParametersDynamicQ
                        (
                            ( rfid.Structures.DynamicQParms ) this.nativeSingulationParms
                        );
                }
                 else
                 {
                    System.Windows.Forms.MessageBox.Show( "ERR : Algorithm.Copy( Source_QueryParms from )" );
                    Console.WriteLine( "ERR : Algorithm.Copy( Source_QueryParms from )" );
                 }
            }

            return result;
        }

Usage Example

        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 );
        }
All Usage Examples Of RFID.RFIDInterface.Source_QueryParms::load