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

Read-only serial port connection for passive monitoring of OSDP traffic. More...

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

Public Member Functions

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

Exceptions
NotSupportedExceptionThis connection is read-only and does not support write operations.

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

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.
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.

Detailed Description

Read-only serial port connection for passive monitoring of OSDP traffic.

This connection only supports reading data and will throw NotSupportedException for write operations.

Definition at line 12 of file ReadOnlySerialPortOsdpConnection.cs.

Constructor & Destructor Documentation

◆ ReadOnlySerialPortOsdpConnection()

OSDP.Net.Connections.ReadOnlySerialPortOsdpConnection.ReadOnlySerialPortOsdpConnection ( string portName,
int baudRate )
inline

Initializes a new instance of the ReadOnlySerialPortOsdpConnection class.

Parameters
portNameName of the serial port (e.g., "COM3").
baudRateThe baud rate for the serial connection.
Exceptions
ArgumentNullExceptionThrown when portName is null.

Definition at line 23 of file ReadOnlySerialPortOsdpConnection.cs.

Member Function Documentation

◆ Close()

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

Close the connection for communications.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 50 of file ReadOnlySerialPortOsdpConnection.cs.

References OSDP.Net.Connections.OsdpConnection.IsOpen.

◆ Open()

override Task OSDP.Net.Connections.ReadOnlySerialPortOsdpConnection.Open ( )
inline

◆ ReadAsync()

override async Task< int > OSDP.Net.Connections.ReadOnlySerialPortOsdpConnection.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 74 of file ReadOnlySerialPortOsdpConnection.cs.

References OSDP.Net.Connections.OsdpConnection.IsOpen.

◆ ToString()

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

Definition at line 92 of file ReadOnlySerialPortOsdpConnection.cs.

◆ WriteAsync()

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

Write to connection.

Parameters
bufferArray of bytes to write

Exceptions
NotSupportedExceptionThis connection is read-only and does not support write operations.

Implements OSDP.Net.Connections.IOsdpConnection.

Definition at line 67 of file ReadOnlySerialPortOsdpConnection.cs.


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