/// <summary> /// The close method closes the CANUSB device. /// </summary> /// <returns>CloseResult.OK on success, otherwise CloseResult.CloseError.</returns> override public CloseResult close() { Console.WriteLine("******* CANUSB: Closing CANUSB"); int res = 0; try { res = LAWICEL.canusb_Close(m_deviceHandle); } catch (DllNotFoundException e) { Console.WriteLine("CANUSBDevice::close: " + e.Message); return(CloseResult.CloseError); } /*if (m_readThread.ThreadState != ThreadState.Unstarted) * m_readThread.Abort();*/ m_deviceHandle = 0; if (LAWICEL.ERROR_CANUSB_OK == res) { return(CloseResult.OK); } else { return(CloseResult.CloseError); } }
/// <summary> /// The close method closes the CANUSB device. /// </summary> /// <returns>CloseResult.OK on success, otherwise CloseResult.CloseError.</returns> override public CloseResult close() { Console.WriteLine("Close called in CANUSBDevice"); if (m_readThread != null) { if (m_readThread.ThreadState != ThreadState.Stopped && m_readThread.ThreadState != ThreadState.StopRequested) { lock (m_synchObject) { m_endThread = true; } // m_readThread.Abort(); } } int res = LAWICEL.canusb_Close(m_deviceHandle); m_deviceHandle = 0; if (LAWICEL.ERROR_CANUSB_OK == res) { return(CloseResult.OK); } else { return(CloseResult.CloseError); } }
/// <summary> /// The close method closes the CANUSB device. /// </summary> /// <returns>CloseResult.OK on success, otherwise CloseResult.CloseError.</returns> override public CloseResult close() { int res = 0; try { res = LAWICEL.canusb_Close(m_deviceHandle); } catch (DllNotFoundException e) { return(CloseResult.CloseError); } m_deviceHandle = 0; if (LAWICEL.ERROR_CANUSB_OK == res) { return(CloseResult.OK); } else { return(CloseResult.CloseError); } }