Created
November 13, 2017 04:19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
// Stop the data receive thread. | |
readThreadStop(); | |
// Close the opened serial port. | |
m_clserial.SerialClose(); | |
// Attempt to open the designated port. | |
m_clserial.SerialInit(index); | |
string manufacturer = "", portID = ""; | |
uint version = 0; | |
CLAllSerial.GetPortInfo(index, ref manufacturer, ref portID, ref version); | |
// Set the GUI as necessary. | |
serialPortDropDown.Text = manufacturer + ", " + portID; | |
populateBaudRateDropDown(); | |
// Restart the data receive thread. | |
m_readThread = new Thread(new ThreadStart(serialReadThreadFunc)); | |
m_readThreadContinue = true; | |
m_readThread.Start(); | |
} | |
catch (ApplicationException err) | |
{ | |
MessageBox.Show("Serial port initialization failed: " + err.Message, "CLSerial Initialization Error"); | |
Close(); | |
Application.Exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment