public static void SetSerialPortName(string serialPortName) { if (m_woodway == null) { m_woodway = new Treadmill(serialPortName); m_woodway.Start(); m_woodway.TreadmillPortUnpluggedEvent += new Treadmill.TreadmillPortUnpluggedEventHandler(m_woodway_TreadmillPortUnpluggedEvent); } }
public static void SetSerialPortName(string serialPortName) { if (m_woodway == null) { m_woodway = new Treadmill(serialPortName); m_woodway.Start(); m_woodway.TreadmillPortUnpluggedEvent += new Treadmill.TreadmillPortUnpluggedEventHandler(m_woodway_TreadmillPortUnpluggedEvent); } }
/// <summary> /// Clears the serial port so SetSerialPortName() can be called /// </summary> public static void ClearSerialPortName() { if (m_woodway != null) { // Close the session, then wait for the thread to close, then set the treadmill to null, then wait and return m_woodway.CloseSession(); while (m_woodway.TimerThreadIsAlive) { System.Threading.Thread.Sleep(100); } System.Threading.Thread.Sleep(500); m_woodway = null; System.Threading.Thread.Sleep(500); } }
/// <summary> /// Clears the serial port so SetSerialPortName() can be called /// </summary> public static void ClearSerialPortName() { if (m_woodway != null) { // Close the session, then wait for the thread to close, then set the treadmill to null, then wait and return m_woodway.CloseSession(); while (m_woodway.TimerThreadIsAlive) { System.Threading.Thread.Sleep(100); } System.Threading.Thread.Sleep(500); m_woodway = null; System.Threading.Thread.Sleep(500); } }
/// <summary> /// When the treadmill's port gets unplugged set m_woodway to null so it can be set again /// </summary> static void m_woodway_TreadmillPortUnpluggedEvent() { m_woodway = null; }
/// <summary> /// When the treadmill's port gets unplugged set m_woodway to null so it can be set again /// </summary> static void m_woodway_TreadmillPortUnpluggedEvent() { m_woodway = null; }