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

Base OSDP connection class. More...

Inheritance diagram for OSDP.Net.Connections.OsdpConnection:
OSDP.Net.Connections.IOsdpConnection OSDP.Net.Connections.ReadOnlySerialPortOsdpConnection OSDP.Net.Connections.SerialPortOsdpConnection OSDP.Net.Connections.TcpClientOsdpConnection OSDP.Net.Connections.TcpServerOsdpConnection

Public Member Functions

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 ()

Protected Member Functions

 OsdpConnection (int baudRate)
 Creates an instance of OsdpConnection.
virtual void Dispose (bool disposing)
 Disposes the OsdpConnection instance.

Properties

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.

Detailed Description

Base OSDP connection class.

Definition at line 10 of file OsdpConnection.cs.

Constructor & Destructor Documentation

◆ OsdpConnection()

OSDP.Net.Connections.OsdpConnection.OsdpConnection ( int baudRate)
inlineprotected

Creates an instance of OsdpConnection.

Parameters
baudRateBaud rate for OSDP comms

Definition at line 18 of file OsdpConnection.cs.

References BaudRate.

Member Function Documentation

◆ Close()

Task OSDP.Net.Connections.OsdpConnection.Close ( )
abstract

Close the connection for communications.

Implements OSDP.Net.Connections.IOsdpConnection.

Referenced by Dispose(), and OSDP.Net.Connections.OsdpConnectionListener.RegisterConnection().

◆ Dispose() [1/2]

void OSDP.Net.Connections.OsdpConnection.Dispose ( )
inline

Definition at line 50 of file OsdpConnection.cs.

References Dispose().

Referenced by Dispose().

◆ Dispose() [2/2]

virtual void OSDP.Net.Connections.OsdpConnection.Dispose ( bool disposing)
inlineprotectedvirtual

Disposes the OsdpConnection instance.

This method is responsible for releasing any resources used by the OsdpConnection instance. It calls the Close method to close the connection if it is open and sets the _disposedValue field to true to indicate that the instance has been disposed.

Reimplemented in OSDP.Net.Connections.TcpServerOsdpConnection.

Definition at line 63 of file OsdpConnection.cs.

References Close().

◆ Open()

Task OSDP.Net.Connections.OsdpConnection.Open ( )
abstract

Open the connection for communications.

Implements OSDP.Net.Connections.IOsdpConnection.

◆ ReadAsync()

Task< int > OSDP.Net.Connections.OsdpConnection.ReadAsync ( byte[] buffer,
CancellationToken token )
abstract

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.

◆ WriteAsync()

Task OSDP.Net.Connections.OsdpConnection.WriteAsync ( byte[] buffer)
abstract

Write to connection.

Parameters
bufferArray of bytes to write

Implements OSDP.Net.Connections.IOsdpConnection.

Property Documentation

◆ BaudRate

int OSDP.Net.Connections.OsdpConnection.BaudRate
getprotected set

Speed of the connection.

The setter is protected because most connection types fix their rate at construction. Types that can retune a live connection, such as SerialPortOsdpConnection, expose a public method to do so.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 29 of file OsdpConnection.cs.

Referenced by OSDP.Net.Connections.ReadOnlySerialPortOsdpConnection.Open(), OSDP.Net.Connections.SerialPortOsdpConnection.Open(), OsdpConnection(), OSDP.Net.Connections.SerialPortOsdpConnection.SetBaudRate(), and OSDP.Net.Connections.SerialPortOsdpConnection.WaitForTransmitCompleteAsync().

◆ IsOpen

◆ ReplyTimeout

TimeSpan OSDP.Net.Connections.OsdpConnection.ReplyTimeout = TimeSpan.FromMilliseconds(200)
getset

Timeout value waiting for a reply.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 35 of file OsdpConnection.cs.


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