private void btWriteFola_Click(object sender, EventArgs e) { FolaEnableButtons(false); try { folaRFIDController = HSTMachine.Workcell.Process.InputStationProcess.Controller.RfidController; if (folaRFIDController == null) { folaRFIDController = HSTMachine.Workcell.Process.InputStationProcess.Controller.RfidController; folaRFIDController.RFIDScanner.Initialize(false); } if (rdxInputStation.Checked) { folaRFIDHead = HSTMachine.Workcell.Process.InputStationProcess.Controller.RfHead; } else { folaRFIDHead = HSTMachine.Workcell.Process.OutputStationProcess.Controller.RfHead; } folaTagDataPanel1.UpdateTag(folaTagData); folaRFIDController.RFIDScanner.WriteRFIDTag(folaRFIDHead, folaTagData, true); lblFolaStatus.Text = string.Format("Status: OK. Write time: {0} msec", folaRFIDController.RFIDScanner.ReadTime.ToString()); } catch (Exception ex) { lblFolaStatus.Text = string.Format("Status: Error: {0}", ex.Message); } FolaEnableButtons(true); }
private void btReadFola_Click(object sender, EventArgs e) { FolaEnableButtons(false); try { folaRFIDController = HSTMachine.Workcell.Process.InputStationProcess.Controller.RfidController; if (folaRFIDController == null) { folaRFIDController = HSTMachine.Workcell.Process.InputStationProcess.Controller.RfidController; folaRFIDController.RFIDScanner.Initialize(false); } if (rdxInputStation.Checked) { folaRFIDHead = HSTMachine.Workcell.Process.InputStationProcess.Controller.RfHead; } else { folaRFIDHead = HSTMachine.Workcell.Process.OutputStationProcess.Controller.RfHead; } folaTagDataPanel1.ClearTag(folaTagData); folaRFIDController.RFIDScanner.ReadRFIDTag(folaRFIDHead, ref folaTagData); folaTagDataPanel1.DisplayTagData(folaTagData); lblFolaStatus.Text = string.Format("Status: OK. Read time: {0} msec", folaRFIDController.RFIDScanner.ReadTime.ToString()); } catch (ExceptionRFID rfidEx) { if (rfidEx.ErrorCodeRFID == ErrorCodeRFID.CHECKSUM_ERR) { folaTagDataPanel1.DisplayTagData(folaTagData); lblFolaStatus.Text = string.Format("Status: Error: {0}{1}Read time: {2} msec", rfidEx.Message, Environment.NewLine, folaRFIDController.RFIDScanner.ReadTime.ToString()); } else { lblFolaStatus.Text = string.Format("Status: Error: {0}", rfidEx.Message); } } catch (Exception ex) { lblFolaStatus.Text = string.Format("Status: Error: {0}", ex.Message); } FolaEnableButtons(true); }