//public rfid.Constants.Result load //( // rfid.Linkage transport, // UInt32 readerHandle //) //{ // UInt32[ ] buffer = new UInt32[ OEMCFG_AREA_MAP_SIZE_WORDS ]; // uint length = (uint)buffer.Length; // rfid.Constants.Result Result = transport.MacReadOemData // ( // ( int ) readerHandle, // 0, // ref length, // buffer // ); // if ( rfid.Constants.Result.OK == Result ) // { // buffer.CopyTo( oemDataBuffer, 0 ); // } // return Result; //} //clark 2011.3.23 public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { UInt32[] tmpBuf = new UInt32[OEMCFG_AREA_MAP_SIZE_WORDS]; rfid.Constants.Result Result = rfid.Constants.Result.OK; Array.Clear(tmpBuf, 0, tmpBuf.Length); //MacReadOemData only store one ome at one time. Store all ome to buf. for (ushort index = 0; index < OEMCFG_AREA_MAP_SIZE_WORDS; index++) { Result = transport.API_MacWriteOemData(index, oemDataBuffer[index]); if (rfid.Constants.Result.OK != Result) { return(Result); } } return(Result); }
private void DeviceInterface_Load(object sender, EventArgs e) { do { UInt32 uiModelNameMajor = 0; string strModule = string.Empty; string strModuleSub = string.Empty; rfid.Constants.Result result = rfid.Constants.Result.OK; //Get Model Name result = m_clsInterface.API_MacReadOemData((ushort)((int)enumOEM_ADDR.MODEL_NAME_MAIN), ref uiModelNameMajor); //result = m_clsInterface.API_MacReadOemData((ushort)((int)enumOEM_ADDR.MODEL_NAME_SUB), 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-861") { rBtn_USB.Checked = true; rBtn_UART.Checked = true; btn_Update.Enabled = true; break; } if (strModule == "RU-824") { rBtn_USB.Checked = true; btn_Update.Enabled = false; rBtn_UART.Enabled = false; break; } UInt32 oemData = 0; result = m_clsInterface.API_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); }
// Attempt to load info for all known antennas public rfid.Constants.Result load ( rfid.Linkage transport, UInt32 readerHandle ) { this.Clear( ); for (UInt32 band = 0; band < RFID.RFIDInterface.Properties.Settings.Default.MaxFrequencyBands; band++) { Source_FrequencyBand freqBand = new Source_FrequencyBand(band); rfid.Constants.Result Result = freqBand.load(transport, readerHandle); if (rfid.Constants.Result.OK == Result) { this.Add(freqBand); } else if (rfid.Constants.Result.INVALID_PARAMETER == Result) { break; // in case max bands gets lowered in future e.g. european version } else { return(Result); // this rcv all other errors } } return(rfid.Constants.Result.OK); }
private void okButton_Click(object sender, EventArgs e) { if (activeThresholdValue != newThreshold.Value) { rfid.Constants.Result status = rfid.Constants.Result.OK; try { status = reader.API_AntennaPortSetSenseThreshold((uint)newThreshold.Value); } catch (Exception) { status = rfid.Constants.Result.RADIO_FAILURE; } if (rfid.Constants.Result.OK != status) { MessageBox.Show ( "Reader Error.\n\n" + "An error occurred while updating the antenna threshold value.\n\n" + "The follow error occurred: " + status, "Antenna Threshold Setting Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } } DialogResult = DialogResult.OK; }
public rfid.Constants.Result load ( rfid.Linkage transport, UInt32 readerHandle ) { rfid.Constants.Result Result = transport.API_AntennaPortGetConfiguration ( port, ref this.antennaPortConfig ); if (Result != rfid.Constants.Result.OK) { Console.WriteLine("Error while retrieving global antenna sense threshold"); return(Result); } Result = transport.API_AntennaPortGetSenseThreshold ( ref this.antennaPortConfig.antennaSenseThreshold ); return(Result); }
// Attempt to load info for all known antennas public rfid.Constants.Result load ( rfid.Linkage transport, UInt32 readerHandle ) { this.Clear( ); for (byte port = 0; port < RFID.RFIDInterface.Properties.Settings.Default.MaxVirtualAntennas; port++) { Source_Antenna antenna = new Source_Antenna( port ); rfid.Constants.Result Result = antenna.load( transport, readerHandle ); if ( rfid.Constants.Result.OK == Result ) { this.Add( antenna ); } else if ( rfid.Constants.Result.INVALID_PARAMETER == Result ) { break; // this rcv when portIndex > logical antenna count on radio } else { Console.WriteLine( "Error while reading antenna information" ); return Result; // this rcv all other errors } } return rfid.Constants.Result.OK; }
private void profileComboBox_SelectedIndexChanged(object sender, EventArgs e) { statusTextBox.Text = ""; statusTextBox.Visible = false; _timer.Stop( ); profileList.setActiveProfileIndex(profileComboBox.SelectedIndex); rfid.Constants.Result result = profileList.store( ); if (rfid.Constants.Result.OK == result) { statusTextBox.ForeColor = System.Drawing.Color.Green; statusTextBox.Text = "Link Profile Changed"; statusTextBox.Visible = true; statusTextBox.Refresh( ); _timer.Start( ); } else { statusTextBox.ForeColor = Color.Red; statusTextBox.Text = "Link Profile Error : " + result.ToString( ); statusTextBox.Visible = true; statusTextBox.Refresh( ); _timer.Start( ); } }
public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { rfid.Constants.Result Result = transport.API_AntennaPortSetSenseThreshold ( this.antennaPortConfig.antennaSenseThreshold ); if (rfid.Constants.Result.OK != Result) { Console.WriteLine("Error while storing global antenna sense threshold"); } Result = transport.API_AntennaPortSetConfiguration ( port, this.antennaPortConfig ); if (rfid.Constants.Result.OK != Result) { //Console.WriteLine( "Error while storing AntennaPortConfig" ); //clark 2011.2.16 Copied from R1000 Tracer Console.WriteLine("Error while storing AntennaPortConfig port:" + port); } return(Result); }
private void btn_Update_Click(object sender, EventArgs e) { if (null == m_clsInterface) { MessageBox.Show("Error: Interface class is null.", "Configuration - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if ( MessageBox.Show("If you change the setting, The device will be restarted.\nAre you sure?", "Configuration - Set communication port", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes ) { UInt32 oemData = 0; oemData = (rBtn_USB.Checked == true) ? (uint)enumPORT.ENUM_PORT_USB : (uint)enumPORT.ENUM_PORT_UART; rfid.Constants.Result status = m_clsInterface.API_MacWriteOemData((ushort)enumOEM_ADDR.HOST_IF_SEL, oemData); if (rfid.Constants.Result.OK != status) { MessageBox.Show("Set communication port unsuccessfully", "Configuration - Set communication port", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rfid.Constants.Result.OK != m_clsInterface.API_ControlSoftReset()) { MessageBox.Show("Reset reader unsuccessfully", "Configuration - Reset reader", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } m_dlgControlItem(ENUM_ITEM_TYPE.FUNC_DISCONNECT, null); this.Close(); }//if }
public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { rfid.Constants.Result Result = transport.API_ConfigSetOperationMode(this.radioOperationMode); return(Result); }
// Attempt to save all link profiles currently on the radio // and mark the active one. public rfid.Constants.Result store( ) { // In reality we can only set the active profile index at this // time so devolution to a single call of: rfid.Constants.Result Result = this.transport.API_ConfigSetCurrentLinkProfile((byte)this.activeProfileIndex); return(Result); }
private void errorClearButton_Click(object sender, EventArgs e) { statusTextBox.Visible = false; rfid.Constants.Result result = rfid.Constants.Result.OK; try { result = Reader.MacClearError( ); if (rfid.Constants.Result.OK != result) { statusTextBox.ForeColor = System.Drawing.Color.Red; statusTextBox.Text = "Clear Error: " + result.ToString( ); } else { try { errorCodeTextBox.Text = ""; //clark 2011.5.10 Doesn't recommend to get data from OEM directly. //_errorCode = Reader.FirmwareErrorCode; Reader.MacGetError(out _errorCode, out _lastErrorCode); errorCodeTextBox.Text = String.Format(" 0x{0:X}", _errorCode); if (_errorCode == 0) { statusTextBox.ForeColor = System.Drawing.Color.Green; statusTextBox.Text = "Successful Error Clear"; infoPictureBox.Visible = false; } else { statusTextBox.ForeColor = System.Drawing.Color.Red; statusTextBox.Text = "Unable to clear error."; infoPictureBox.Visible = false; } } catch (rfidReaderException exp) { statusTextBox.ForeColor = System.Drawing.Color.Red; statusTextBox.Text = "Clear Error: " + exp.Message; } } } catch (Exception exp) { statusTextBox.ForeColor = System.Drawing.Color.Red; statusTextBox.Text = "Clear Error: " + exp.Message; } statusTextBox.Visible = true; statusTextBox.Refresh( ); _timer.Stop( ); _timer.Start( ); }
public rfid.Constants.Result load ( rfid.Linkage transport, UInt32 readerHandle ) { rfid.Constants.Result Result = transport.API_AntennaPortGetState(this.port, ref this.antennaPortStatus); return(Result); }
protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged(e); statusTextBox.Text = ""; if (this.Visible) { rfid.Constants.Result result = rfid.Constants.Result.NOT_INITIALIZED; errorCodeTextBox.Text = ""; lastErrorCodeTextBox.Text = ""; try { result = Reader.MacGetError(out _errorCode, out _lastErrorCode); if (result == rfid.Constants.Result.OK) { errorCodeTextBox.Text = String.Format(" 0x{0:X}", _errorCode); lastErrorCodeTextBox.Text = String.Format(" 0x{0:X}", _lastErrorCode); } else { errorCodeTextBox.Text = "Reader Error"; lastErrorCodeTextBox.Text = "Reader Error"; statusTextBox.ForeColor = Color.Red; statusTextBox.Text = "Error Code Read Error:" + result; statusTextBox.Visible = true; statusTextBox.Refresh(); } } catch (rfidReaderException exp) { errorCodeTextBox.Text = "Reader Error"; lastErrorCodeTextBox.Text = "Reader Error"; statusTextBox.ForeColor = Color.Red; statusTextBox.Text = "Error Code Read Error:" + exp.Message; statusTextBox.Visible = true; statusTextBox.Refresh( ); } if (_errorCode > 0 && _errorCode < uint.MaxValue) { infoPictureBox.Visible = true; } if (_lastErrorCode > 0 && _lastErrorCode < uint.MaxValue) { lastInfoPictureBox.Visible = true; } } }
private void okButton_Click(object sender, EventArgs e) { if (!this.antennaActive.Equals(this.antennaMaster)) { rfid.Constants.Result status = rfid.Constants.Result.OK; //20090410 MTI Set to 0.1 dB per step Clark copied from R1000 Tracer //this.antennaActive.PowerLevel = (uint)powerLevel.Value * 10; this.antennaActive.PowerLevel = (UInt16)powerLevel.Value; try { status = this.antennaActive.store ( LakeChabotReader.MANAGED_ACCESS, reader.ReaderHandle ); } catch (Exception) { status = rfid.Constants.Result.RADIO_FAILURE; } if (rfid.Constants.Result.OK != status) { MessageBox.Show ( "Reader Error.\n\n" + "An error occurred while updating the antenna settings.\n\n" + "The follow error occurred: " + status, "Antenna Settings Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } else { // Sync master copy so initial display shows correct data this.antennaMaster.Copy(this.antennaActive); } } DialogResult = DialogResult.OK; }
// Attempt to load all link profiles currently on the radio // keeping track of the profile marked active public rfid.Constants.Result load( ) { this.Clear( ); byte CurProfile = 0; this.transport.API_ConfigGetCurrentLinkProfile(ref CurProfile); for (UInt32 profileIndex = 0; profileIndex < RFID.RFIDInterface.Properties.Settings.Default.MaxAllowedProfiles; profileIndex++) { rfid.Structures.RadioLinkProfile profile = new rfid.Structures.RadioLinkProfile( ); //MTI protocol doesn't support API_ConfigGetLinkProfile rfid.Constants.Result Result = this.transport.API_ConfigGetLinkProfile(profileIndex, profile); if (rfid.Constants.Result.OK == Result) { this.Add(new Source_LinkProfile(profile)); //clark 2011.4.19 because MTI protocol doesn't support API_ConfigGetLinkProfile, //we don't know enable value. Use API_ConfigSetCurrentLinkProfile to get current profile. //if ( 0 != profile.enabled ) //{ // this.activeProfileIndex = ( Int32 ) profileIndex; //} //Use CurrentLinkProfile number to find and enable flag. if (CurProfile == profileIndex) { //Set current profile by myself profile.enabled = 1; this.activeProfileIndex = (Int32)profileIndex; } } else if (rfid.Constants.Result.INVALID_PARAMETER == Result) { break; // this rcv when profileIndex > profile count on radio } else { Console.WriteLine("Error while reading radio link profiles"); return(Result); // this rcv all other errors } } return(rfid.Constants.Result.OK); }
public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { // TODO : validate that when doin store the given pin has // access flag in SET mode (?) // Configure pin to set mode rfid.Constants.Result result = rfid.Constants.Result.OK; result = transport.API_GpioSetPinsConfiguration((byte)this.nativePin, (byte)this.nativePin); if (rfid.Constants.Result.OK != result) { this.status = OpResult.FAILURE; return(result); } //2011.12.30 check state if (this.state != OpState.HI && this.state != OpState.LO) { this.status = OpResult.FAILURE; return(rfid.Constants.Result.INVALID_ANTENNA); } //Set state result = transport.API_GpioWritePins ((byte)this.nativePin, (byte)(OpState.LO == this.state ? 0 : this.nativePin)); if (rfid.Constants.Result.OK != result) { this.status = OpResult.FAILURE; } else { this.status = OpResult.SUCCESS; } return(result); }
public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { // Err msgs emitted thru antennaResult & antennaConfig store( ) rfid.Constants.Result Result = this.antennaResult.store(transport, readerHandle); if (rfid.Constants.Result.OK != Result) { return(Result); } return(this.antennaConfig.store(transport, readerHandle)); }
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; }
private void importButton_Click(object sender, EventArgs e) { Cursor priorCursor = null; RFID_Explorer.mainForm.CommonDialogSupport dlg = new mainForm.CommonDialogSupport(mainForm.CommonDialogSupport.DialogType.OpenChannel); if (dlg.ShowDialog( ) == DialogResult.OK) { try { this.Capture = true; priorCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { this.bindingSource.DataSource = this.channelList = RFID_Explorer.ExcelExport.ImportRFChannelConfig(this.reader, dlg.FileName); rfid.Constants.Result result = this.channelList.store(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle); if (rfid.Constants.Result.OK != result) { throw new Exception(result.ToString( )); } this.view.Refresh( ); } catch (Exception e2) { MessageBox.Show(String.Format("Error importing RF channel settings.\n\n{0}", e2.Message), "Invalid import file", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } finally { if (priorCursor != null) { Cursor.Current = priorCursor; } this.Capture = false; } } }
// Attempt to save all link profiles currently on the radio // and mark the active one. public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { foreach( Source_Antenna antenna in this ) { rfid.Constants.Result Result = antenna.store( transport, readerHandle ); if ( rfid.Constants.Result.OK != Result ) { return Result; } } return rfid.Constants.Result.OK; }
// Attempt to save all link profiles currently on the radio // and mark the active one. public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { foreach (Source_FrequencyBand freqBand in this) { rfid.Constants.Result Result = freqBand.store(transport, readerHandle); if (rfid.Constants.Result.OK != Result) { return(Result); } } return(rfid.Constants.Result.OK); }
//clark 2011.2.14 Copied from R1000 Tracer private void btn_Update_Click(object sender, EventArgs e) { if ( MessageBox.Show("If you change the setting, Explorer will be closed.\nAre you sure?", "Reader - Set communication port", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes ) { UInt32 oemData = 0; oemData = (rBtn_USB.Checked == true) ? (uint)enumPORT.ENUM_PORT_USB : (uint)enumPORT.ENUM_PORT_UART; rfid.Constants.Result status = reader.MacWriteOemData((ushort)enumOEM_ADDR.HOST_IF_SEL, oemData); if (rfid.Constants.Result.OK != status) { MessageBox.Show("Set communication port unsuccessfully", "Reader - Set communication port", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rfid.Constants.Result.OK != reader.API_ControlSoftReset()) { MessageBox.Show("Reset reader unsuccessfully", "Reader - Reset reader", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Application.Exit(); }//if }
public rfid.Constants.Result store ( rfid.Linkage transport, UInt32 readerHandle ) { // There is no save for the antennaPortStatus in lower library but // there is a set state so use that here! rfid.Constants.Result Result = transport.API_AntennaPortSetState(this.port, this.antennaPortStatus.state); if (rfid.Constants.Result.OK != Result) { Console.WriteLine("Error while saving antennaPortStatus.state"); } return(Result); }
private string ShowOemData ( UInt16 Offset ) { UInt32 OemData = 0; UInt32 [] pOemData = null; UInt32 uiLength = 0; rfid.Constants.Result result = rfid.Constants.Result.OK; if (rfid.Constants.Result.OK != reader.MacReadOemData(Offset, ref OemData)) { return(null); } uiLength = (0 == (OemData & 0xFF) / 4) ? 1 : (OemData & 0xFF) / 4; uiLength += (uint)((0 == (OemData & 0xFF) % 4) ? 0 : 1); pOemData = new UInt32[uiLength]; Array.Clear(pOemData, 0, pOemData.Length); pOemData[0] = OemData; //Offset++; //Point to data address for (int i = 1; i < uiLength; i++) { result = reader.MacReadOemData((UInt16)(Offset + i), ref pOemData[i]); if (rfid.Constants.Result.OK != result) { return(null); } } //return Source_OEMData.uint32ArrayToString(pOemData, 0); return(CGlobalFunc.uint32ArrayToString(pOemData, uiLength)); }
private void resetButton_Click(object sender, EventArgs e) { statusTextBox.Visible = false; Cursor old = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { rfid.Constants.Result result = Reader.MacReset( ); if (rfid.Constants.Result.OK == result) { statusTextBox.ForeColor = System.Drawing.Color.Green; statusTextBox.Text = "Firmware Reset Successful."; // Force Application Close MessageBox.Show("Explorer will be closed. Restart Explorer to control reader.", "Reader - Reset", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Application.Exit(); } else { statusTextBox.ForeColor = System.Drawing.Color.Red; statusTextBox.Text = "Firmware Reset Error: " + result.ToString( ); } } catch (Exception exp) { statusTextBox.ForeColor = System.Drawing.Color.Red; statusTextBox.Text = exp.Message; } statusTextBox.Visible = true; statusTextBox.Refresh( ); Cursor.Current = old; _timer.Stop( ); _timer.Start( ); }
public rfid.Constants.Result load ( rfid.Linkage transport, UInt32 readerHandle ) { // TODO : validate that when doin store the given pin has // access flag in GET mode (?) // Configure pin to set mode rfid.Constants.Result result = rfid.Constants.Result.OK; rfid.Constants.Result resultErr = rfid.Constants.Result.OK; uint uiCurError = 0; uint uiLastError = 0; byte getValue = 0; //Set access to "Get" result = transport.API_GpioSetPinsConfiguration((byte)this.nativePin, 0); if (rfid.Constants.Result.OK != result) { //Get error resultErr = transport.API_MacGetError(ref uiCurError, ref uiLastError); //Can't get error if (resultErr != rfid.Constants.Result.OK) { this.status = OpResult.FAILURE; return(resultErr); } //If error = 0x2B, it means doesn't support this pin if (uiCurError == 0x2B) { this.status = OpResult.UNSUPPORTED; return(result); } else { this.status = OpResult.FAILURE; return(result); } } //Get GPIO Status result = transport.API_GpioReadPins((byte)this.nativePin, ref getValue); if (rfid.Constants.Result.OK == result) { this.state = (( UInt32 )this.nativePin & getValue) == 0 ? OpState.LO : OpState.HI; this.status = OpResult.SUCCESS; } else { this.state = OpState.FAILURE; this.status = OpResult.FAILURE; } 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); }
private void btn_SetRegion_Click(object sender, EventArgs e) { rfid.Constants.MacRegion SelectMacRegion = rfid.Constants.MacRegion.UNKNOWN; if (strCustomerRegion != null && regionComboBox.Text == strCustomerRegion) { SelectMacRegion = rfid.Constants.MacRegion.CUSTOMER; } else { if (Enum.IsDefined(typeof(rfid.Constants.MacRegion), regionComboBox.SelectedItem)) { SelectMacRegion = (rfid.Constants.MacRegion)regionComboBox.SelectedItem; } else { SelectMacRegion = rfid.Constants.MacRegion.UNKNOWN; } } //Check if ( SelectMacRegion == this.macRegion.MacRegion //Choose the same region || SelectMacRegion == rfid.Constants.MacRegion.UNKNOWN ) { return; } //if // ( // (rfid.Constants.MacRegion)regionComboBox.SelectedItem == // rfid.Constants.MacRegion.UNKNOWN // ) // { // regionComboBox.SelectedIndex = regionComboBox.Items.IndexOf(this.macRegion.MacRegion); // return; // } if ( MessageBox.Show("If you change the setting, Explorer will be closed.\nAre you sure?", "Reader - Set Region", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes ) { this.macRegion.MacRegion = SelectMacRegion; rfid.Constants.Result result = this.macRegion.store(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle); if (rfid.Constants.Result.OK != result) { MessageBox.Show("Set region unsuccessfully", "Reader - Set region", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rfid.Constants.Result.OK != reader.API_ControlSoftReset()) { MessageBox.Show("Reset reader unsuccessfully", "Reader - Reset reader", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Application.Exit(); }//if }
private void DeviceInterface_Load(object sender, EventArgs e) { do { UInt32 uiModelNameMajor = 0; string strModule = string.Empty; rfid.Constants.Result result = rfid.Constants.Result.OK; //Mod by Wayne for supporting M.2/R2000 module, 2016-08-01 UInt32 oemData = 0; //initial btn_Update.Enabled = false; rBtn_USB.Enabled = false; rBtn_UART.Enabled = false; rBtn_USB.Checked = false; rBtn_UART.Checked = false; result = m_clsInterface.API_MacReadOemData((ushort)enumOEM_ADDR.HOST_IF_SEL, ref oemData); if (rfid.Constants.Result.OK != result) { break; } if (oemData == (uint)enumPORT.ENUM_PORT_USB) { rBtn_USB.Checked = true; } else if (oemData == (uint)enumPORT.ENUM_PORT_UART) { rBtn_UART.Checked = true; } //Get Model Name result = m_clsInterface.API_MacReadOemData((ushort)((int)enumOEM_ADDR.MODEL_NAME_MAIN), ref uiModelNameMajor); if (rfid.Constants.Result.OK != result) { break; } switch (uiModelNameMajor) { //USB only case 0x00383234: //824 case 0x4D303658: //M06 case 0x4D303758: //M07 //Add by Wayne for support M06 and M07 module, 2017-08-09. rBtn_USB.Checked = true; rBtn_USB.Enabled = true; break; //UART only case 0x4D303258: //M02 case 0x4D303358: //M03 rBtn_UART.Checked = true; rBtn_UART.Enabled = true; break; //USB and UART case 0x00383631: //861 btn_Update.Enabled = true; rBtn_USB.Enabled = true; rBtn_UART.Enabled = true; break; default: break; } /* * //Get Model Name * result = m_clsInterface.API_MacReadOemData((ushort)((int)enumOEM_ADDR.MODEL_NAME_MAIN), ref uiModelNameMajor); * if (rfid.Constants.Result.OK != result) * { * btn_Update.Enabled = false; * break; * } * * //Add by Wayne for improve FW upgrade feature for integrate M03X model, 2015-03-31 * if (uiModelNameMajor == 0x4D303358) * { * rBtn_USB.Checked = false; * rBtn_USB.Enabled = false; * rBtn_UART.Checked = true; * rBtn_UART.Enabled = true; * } * //End by Wayne for improve FW upgrade feature for integrate M03X model, 2015-03-31 * * 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; * } * * UInt32 oemData = 0; * result = m_clsInterface.API_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; * } */ //End by Wayne for supporting M.2/R2000 module, 2016-08-01 }while(false); }