Skip to content

Commit 6905a74

Browse files
Add IsOpen flag to SerialLink.
Co-authored-by: alexander.mushinskiy <amushinskiy@gmail.com>
1 parent e0e7b69 commit 6905a74

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

ThreeByte.LinkLib/ThreeByte.LinkLib.SerialLink/SerialLink.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class SerialLink : IDisposable
1414
public event EventHandler? DataReceived;
1515
public bool IsConnected => _isConnected;
1616
public bool IsEnabled => _isEnabled;
17+
public bool IsOpen => _serialPort?.IsOpen ?? false;
1718
public bool HasData => _incomingData.Count > 0;
1819

1920
private const int MaxDataSize = 100;

ThreeByte.LinkLib/ThreeByte.LinkLib.TcpLink/AsyncTcpLink.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ private void ReadCallback(IAsyncResult asyncResult)
391391
/// Fetches and removes (pops) the next available group of bytes as received on this link in order (FIFO)
392392
/// </summary>
393393
/// <returns>null if the link is not Enabled or there is no data currently queued to return, an array of bytes otherwise.</returns>
394-
public byte[] GetMessage()
394+
public byte[]? GetMessage()
395395
{
396396
if (_isDisposed)
397397
{
@@ -404,7 +404,7 @@ public byte[] GetMessage()
404404
return null;
405405
}
406406

407-
byte[] newMessage = null;
407+
byte[]? newMessage = null;
408408
lock (_incomingData)
409409
{
410410
if (HasData)

0 commit comments

Comments
 (0)