C# Класс LitDev.LDCommPort

Показать файл Открыть проект

Открытые методы

Метод Описание
AvailablePorts ( ) : Primitive

Returns a list of available serial ports.

ClosePort ( ) : Primitive

Closes the open serial port.

OpenPort ( Primitive portName, Primitive baudRate ) : Primitive

Opens a serial port for use. Assumes 8 databits, no parity.

RXAll ( ) : Primitive

Reads all available bytes in the open comm port input buffer.

RXByte ( ) : Primitive

Reads one byte from the open serial port and returns that byte as an integer.

RXChar ( ) : Primitive

Reads one byte from the open serial port and returns that byte as a unicode character.

SetDataBits ( Primitive dataBits ) : Primitive

Sets current port data bits. 5 to 8 (default).

SetEncoding ( Primitive encoding ) : Primitive

Sets current port encoding for send and receive text conversion.

SetHandshake ( Primitive handshake ) : Primitive

Sets or clears hardware flow control for the current port.

SetParity ( Primitive parity ) : Primitive

Sets current port parity.

SetStopBits ( Primitive stopBits ) : Primitive

Current port stop bits.

SwapPort ( Primitive portName ) : Primitive

Switch the current active port to a previously opened port.

TXByte ( Primitive dataByte ) : Primitive

Sends one byte to the serial port.

TXString ( Primitive dataString ) : Primitive

Sends a string to the serial port.

Приватные методы

Метод Описание
DataReceivedEvent ( Object sender, System.IO.Ports.SerialDataReceivedEventArgs e ) : void
ErrorReceivedEvent ( Object sender, System.IO.Ports.SerialErrorReceivedEventArgs e ) : void

Описание методов

AvailablePorts() публичный статический Метод

Returns a list of available serial ports.
public static AvailablePorts ( ) : Primitive
Результат Primitive

ClosePort() публичный статический Метод

Closes the open serial port.
public static ClosePort ( ) : Primitive
Результат Primitive

OpenPort() публичный статический Метод

Opens a serial port for use. Assumes 8 databits, no parity.
public static OpenPort ( Primitive portName, Primitive baudRate ) : Primitive
portName Primitive /// String identifying which port to open in the form of "COM8". ///
baudRate Primitive /// Integer baud rate, for example 9600. ///
Результат Primitive

RXAll() публичный статический Метод

Reads all available bytes in the open comm port input buffer.
public static RXAll ( ) : Primitive
Результат Primitive

RXByte() публичный статический Метод

Reads one byte from the open serial port and returns that byte as an integer.
public static RXByte ( ) : Primitive
Результат Primitive

RXChar() публичный статический Метод

Reads one byte from the open serial port and returns that byte as a unicode character.
public static RXChar ( ) : Primitive
Результат Primitive

SetDataBits() публичный статический Метод

Sets current port data bits. 5 to 8 (default).
public static SetDataBits ( Primitive dataBits ) : Primitive
dataBits Primitive The data bits: /// 5 to 8 (default). ///
Результат Primitive

SetEncoding() публичный статический Метод

Sets current port encoding for send and receive text conversion.
public static SetEncoding ( Primitive encoding ) : Primitive
encoding Primitive The encoding: /// "Ascii" (default), "Unicode", "UTF7", "UTF8", "UTF32" or "BigEndianUnicode". ///
Результат Primitive

SetHandshake() публичный статический Метод

Sets or clears hardware flow control for the current port.
public static SetHandshake ( Primitive handshake ) : Primitive
handshake Primitive /// "H" to select hardware flow control, "HX" for hardware and software flow control, "X" for software fow control, any other character to clear. ///
Результат Primitive

SetParity() публичный статический Метод

Sets current port parity.
public static SetParity ( Primitive parity ) : Primitive
parity Primitive The parity: /// "None" (default), "Even", "Mark", "Odd" or "Space". ///
Результат Primitive

SetStopBits() публичный статический Метод

Current port stop bits.
public static SetStopBits ( Primitive stopBits ) : Primitive
stopBits Primitive The stop bits: /// "One" (default), "None", "OnePointFive" or "Two". ///
Результат Primitive

SwapPort() публичный статический Метод

Switch the current active port to a previously opened port.
public static SwapPort ( Primitive portName ) : Primitive
portName Primitive String identifying a port that is already opened.
Результат Primitive

TXByte() публичный статический Метод

Sends one byte to the serial port.
public static TXByte ( Primitive dataByte ) : Primitive
dataByte Primitive /// The byte to be written to the port. ///
Результат Primitive

TXString() публичный статический Метод

Sends a string to the serial port.
public static TXString ( Primitive dataString ) : Primitive
dataString Primitive /// String value to be sent. ///
Результат Primitive