OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
OSDP.Net.Connections.TcpClientOsdpConnection Class Reference

Connects using TCP/IP connection to a server. More...

Inheritance diagram for OSDP.Net.Connections.TcpClientOsdpConnection:
OSDP.Net.Connections.OsdpConnection OSDP.Net.Connections.IOsdpConnection

Public Member Functions

 TcpClientOsdpConnection (string server, int portNumber, int baudRate)
 Initializes a new instance of the TcpClientOsdpConnection class.
override async Task Open ()
 Open the connection for communications.
override Task Close ()
 Close the connection for communications.
override async Task WriteAsync (byte[] buffer)
 Write to connection.
Parameters
bufferArray of bytes to write

override async Task< int > ReadAsync (byte[] buffer, CancellationToken token)
 Read from connection.
Parameters
bufferArray of bytes to read
tokenCancellation token to end reading of bytes
Returns
Number of actual bytes read

override string ToString ()
Public Member Functions inherited from OSDP.Net.Connections.OsdpConnection
Task Close ()
 Close the connection for communications.
Task Open ()
 Open the connection for communications.
Task< int > ReadAsync (byte[] buffer, CancellationToken token)
 Read from connection.
Parameters
bufferArray of bytes to read
tokenCancellation token to end reading of bytes
Returns
Number of actual bytes read

Task WriteAsync (byte[] buffer)
 Write to connection.
Parameters
bufferArray of bytes to write

void Dispose ()

Properties

override bool IsOpen [get]
 Is the connection open and ready to communicate.
Properties inherited from OSDP.Net.Connections.OsdpConnection
int BaudRate [get, protected set]
 Speed of the connection.
virtual bool IsOpen [get, protected set]
 Is the connection open and ready to communicate.
TimeSpan ReplyTimeout = TimeSpan.FromMilliseconds(200) [get, set]
 Timeout value waiting for a reply.

Additional Inherited Members

Protected Member Functions inherited from OSDP.Net.Connections.OsdpConnection
 OsdpConnection (int baudRate)
 Creates an instance of OsdpConnection.
virtual void Dispose (bool disposing)
 Disposes the OsdpConnection instance.

Detailed Description

Connects using TCP/IP connection to a server.

Definition at line 9 of file TcpClientOsdpConnection.cs.

Constructor & Destructor Documentation

◆ TcpClientOsdpConnection()

OSDP.Net.Connections.TcpClientOsdpConnection.TcpClientOsdpConnection ( string server,
int portNumber,
int baudRate )
inline

Initializes a new instance of the TcpClientOsdpConnection class.

Parameters
serverThe server name or IP address.
portNumberThe port number.
baudRateThe baud rate.

Definition at line 21 of file TcpClientOsdpConnection.cs.

Member Function Documentation

◆ Close()

override Task OSDP.Net.Connections.TcpClientOsdpConnection.Close ( )
inline

Close the connection for communications.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 48 of file TcpClientOsdpConnection.cs.

Referenced by Open().

◆ Open()

override async Task OSDP.Net.Connections.TcpClientOsdpConnection.Open ( )
inline

Open the connection for communications.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 39 of file TcpClientOsdpConnection.cs.

References Close().

Referenced by WriteAsync().

◆ ReadAsync()

override async Task< int > OSDP.Net.Connections.TcpClientOsdpConnection.ReadAsync ( byte[] buffer,
CancellationToken token )
inline

Read from connection.

Parameters
bufferArray of bytes to read
tokenCancellation token to end reading of bytes
Returns
Number of actual bytes read

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 71 of file TcpClientOsdpConnection.cs.

◆ ToString()

override string OSDP.Net.Connections.TcpClientOsdpConnection.ToString ( )
inline

Definition at line 83 of file TcpClientOsdpConnection.cs.

◆ WriteAsync()

override async Task OSDP.Net.Connections.TcpClientOsdpConnection.WriteAsync ( byte[] buffer)
inline

Write to connection.

Parameters
bufferArray of bytes to write

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 58 of file TcpClientOsdpConnection.cs.

References IsOpen, and Open().

Property Documentation

◆ IsOpen

override bool OSDP.Net.Connections.TcpClientOsdpConnection.IsOpen
get

Is the connection open and ready to communicate.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 29 of file TcpClientOsdpConnection.cs.

Referenced by WriteAsync().


The documentation for this class was generated from the following file: