|
OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
|
A connection whose line rate can be changed while it stays open. More...
Public Member Functions | |
| void | SetBaudRate (int baudRate) |
| Changes the baud rate, retuning the connection in place if it is open. | |
| Task | WaitForTransmitCompleteAsync (int frameByteCount, CancellationToken token=default) |
| Waits until data already written has left the connection. | |
| Public Member Functions inherited from OSDP.Net.Connections.IOsdpConnection | |
| Task | Open () |
| Open the connection for communications. | |
| Task | Close () |
| Close the connection for communications. | |
| Task | WriteAsync (byte[] buffer) |
| Write to connection. | |
| Task< int > | ReadAsync (byte[] buffer, CancellationToken token) |
| Read from connection. | |
Properties | |
| bool | DiscardBuffersBeforeWrite [get, set] |
| Gets or sets a value indicating whether buffers are discarded before every write. | |
| Properties inherited from OSDP.Net.Connections.IOsdpConnection | |
| int | BaudRate [get] |
| Speed of the connection. | |
| bool | IsOpen [get] |
| Is the connection open and ready to communicate. | |
| TimeSpan | ReplyTimeout [get, set] |
| Timeout value waiting for a reply. | |
A connection whose line rate can be changed while it stays open.
Most OSDP work fixes the baud rate for the life of a connection. The line quality test does not: it sweeps rates, and closing and reopening a serial port between each one is slow, can leave the handle briefly unavailable on Windows, and toggles the control lines in a way that disturbs the bus. This interface exists so that code which retunes a live connection can be written against something other than a physical port.
Definition at line 16 of file IRetunableOsdpConnection.cs.
| void OSDP.Net.Connections.IRetunableOsdpConnection.SetBaudRate | ( | int | baudRate | ) |
Changes the baud rate, retuning the connection in place if it is open.
| baudRate | The new baud rate. |
Implemented in OSDP.Net.Connections.SerialPortOsdpConnection.
| Task OSDP.Net.Connections.IRetunableOsdpConnection.WaitForTransmitCompleteAsync | ( | int | frameByteCount, |
| CancellationToken | token = default ) |
Waits until data already written has left the connection.
| frameByteCount | Number of bytes most recently written. |
| token | Token to observe while waiting. |
Required before SetBaudRate mid-conversation: a write returns once the bytes are accepted for transmission, not once they have left the wire, and changing the divisor early corrupts the tail of the message.
Implemented in OSDP.Net.Connections.SerialPortOsdpConnection.
|
getset |
Gets or sets a value indicating whether buffers are discarded before every write.
An ACU wants this on: it drives a strict command/reply cycle and benefits from a clean slate before each command. A device that replies to an incoming stream wants it off, because the next command can already be arriving while the previous reply is written.
Implemented in OSDP.Net.Connections.SerialPortOsdpConnection.
Definition at line 26 of file IRetunableOsdpConnection.cs.