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.
| Parameter | Type | Description |
|---|---|---|
portName | string |
SerialPort(string portName, int baudRate)
public SerialPort(string portName, int baudRate) : this(portName)
No description available.
| Parameter | Type | Description |
|---|---|---|
portName | string | |
baudRate | int |
SerialPort(string portName, int baudRate, Parity parity)
public SerialPort(string portName, int baudRate, Parity parity) : this(portName, baudRate)
No description available.
| Parameter | Type | Description |
|---|---|---|
portName | string | |
baudRate | int | |
parity | Parity |
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.
| Parameter | Type | Description |
|---|---|---|
portName | string | |
baudRate | int | |
parity | Parity | |
dataBits | int |
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.
| Parameter | Type | Description |
|---|---|---|
portName | string | |
baudRate | int | |
parity | Parity | |
dataBits | int | |
stopBits | StopBits |
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)
| Parameter | Type | Description |
|---|---|---|
buffer | byte[] | |
offset | int | The byte offset in the array at which read bytes will be placed. |
count | int | The 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)
| Parameter | Type | Description |
|---|---|---|
buffer | char[] | |
offset | int | The byte offset in the array at which read bytes will be placed. |
count | int | The 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)
| Parameter | Type | Description |
|---|---|---|
value | string |
Returns string
Write(string text)
public void Write(string text)
Write a fileinfo or directoryinfo to the socket (inherited)
| Parameter | Type | Description |
|---|---|---|
text | string |
WriteLine(string text)
public void WriteLine(string text)
No description available.
| Parameter | Type | Description |
|---|---|---|
text | string |
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)
| Parameter | Type | Description |
|---|---|---|
buffer | byte[] | |
offset | int | The byte offset in the array from which to start writing bytes to the stream. |
count | int | The 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)
| Parameter | Type | Description |
|---|---|---|
buffer | char[] | |
offset | int | The byte offset in the array from which to start writing bytes to the stream. |
count | int | The 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.