/// <summary> /// Removes the incoming messages. /// </summary> public void Flush() { if (!IsConnected) { throw new CanAdapterException("Adapter is Disconnected. Code:-8604."); //Doc } if (!_isOpen) { throw new CanAdapterException("Bus is Closed. Code:-8605."); //Doc } int i = Attributes.PendingRxMessages; IncomingMsgQueue.Clear(); }
/// <summary> /// Closes the CAN connection, sets the IsOpen property to false, and disposes of the internal Stream object. /// </summary> public void Close() { if (_isOpen) { try { isAbort = true; Usb.Pipes[USB_MSG_IN_ADDR].Abort(); IncomingMsgQueue.Clear(); OutgoingMsgQueue.Clear(); _isOpen = false; Services.Reset(); IncomingMsgQueue = null; OutgoingMsgQueue = null; } catch { }; } }