Beispiel #1
0
        public void Copy(Source_Antenna from)
        {
            this.port = from.Port;

            this.antennaResult.Copy(from.antennaResult);
            this.antennaConfig.Copy(from.antennaConfig);
        }
        public override object ConvertFrom
        (
            System.ComponentModel.ITypeDescriptorContext context,
            System.Globalization.CultureInfo culture,
            Object value
        )
        {
            if (String.IsNullOrEmpty(value as string))
            {
                return(null); // TODO : supply err msg
            }

            String[] antennaData = (value as String).Split(new Char[] { ',' });

            if (null == antennaData)
            {
                return(null); // TODO : supply err msg ~ improper arg
            }

            if (7 != antennaData.Length) // 8 with threshold value
            {
                return(null);            // TODO : supply err msg ~ improper arg count
            }

            try
            {
                // TODO : split out parsing ? to better define which parms bad...

                Source_Antenna antenna = new Source_Antenna(byte.Parse(antennaData[0]));

                rfid.Constants.AntennaPortState state =
                    (rfid.Constants.AntennaPortState)Enum.Parse
                    (
                        typeof(rfid.Constants.AntennaPortState),
                        antennaData[1].ToUpper( )
                    );

                antenna.State                 = state;
                antenna.PowerLevel            = UInt16.Parse(antennaData[2]);
                antenna.DwellTime             = UInt16.Parse(antennaData[3]);
                antenna.NumberInventoryCycles = UInt16.Parse(antennaData[4]);
                antenna.PhysicalPort          = byte.Parse(antennaData[5]);

                // Currently Rx is explicitly tied to Tx so cannot be set - ignore val
                // antenna.PhysicalRxPort        = UInt32.Parse( antennaData[ 6 ] );

                // now using global threshold not per antenna...
                // antenna.AntennaSenseThreshold = UInt32.Parse( antennaData[ 7 ] );
                antenna.AntennaSenseThreshold = 0; // if using Source_Antenna to store, uses glob var

                return(antenna);
            }
            catch (Exception)
            {
                // TODO : supply err msg ~ bad arg

                return(null);
            }
        }
        public override object ConvertFrom(
            System.ComponentModel.ITypeDescriptorContext context,
            System.Globalization.CultureInfo             culture,
            Object                                       value
        )
        {
            if ( String.IsNullOrEmpty( value as string ) )
            {
                return null; // TODO : supply err msg
            }

            String[ ] antennaData = ( value as String ).Split( new Char[ ] { ',' } );

            if ( null == antennaData )
            {
                return null; // TODO : supply err msg ~ improper arg
            }

            if ( 7 != antennaData.Length ) // 8 with threshold value
            {
                return null; // TODO : supply err msg ~ improper arg count
            }

            try
            {
                // TODO : split out parsing ? to better define which parms bad...

                Source_Antenna antenna = new Source_Antenna( byte.Parse( antennaData[ 0 ] ) );

                rfid.Constants.AntennaPortState state =
                    ( rfid.Constants.AntennaPortState ) Enum.Parse
                    (
                        typeof( rfid.Constants.AntennaPortState ),
                        antennaData[ 1 ].ToUpper( )
                    );

                antenna.State                 = state;
                antenna.PowerLevel            = UInt16.Parse(antennaData[2]);
                antenna.DwellTime             = UInt16.Parse( antennaData[ 3 ] );
                antenna.NumberInventoryCycles = UInt16.Parse( antennaData[ 4 ] );
                antenna.PhysicalPort          = byte.Parse( antennaData[ 5 ] );

                // Currently Rx is explicitly tied to Tx so cannot be set - ignore val
                // antenna.PhysicalRxPort        = UInt32.Parse( antennaData[ 6 ] );

                // now using global threshold not per antenna...
                // antenna.AntennaSenseThreshold = UInt32.Parse( antennaData[ 7 ] );
                antenna.AntennaSenseThreshold = 0; // if using Source_Antenna to store, uses glob var

                return antenna;
            }
            catch ( Exception )
            {
                // TODO : supply err msg ~ bad arg

                return null;
            }
        }
Beispiel #4
0
 public Source_Antenna
 (
     Source_Antenna antenna
 )
     :
     this(0)
 {
     this.Copy(antenna);
 }
Beispiel #5
0
        public bool Equals(Source_Antenna rhs)
        {
            if (null == (System.Object)rhs)
            {
                return(false);
            }

            return
                (this.port == rhs.port &&
                 this.antennaResult.Equals(rhs.antennaResult) &&
                 this.antennaConfig.Equals(rhs.antennaResult));
        }
Beispiel #6
0
        public override bool Equals(System.Object obj)
        {
            if (null == obj)
            {
                return(false);
            }

            Source_Antenna rhs = obj as Source_Antenna;

            if (null == (System.Object)rhs)
            {
                return(false);
            }

            return(this.Equals(rhs));
        }
Beispiel #7
0
        public AntennaEditForm( LakeChabotReader reader, Source_Antenna antenna )
        {
            this.reader     = reader;

            this.antennaMaster = antenna;
            this.antennaActive = new Source_Antenna( antenna );

            InitializeComponent( );

            //Logic Port
            antennaNumberLabel.Text = String.Format( "Antenna {0}", antennaActive.Port );

            //Status
            foreach (rfid.Constants.AntennaPortState item in Enum.GetValues( typeof( rfid.Constants.AntennaPortState ) ))
            {
                state.Items.Add(item);
            }
            state.Items.Remove(rfid.Constants.AntennaPortState.UNKNOWN);

            state.SelectedIndex =
                antennaActive.State == rfid.Constants.AntennaPortState.DISABLED
                ? 0 : 1;

            state.SelectedValueChanged += state_SelectedValueChanged;

            //clark. Set the limit of port number  Aotomatically
            PhysicalPort.Minimum = Source_Antenna.PHY_MINIMUM;
            PhysicalPort.Maximum = Source_Antenna.PHY_MAXIMUM;
            PhysicalPort.DataBindings.Add( "Value", this.antennaActive, "PhysicalPort" );

            dwellTime.Minimum = 0;
            dwellTime.Maximum = 1000000;
            dwellTime.DataBindings.Add( "Value", this.antennaActive, "DwellTime" );

            inventoryCycles.Minimum = 0;
            inventoryCycles.Maximum = 1000000;
            inventoryCycles.DataBindings.Add( "Value", this.antennaActive, "NumberInventoryCycles" );

            //Clark 2011.2.21 Cpoied from R1000 Tracer
            powerLevel.Minimum = Source_Antenna.POWER_MINIMUM;
            powerLevel.Maximum = Source_Antenna.POWER_MAXIMUM;
            powerLevel.DataBindings.Add( "Value", this.antennaActive, "PowerLevel" );
        }
        public override object ConvertTo
        (
            System.ComponentModel.ITypeDescriptorContext context,
            System.Globalization.CultureInfo culture,
            object value,
            Type destinationType
        )
        {
            if (typeof(string) == destinationType)
            {
                Source_Antenna antenna = value as Source_Antenna;

                if (null == antenna)
                {
                    throw new ArgumentException("Expected a Source_Antenna", "value");
                }

                StringBuilder sb = new StringBuilder( );

                sb.AppendFormat
                (
                    "{0},{1},{2},{3},{4},{5}", // ,{7}", if with threshold value
                    antenna.Port,
                    antenna.State,
                    antenna.PowerLevel,
                    antenna.DwellTime,
                    antenna.NumberInventoryCycles,
                    antenna.PhysicalPort
                    //antenna.AntennaSenseThreshold
                );

                return(sb.ToString( ));
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
 public Source_Antenna(
     Source_Antenna antenna
 )
     : this(0)
 {
     this.Copy( antenna );
 }
        public bool Equals( Source_Antenna rhs )
        {
            if ( null == ( System.Object ) rhs )
            {
                return false;
            }

            return
                   this.port == rhs.port
                && this.antennaResult.Equals( rhs.antennaResult )
                && this.antennaConfig.Equals( rhs.antennaResult );
        }
        public void Copy( Source_Antenna from )
        {
            this.port = from.Port;

            this.antennaResult.Copy( from.antennaResult );
            this.antennaConfig.Copy( from.antennaConfig );
        }