Skip to main content

SerialPort Class

Namespace: System.IO.Ports · Assembly: GHIElectronics.TinyCLR.System.IO.Ports

No description available.

public class SerialPort : IDisposable

Constructors

SerialPort()

public SerialPort() : this( )

No description available.

SerialPort(string portName)

public SerialPort(string portName)

No description available.

ParameterTypeDescription
portNamestring

SerialPort(string portName, int baudRate)

public SerialPort(string portName, int baudRate) : this(portName)

No description available.

ParameterTypeDescription
portNamestring
baudRateint

SerialPort(string portName, int baudRate, Parity parity)

public SerialPort(string portName, int baudRate, Parity parity) : this(portName, baudRate)

No description available.

ParameterTypeDescription
portNamestring
baudRateint
parityParity

SerialPort(string portName, int baudRate, Parity parity, int dataBits)

public SerialPort(string portName, int baudRate, Parity parity, int dataBits) : this(portName, baudRate, parity)

No description available.

ParameterTypeDescription
portNamestring
baudRateint
parityParity
dataBitsint

SerialPort(string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits)

public SerialPort(string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits) : this(portName, baudRate, parity, dataBits)

No description available.

ParameterTypeDescription
portNamestring
baudRateint
parityParity
dataBitsint
stopBitsStopBits

Properties

PortName

public string PortName { get; set; }

No description available.

BaudRate

public int BaudRate { get; set; }

Bits per second. (inherited)

Parity

public Parity Parity { get; set; }

Parity policy. (inherited)

DataBits

public int DataBits { get; set; }

Frame width in data bits (typically 7 or 8). (inherited)

StopBits

public StopBits StopBits { get; set; }

Stop-bit policy. (inherited)

Handshake

public Handshake Handshake { get; set; }

No description available.

ReadTimeout

public int ReadTimeout { get; set; }

How long to wait before timing out a read operation. (inherited)

WriteTimeout

public int WriteTimeout { get; set; }

How long to wait before timing out a write operation. (inherited)

ReadBufferSize

public int ReadBufferSize { get; set; }

Size in bytes of the receive buffer. (inherited)

WriteBufferSize

public int WriteBufferSize { get; set; }

Size in bytes of the transmit buffer. (inherited)

ReceivedBytesThreshold

public int ReceivedBytesThreshold { get; set; }

No description available.

NewLine

public string NewLine { get; set; }

No description available.

Encoding

public Encoding Encoding { get; set; }

No description available.

IsOpen

public bool IsOpen { get; }

No description available.

BytesToRead

public int BytesToRead { get; }

The number of bytes available to read. (inherited)

BytesToWrite

public int BytesToWrite { get; }

The number of bytes that are in the process of being written. (inherited)

CtsHolding

public bool CtsHolding { get; }

No description available.

CDHolding

public bool CDHolding { get; }

No description available.

DsrHolding

public bool DsrHolding { get; }

No description available.

BreakState

public bool BreakState { get; set; }

No description available.

DtrEnable

public bool DtrEnable { get; set; }

No description available.

RtsEnable

public bool RtsEnable { get; set; }

No description available.

Methods

Open()

public void Open()

Powers on and initializes the media. (inherited)

Close()

public void Close()

When overridden by a descendant class, closes the response stream. (inherited)

Dispose()

public void Dispose()

Releases buffered memory (the unmanaged firmware/application buffers). (inherited)

Read(byte[] buffer, int offset, int count)

public int Read(byte[] buffer, int offset, int count)

Reads a block of bytes from the stream. (inherited)

ParameterTypeDescription
bufferbyte[]
offsetintThe byte offset in the array at which read bytes will be placed.
countintThe maximun number of bytes to read.

Returns int

ReadByte()

public int ReadByte()

Reads a single byte (drives 0xFF on the bus to sample the slave). (inherited)

Returns int

ReadChar()

public int ReadChar()

No description available.

Returns int

Read(char[] buffer, int offset, int count)

public int Read(char[] buffer, int offset, int count)

Reads a block of bytes from the stream. (inherited)

ParameterTypeDescription
bufferchar[]
offsetintThe byte offset in the array at which read bytes will be placed.
countintThe maximun number of bytes to read.

Returns int

ReadExisting()

public string ReadExisting()

No description available.

Returns string

ReadLine()

public string ReadLine()

No description available.

Returns string

ReadTo(string value)

public string ReadTo(string value)

Read data the file stream provided in the paramenter (inherited)

ParameterTypeDescription
valuestring

Returns string

Write(string text)

public void Write(string text)

Write a fileinfo or directoryinfo to the socket (inherited)

ParameterTypeDescription
textstring

WriteLine(string text)

public void WriteLine(string text)

No description available.

ParameterTypeDescription
textstring

Write(byte[] buffer, int offset, int count)

public void Write(byte[] buffer, int offset, int count)

Writes a block of bytes to the file stream. (inherited)

ParameterTypeDescription
bufferbyte[]
offsetintThe byte offset in the array from which to start writing bytes to the stream.
countintThe number of bytes to write.

Write(char[] buffer, int offset, int count)

public void Write(char[] buffer, int offset, int count)

Writes a block of bytes to the file stream. (inherited)

ParameterTypeDescription
bufferchar[]
offsetintThe byte offset in the array from which to start writing bytes to the stream.
countintThe number of bytes to write.

DiscardInBuffer()

public void DiscardInBuffer()

No description available.

DiscardOutBuffer()

public void DiscardOutBuffer()

No description available.

GetPortNames()

public static string[] GetPortNames()

No description available.

Returns string[]

Events

DataReceived

public event SerialDataReceivedEventHandler DataReceived

Raised when receive data becomes available. (inherited)

ErrorReceived

public event SerialErrorReceivedEventHandler ErrorReceived

Raised when a frame/parity/overrun error is detected. (inherited)

PinChanged

public event SerialPinChangedEventHandler PinChanged

No description available.

Fields

InfiniteTimeout

public const int InfiniteTimeout

No description available.