Skip to content

Commit

Permalink
!WIP - integrating RFID Mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Eline Jorritsma committed Sep 5, 2024
1 parent 76649d4 commit 1b80e3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SickRfid/ConnectedSickRfidController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task<string> ReadAsync(CancellationToken cancellationToken = defaul
var message = Encoding.ASCII.GetString(buffer, 0, result);

if (string.IsNullOrEmpty(message) ||
message.Contains(Acknowledgements.ACK_START, StringComparison.Ordinal) ||
message.Equals(Acknowledgements.ACK_START, StringComparison.Ordinal) ||
message.Contains(Acknowledgements.ACK_STOP, StringComparison.Ordinal)) continue;

return message;
Expand Down
4 changes: 2 additions & 2 deletions SickRfid/DisconnectedSickRfidController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ internal DisconnectedSickRfidController(IPAddress ipAddress, int port)
_port = port;
}

public async Task<ConnectedSickRfidController> ConnectAsync()
public async Task<ConnectedSickRfidController> ConnectAsync(CancellationToken cancellationToken = default)
{
var socket = new Socket(SocketType.Stream, ProtocolType.Tcp);
await socket.ConnectAsync(_ipAddress, _port).ConfigureAwait(true);
await socket.ConnectAsync(_ipAddress, _port, cancellationToken).ConfigureAwait(true);
return new ConnectedSickRfidController().SetSocket(socket);
}
}

0 comments on commit 1b80e3f

Please sign in to comment.