Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
namespace Sick.Tim781s.Colab.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for ColaB protocol commands
|
||||
/// </summary>
|
||||
public interface IColaBCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the command data (SOPAS command string encoded as bytes)
|
||||
/// </summary>
|
||||
ReadOnlyMemory<byte> GetCommandData();
|
||||
|
||||
/// <summary>
|
||||
/// Processes the reply from the scanner
|
||||
/// </summary>
|
||||
/// <param name="replyData">The reply data from the scanner</param>
|
||||
/// <returns>True if the command was successful</returns>
|
||||
bool ProcessReply(ReadOnlyMemory<byte> replyData);
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the command was successfully executed
|
||||
/// </summary>
|
||||
bool WasSuccessful { get; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
namespace Sick.Tim781s.Colab.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for TCP client communication
|
||||
/// </summary>
|
||||
public interface ITcpClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the server IP address
|
||||
/// </summary>
|
||||
string ServerIp { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the server port
|
||||
/// </summary>
|
||||
ushort ServerPort { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the client is connected
|
||||
/// </summary>
|
||||
bool IsConnected { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Connects to the server
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs">Connection timeout in milliseconds</param>
|
||||
void Connect(int timeoutMs = 5000);
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects from the server
|
||||
/// </summary>
|
||||
void Disconnect();
|
||||
|
||||
/// <summary>
|
||||
/// Sends data to the server
|
||||
/// </summary>
|
||||
/// <param name="data">Data to send</param>
|
||||
void Send(ReadOnlyMemory<byte> data);
|
||||
|
||||
/// <summary>
|
||||
/// Receives data from the server
|
||||
/// </summary>
|
||||
/// <param name="timeoutMs">Receive timeout in milliseconds</param>
|
||||
/// <returns>Received data</returns>
|
||||
byte[] Receive(int timeoutMs = 5000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user