Class UartPort
Provides libpigpio implementation of a UART port. Alternatively you can use the System.IO.Ports.SerialPort implementation.
Implements
Inherited Members
Namespace: Unosquare.PiGpio.ManagedModel
Syntax
public sealed class UartPort : IDisposable
Properties
Available
Gets the number of available bytes to read in the hardware buffer.
Declaration
public int Available { get; }
Property Value
Type | Description |
---|---|
Int32 |
BaudRate
Gets the baud rate.
Declaration
public int BaudRate { get; }
Property Value
Type | Description |
---|---|
Int32 |
Handle
Gets the serial port handle.
Declaration
public UIntPtr Handle { get; }
Property Value
Type | Description |
---|---|
UIntPtr |
PortName
Gets the name of the port.
Declaration
public string PortName { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Read()
Reads this instance.
Declaration
public byte[] Read()
Returns
Type | Description |
---|---|
Byte[] | A buffer containing the bytes. |
Read(Int32)
Reads the specified number of bytes.
Declaration
public byte[] Read(int count)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | The count. |
Returns
Type | Description |
---|---|
Byte[] | A byte array of read bytes. |
ReadByte()
Reads the byte.
Declaration
public byte? ReadByte()
Returns
Type | Description |
---|---|
Nullable<Byte> | The byte value. Null if no bytes were read. |
Write(Byte)
Writes the specified value.
Declaration
public void Write(byte value)
Parameters
Type | Name | Description |
---|---|---|
Byte | value | The value. |
Write(Byte[])
Writes the specified buffer.
Declaration
public void Write(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Write(Byte[], Int32)
Writes the specified buffer.
Declaration
public void Write(byte[] buffer, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Int32 | count | The count. |