protected override void OnDestroy() { base.OnDestroy(); if (listEPCsVerified.Count > 0) { UpdateVerifiedEPCs(false); } try { if (Reader != null) { Reader.Events.RemoveEventsListener(eventHandler); Reader.Disconnect(); Toast.MakeText(ApplicationContext, "Disconnecting reader", ToastLength.Long).Show(); Reader = null; readers.Dispose(); readers = null; } } catch (InvalidUsageException e) { e.PrintStackTrace(); } catch (OperationFailureException e) { e.PrintStackTrace(); } catch (Exception e) { e.StackTrace.ToString(); } } // OnDestroy()
protected override void OnDestroy() { base.OnDestroy(); if ((listFoxProducts.Count > 0) && (scanType != "VERIFY")) { SaveItemsScanned("DONOTHING"); } try { if (Reader != null) { Reader.Events.RemoveEventsListener(eventHandler); Reader.Disconnect(); Toast.MakeText(ApplicationContext, "Disconnecting reader", ToastLength.Long).Show(); Reader = null; readers.Dispose(); readers = null; } } catch (InvalidUsageException e) { e.PrintStackTrace(); } catch (OperationFailureException e) { e.PrintStackTrace(); } catch (Exception e) { e.StackTrace.ToString(); } }
private void Disconnect() { if (Reader != null) { Reader.Events.RemoveEventsListener(this); Reader.Disconnect(); RunOnUiThread(() => { if (!Reader.IsConnected) { tvStatus.Text = "Disconnected"; } }); } }
private void formTrafficLights_FormClosing(object sender, FormClosingEventArgs e) { try { if (m_IsConnected) { m_ReaderAPI.Disconnect(); } this.Dispose(); } catch (Exception ex) { functionCallStatusLabel.Text = ex.Message; } }
/// <summary> /// 关闭读取器连接 /// </summary> /// <returns></returns> public ReturnMessage CloseReaderConnection() { ReturnMessage returnMsg = new ReturnMessage(); if (!m_ReaderInitiatedDisconnectionReceived) { try { //读取相关回调删除 m_RFIDReader.Events.ReadNotify -= Events_ReadNotify; //m_RFIDReader.Events.StatusNotify -= Events_StatusNotify; m_RFIDReader.Disconnect(); returnMsg.CallStatus = true; returnMsg.CallMessage = "Close Connection Success."; //日志记录 DeclaimerReaderLog.Info("[" + returnMsg.CallMessage + "] ==== [" + DateTime.Now.ToString() + "]"); } catch (OperationFailureException ofe) { returnMsg.CallStatus = false; returnMsg.CallMessage = "Close Connection Error : " + ofe.VendorMessage; //日志记录 DeclaimerReaderLog.Error("[" + returnMsg.CallMessage + "] ==== [" + DateTime.Now.ToString() + "]"); } } return(returnMsg); }
private void MainFrame_EnabledChanged(object sender, EventArgs e) { if (!this.Enabled) { RFIDReader.Disconnect(); } }
private void CloseRFIDConnection() { try { if (Reader != null) { //Reader.Events.RemoveEventsListener(eventHandler); Reader.Disconnect(); //Toast.MakeText(ApplicationContext, "Disconnecting reader", ToastLength.Long).Show(); Reader = null; readers.Dispose(); readers = null; } } catch (InvalidUsageException e) { e.PrintStackTrace(); } catch (OperationFailureException e) { e.PrintStackTrace(); } catch (Exception e) { e.StackTrace.ToString(); } }
private void MainFrame_Deactivate(object sender, EventArgs e) { try { RFIDReader.Disconnect(); } catch { } }
private void MainFrame_Closing(object sender, CancelEventArgs e) { try { RFIDReader.Disconnect(); } catch { } }
//check the connection status private void FunctionDisconnectReaderAtWB() { try { if (WB_readerAPI.IsConnected) { WB_readerAPI.Disconnect(); } } catch (Exception) { } }
//check the connection status private void FunctionDisconnectReaderAtPortEntry() { try { if (PortEntry_readerAPI.IsConnected) { PortEntry_readerAPI.Disconnect(); } } catch (Exception) { } }
//check the connection status private void FunctionDisconnectReaderAtParking() { try { if (Parking_readerAPI.IsConnected) { Parking_readerAPI.Disconnect(); } } catch (Exception) { } }
private void btnConnect_Click(object sender, EventArgs e) { if (btnConnect.Text == "Connect") { string result = myComms.Connect(cboxReader.Text); listBox1.Items.Add(result); btnWrite.Enabled = true; btnConnect.Text = "Disconnect"; } else { btnConnect.Text = "Connect"; btnWrite.Enabled = false; listBox1.Items.Add(myComms.Disconnect()); } }
//check the connection status private void FunctionDisconnectReader() { try { if (Parking_readerAPI.IsConnected) { Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet1Loc_RedLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet2Loc_RedLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet1Loc_GreenLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet1Loc_GreenLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Disconnect(); } } catch (Exception) { } }
private void Exit() { YesNo exitDialog = new YesNo("Are you sure you want to exit?"); if (exitDialog.ShowDialog() == DialogResult.Yes) { //this.Refresh(); //this.Visible = false; if (_IsConnected) { _ReaderAPI.Disconnect(); } //userNotification.Visible = false; //userNotification.Dispose(); Application.Exit(); } }
//check the connection status private void FunctionDisconnectReader() { try { if (Parking_readerAPI.IsConnected) { Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet1Loc_RedLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet2Loc_RedLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet1Loc_GreenLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Config.GPO[classGlobalVariables.AntenaSet1Loc_GreenLight_GPIO_PortNo].PortState = GPOs.GPO_PORT_STATE.FALSE; Parking_readerAPI.Disconnect(); } BBSet1Status = classBoomBarriorOperations.BoomBarriorConnection(classGlobalVariables.AntenaSet1Loc_BoomBarrier_IP.ToString(), classBoomBarriorOperations._conSet1); BBSet2Status = classBoomBarriorOperations.BoomBarriorConnection(classGlobalVariables.AntenaSet2Loc_BoomBarrier_IP.ToString(), classBoomBarriorOperations._conSet2); } catch (Exception) { } }
public void Stop() { try { string info = "status:stop"; LogService.Info(TAG, info); if (rfidReader != null && rfidReader.IsConnected == true) { rfidReader.Disconnect(); IsConnect = rfidReader.IsConnected; } } catch (Exception ex) { Message = "无法正常关闭阅读器"; LogService.Error(TAG, ex.Message); } }
private void connectBackgroundWorker_DoWork(object sender, DoWorkEventArgs workEventArgs) { connectBackgroundWorker.ReportProgress(0, workEventArgs.Argument); if ((string)workEventArgs.Argument == "Connect") { m_ReaderAPI = new RFIDReader(m_ConnectionForm.IpText, uint.Parse(m_ConnectionForm.PortText), 0); try { m_ReaderAPI.Connect(); m_IsConnected = true; workEventArgs.Result = "Connect Succeed"; } catch (OperationFailureException operationException) { workEventArgs.Result = operationException.StatusDescription; } catch (Exception ex) { workEventArgs.Result = ex.Message; } } else if ((string)workEventArgs.Argument == "Disconnect") { try { m_ReaderAPI.Disconnect(); m_IsConnected = false; workEventArgs.Result = "Disconnect Succeed"; m_ReaderAPI = null; } catch (OperationFailureException ofe) { workEventArgs.Result = ofe.Result; } } }
public void disconnect() { try { if (m_reader.Actions.TagAccess.OperationSequence.Length > 0) { m_reader.Actions.TagAccess.OperationSequence.StopSequence(); } else { m_reader.Actions.Inventory.Stop(); } m_reader.Disconnect(); } catch (OperationFailureException operationException) { Debug.WriteLine(operationException.StatusDescription); } catch (Exception ex) { Debug.WriteLine("RFID Disconnect failed: " + ex.Message); } }