Реферат: Інтерфейси автоматизованих систем управління

if (!_keepReading)

{

_keepReading = true;

_readThread = new Thread(ReadPort);

_readThread.Start();

}

}

private void StopReading()

{

if (_keepReading)

{

_keepReading = false;

_readThread.Join();//block until exits

_readThread = null;

}

}

/// <summary> Get the data and pass it on. </summary>

private void ReadPort()

{

while (_keepReading)

{

if (_serialPort.IsOpen)

{

byte[] readBuffer = new byte[_serialPort.ReadBufferSize + 1];

try

{

// If there are bytes available on the serial port,

// Read returns up to "count" bytes, but will not block (wait)

// for the remaining bytes. If there are no bytes available

К-во Просмотров: 285
Бесплатно скачать Реферат: Інтерфейси автоматизованих систем управління