Files
BQP/srcs/RobotNet10/RobotApp/Communication/Sick.SafetyScanners/Interfaces/IUdpClient.cs
2026-07-13 09:25:40 +07:00

43 lines
1.4 KiB
C#

using Sick.SafetyScanners.DataStructures;
using Sick.SafetyScanners.Types;
namespace Sick.SafetyScanners.Interfaces;
/// <summary>
/// Interface for UDP receiver (not a connection - UDP is connectionless)
/// Used for receiving scan data packets from SICK Safety Scanner via UDP (push mode)
/// Note: This is NOT a "connection" - it's just a UDP socket receiver that binds to a local port
/// and waits for packets from the scanner
/// </summary>
public interface IUdpClient : IDisposable
{
/// <summary>
/// Indicates whether the UDP socket is open (ready to receive)
/// Note: UDP is connectionless, so this just checks if socket is bound/open
/// </summary>
bool IsConnected { get; }
/// <summary>
/// Gets the local port number assigned to this client
/// Returns null if socket is not bound yet
/// </summary>
Port? LocalPort { get; }
/// <summary>
/// Indicates whether data is available in the receiving buffer
/// </summary>
bool IsDataAvailable { get; }
/// <summary>
/// Starts receiving UDP packets on a dedicated high-priority thread
/// </summary>
/// <param name="packetHandler">Callback function to handle received packets</param>
void StartReceiving(Action<PacketBuffer> packetHandler);
/// <summary>
/// Stops the receiving thread
/// </summary>
void Stop();
}