public RFChannelEditForm( LakeChabotReader reader, Source_FrequencyBand channel ) { this.reader = reader; this.channelMaster = channel; this.channelActive = new Source_FrequencyBand( channel ); InitializeComponent( ); channelSlotNumber.Text = String.Format( "RF Channel Slot {0}", this.channelActive.Band ); foreach (Source_FrequencyBand.BandState item in Enum.GetValues(typeof(Source_FrequencyBand.BandState))) { this.state.Items.Add(item); } this.state.Items.Remove(Source_FrequencyBand.BandState.UNKNOWN); state.SelectedIndex = channelActive.State == Source_FrequencyBand.BandState.DISABLED ? 0 : 1; state.SelectedValueChanged += state_SelectedValueChanged; this.multiplyRatio.DataBindings.Add( "Value", this.channelActive, "MultiplyRatio" ); this.divideRatio.DataBindings.Add( "Value", this.channelActive, "DivideRatio" ); this.minimumDAC.DataBindings.Add( "Value", this.channelActive, "MinimumDACBand" ); this.affinityBand.DataBindings.Add( "Value", this.channelActive, "AffinityBand" ); this.maximumDAC.DataBindings.Add( "Value", this.channelActive, "MaximumDACBand" ); this.guardBand.DataBindings.Add( "Value", this.channelActive, "GuardBand" ); }
public Source_FrequencyBand ( Source_FrequencyBand frequencyBand ) : base( ) { this.Copy(frequencyBand); }
public void Copy(Source_FrequencyBand from) { this.band = from.band; this.state = from.state; this.multiplier = from.multiplier; this.divider = from.divider; this.minDACBand = from.minDACBand; this.affinityBand = from.affinityBand; this.maxDACBand = from.maxDACBand; this.guardBand = from.guardBand; }
public override bool Equals(System.Object obj) { if (null == obj) { return(false); } Source_FrequencyBand rhs = obj as Source_FrequencyBand; if (null == (System.Object)rhs) { return(false); } return(this.Equals(rhs)); }
public bool Equals(Source_FrequencyBand rhs) { if (null == (System.Object)rhs) { return(false); } return (this.band == rhs.band && this.state == rhs.state && this.multiplier == rhs.multiplier && this.divider == rhs.divider && this.minDACBand == rhs.minDACBand && this.affinityBand == rhs.affinityBand && this.maxDACBand == rhs.maxDACBand && this.guardBand == rhs.guardBand); }
public override object ConvertTo ( System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType ) { if (typeof(string) == destinationType) { Source_FrequencyBand channel = value as Source_FrequencyBand; if (null == channel) { throw new ArgumentException("Expected a Source_FrequencyBand", "value"); } StringBuilder sb = new StringBuilder( ); sb.AppendFormat ( "{0},{1},{2},{3},{4},{5},{6},{7}", ( UInt32 )channel.band, channel.state.ToString( ), ( UInt16 )channel.multiplier, ( UInt16 )channel.divider, ( UInt16 )channel.guardBand, ( UInt16 )channel.maxDACBand, ( UInt16 )channel.affinityBand, ( UInt16 )channel.minDACBand ); return(sb.ToString( )); } return(base.ConvertTo(context, culture, value, destinationType)); }
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[] channelData = (value as String).Split(new Char[] { ',' }); if (null == channelData) { return(null); // TODO : supply err msg ~ improper arg } if (8 != channelData.Length) { return(null); // TODO : supply err msg ~ improper arg count } try { UInt32 band = UInt32.Parse(channelData[0]); Source_FrequencyBand.BandState state = (Source_FrequencyBand.BandState)Enum.Parse ( typeof(Source_FrequencyBand.BandState), channelData[1] ); UInt16 multiplier = UInt16.Parse(channelData[2]); UInt16 divider = UInt16.Parse(channelData[3]); UInt16 guardBand = UInt16.Parse(channelData[4]); UInt16 maxDACBand = UInt16.Parse(channelData[5]); UInt16 affinityBand = UInt16.Parse(channelData[6]); UInt16 minDACBand = UInt16.Parse(channelData[7]); Source_FrequencyBand channel = new Source_FrequencyBand ( band, state, multiplier, divider, minDACBand, affinityBand, maxDACBand, guardBand ); return(channel); } 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[ ] channelData = ( value as String ).Split( new Char[ ] { ',' } ); if ( null == channelData ) { return null; // TODO : supply err msg ~ improper arg } if ( 8 != channelData.Length ) { return null; // TODO : supply err msg ~ improper arg count } try { UInt32 band = UInt32.Parse( channelData[ 0 ] ); Source_FrequencyBand.BandState state = ( Source_FrequencyBand.BandState ) Enum.Parse ( typeof( Source_FrequencyBand.BandState ), channelData[ 1 ] ); UInt16 multiplier = UInt16.Parse( channelData[ 2 ] ); UInt16 divider = UInt16.Parse( channelData[ 3 ] ); UInt16 guardBand = UInt16.Parse( channelData[ 4 ] ); UInt16 maxDACBand = UInt16.Parse( channelData[ 5 ] ); UInt16 affinityBand = UInt16.Parse( channelData[ 6 ] ); UInt16 minDACBand = UInt16.Parse( channelData[ 7 ] ); Source_FrequencyBand channel = new Source_FrequencyBand ( band, state, multiplier, divider, minDACBand, affinityBand, maxDACBand, guardBand ); return channel; } catch ( Exception ) { // TODO : supply err msg ~ bad arg return null; } }
private void okButton_Click( object sender, EventArgs e ) { rfid.Constants.Result result = rfid.Constants.Result.OK; try { result = this.channelActive.store( LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle ); } catch ( Exception exp ) { MessageBox.Show( "Reader Error.\n\nAn error occurred while updating the frequency channel settings.\n\nThe follow error occurred: " + exp.Message, "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } if ( rfid.Constants.Result.OK != result ) { MessageBox.Show( "Reader Error.\n\nThe Reader was unable to configure the specified frequency channel settings.\n\nThe follow error occurred: " + result.ToString( ), "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } // Need to retrieve the affinityBand value since potentially // modified by the radio during set operation(s) Source_FrequencyBand channelUpdated = new Source_FrequencyBand( channelActive.Band ); try { result = channelUpdated.load( LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle ); } catch ( Exception exp ) { MessageBox.Show( "Reader Error.\n\nAn error occurred while retrieving updated frequency channel information.\n\nThe follow error occurred: " + exp.Message, "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } if ( rfid.Constants.Result.OK != result ) { MessageBox.Show( "Reader Error.\n\nThe Reader was unable to configure the specified frequency channel settings.\n\nThe follow error occurred: " + result.ToString( ), "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } this.channelMaster.Copy( this.channelActive ); DialogResult = DialogResult.OK; }
public Source_FrequencyBand( Source_FrequencyBand frequencyBand ) : base() { this.Copy( frequencyBand ); }
public bool Equals( Source_FrequencyBand rhs ) { if ( null == ( System.Object ) rhs ) { return false; } return this.band == rhs.band && this.state == rhs.state && this.multiplier == rhs.multiplier && this.divider == rhs.divider && this.minDACBand == rhs.minDACBand && this.affinityBand == rhs.affinityBand && this.maxDACBand == rhs.maxDACBand && this.guardBand == rhs.guardBand; }
public void Copy( Source_FrequencyBand from ) { this.band = from.band; this.state = from.state; this.multiplier = from.multiplier; this.divider = from.divider; this.minDACBand = from.minDACBand; this.affinityBand = from.affinityBand; this.maxDACBand = from.maxDACBand; this.guardBand = from.guardBand; }