C# 클래스 System.IO.Ports.SerialPortBase

상속: ISerialPort
파일 보기 프로젝트 열기: toxsedyshev/imBMW 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Encoding System.Text.Encoding
NewLine string

보호된 프로퍼티들

프로퍼티 타입 설명
_bufferSync object
_continueReading bool
_incomingBuffer byte[]
_incomingBufferPosition int
_incomingBufferValidLength int
_readBufferSize int
_readThread Thread
_readToEvent System.Threading.AutoResetEvent
_writeBufferSize int
_writeThread Thread

공개 메소드들

메소드 설명
Flush ( ) : void
Read ( byte buffer, int offset, int count ) : int

Reads data from a serial port.

ReadAvailable ( ) : byte[]

Reads all available bytes and removes them from the reading buffer.

ReadAvailable ( int maxCount ) : byte[]

Reads desired number of bytes and removes them from the reading buffer.

ReadLine ( ) : string

Reads data from a serial port up to the NewLine value and decodes them as string using Encoding.

This method does not return until NewLine sequence is received.

SerialPortBase ( ) : System
SerialPortBase ( int writeBufferSize, int readBufferSize ) : System
Write ( ) : void

Writes data to a serial port.

The method does not return until all data are sent, including output buffer pauses and/or hardware flow control pauses, if applicable.

Write ( byte data, int offset, int length ) : void

Writes data to a serial port.

The method does not return until all data is sent, including output buffer pauses and/or hardware flow control pauses, if applicable.

Write ( string text ) : void

Encodes string data using Encoding and sends them to a serial port.

The method does not return until all data are sent, including output buffer pauses and/or hardware flow control pauses, if applicable.

WriteLine ( string text ) : void

Appends NewLine to the string, encodes it using Encoding and sends it to a serial port.

The method does not return until all data are sent, including output buffer pauses and/or hardware flow control pauses, if applicable.

보호된 메소드들

메소드 설명
AdvancePosition ( int count ) : void

Advances the internal circular read bufer position by specified amount and updates the valid length field accordingly.

BufferIndexOf ( byte what ) : int

Searches the internal circular read buffer for sequence of bytes.

GetBufferedData ( int arraySize ) : byte[]

Returns specified amount of data from internal circular read buffer. If there is not enough data available, remaining bytes are filled with zeros.

GetBufferedData ( byte buffer, int offset, int count ) : int

Copies specified amount of data from internal circular read buffer to the specified linear buffer.

OnBusyChanged ( bool busy ) : void
OnDataReceived ( byte data, int validLength ) : void

Adds the received data into internal circular read buffer and fires DataReceived event.

ReadDirect ( byte data, int offset, int length ) : int
ReadLoop ( ) : void
StartReading ( ) : void

Starts waiting for data in order to fire DataReceived event.

StopReading ( ) : void

Stops waiting for data.

WriteDirect ( byte data, int offset, int length ) : int

비공개 메소드들

메소드 설명
ReadTo ( ) : byte[]

메소드 상세

AdvancePosition() 보호된 메소드

Advances the internal circular read bufer position by specified amount and updates the valid length field accordingly.
protected AdvancePosition ( int count ) : void
count int The number of bytes to move forward.
리턴 void

BufferIndexOf() 보호된 메소드

Searches the internal circular read buffer for sequence of bytes.
protected BufferIndexOf ( byte what ) : int
what byte The sequence to look for.
리턴 int

Flush() 공개 추상적인 메소드

public abstract Flush ( ) : void
리턴 void

GetBufferedData() 보호된 메소드

Returns specified amount of data from internal circular read buffer. If there is not enough data available, remaining bytes are filled with zeros.
protected GetBufferedData ( int arraySize ) : byte[]
arraySize int The number of bytes to return.
리턴 byte[]

GetBufferedData() 보호된 메소드

Copies specified amount of data from internal circular read buffer to the specified linear buffer.
protected GetBufferedData ( byte buffer, int offset, int count ) : int
buffer byte The linear buffer that stores the data read from the internal read buffer.
offset int The offset value that indicates where writing to the linear buffer from the internal read buffer is to begin.
count int The number of bytes of data to be copied.
리턴 int

OnBusyChanged() 보호된 메소드

protected OnBusyChanged ( bool busy ) : void
busy bool
리턴 void

OnDataReceived() 보호된 메소드

Adds the received data into internal circular read buffer and fires DataReceived event.
protected OnDataReceived ( byte data, int validLength ) : void
data byte An array with data received.
validLength int Number of valid bytes in the array.
리턴 void

Read() 공개 메소드

Reads data from a serial port.
public Read ( byte buffer, int offset, int count ) : int
buffer byte The output buffer that stores the data read from the serial port.
offset int The offset value that indicates where writing to the output buffer from the serial port is to begin.
count int The number of bytes of data to be read.
리턴 int

ReadAvailable() 공개 메소드

Reads all available bytes and removes them from the reading buffer.
public ReadAvailable ( ) : byte[]
리턴 byte[]

ReadAvailable() 공개 메소드

Reads desired number of bytes and removes them from the reading buffer.
public ReadAvailable ( int maxCount ) : byte[]
maxCount int The maximum count of bytes to return.
리턴 byte[]

ReadDirect() 보호된 추상적인 메소드

protected abstract ReadDirect ( byte data, int offset, int length ) : int
data byte
offset int
length int
리턴 int

ReadLine() 공개 메소드

Reads data from a serial port up to the NewLine value and decodes them as string using Encoding.
This method does not return until NewLine sequence is received.
public ReadLine ( ) : string
리턴 string

ReadLoop() 보호된 메소드

protected ReadLoop ( ) : void
리턴 void

SerialPortBase() 공개 메소드

public SerialPortBase ( ) : System
리턴 System

SerialPortBase() 공개 메소드

public SerialPortBase ( int writeBufferSize, int readBufferSize ) : System
writeBufferSize int
readBufferSize int
리턴 System

StartReading() 보호된 메소드

Starts waiting for data in order to fire DataReceived event.
protected StartReading ( ) : void
리턴 void

StopReading() 보호된 메소드

Stops waiting for data.
protected StopReading ( ) : void
리턴 void

Write() 공개 메소드

Writes data to a serial port.
The method does not return until all data are sent, including output buffer pauses and/or hardware flow control pauses, if applicable.
public Write ( ) : void
리턴 void

Write() 공개 메소드

Writes data to a serial port.
The method does not return until all data is sent, including output buffer pauses and/or hardware flow control pauses, if applicable.
public Write ( byte data, int offset, int length ) : void
data byte The input buffer that is to write to the serial port.
offset int The offset value that indicates where writing from the input buffer to the serial port is to begin.
length int The number of bytes of data to be written to the serial port.
리턴 void

Write() 공개 메소드

Encodes string data using Encoding and sends them to a serial port.
The method does not return until all data are sent, including output buffer pauses and/or hardware flow control pauses, if applicable.
public Write ( string text ) : void
text string String data to send.
리턴 void

WriteDirect() 보호된 추상적인 메소드

protected abstract WriteDirect ( byte data, int offset, int length ) : int
data byte
offset int
length int
리턴 int

WriteLine() 공개 메소드

Appends NewLine to the string, encodes it using Encoding and sends it to a serial port.
The method does not return until all data are sent, including output buffer pauses and/or hardware flow control pauses, if applicable.
public WriteLine ( string text ) : void
text string String data to send.
리턴 void

프로퍼티 상세

Encoding 공개적으로 프로퍼티

Encoding to use when reading or writing string data. Default is UTF-8. Only expanding encodings are supported.
public Encoding,System.Text Encoding
리턴 System.Text.Encoding

NewLine 공개적으로 프로퍼티

A string representing the line delimiter in string data.
public string NewLine
리턴 string

_bufferSync 보호되어 있는 프로퍼티

protected object _bufferSync
리턴 object

_continueReading 보호되어 있는 프로퍼티

protected bool _continueReading
리턴 bool

_incomingBuffer 보호되어 있는 프로퍼티

protected byte[] _incomingBuffer
리턴 byte[]

_incomingBufferPosition 보호되어 있는 프로퍼티

protected int _incomingBufferPosition
리턴 int

_incomingBufferValidLength 보호되어 있는 프로퍼티

protected int _incomingBufferValidLength
리턴 int

_readBufferSize 보호되어 있는 프로퍼티

protected int _readBufferSize
리턴 int

_readThread 보호되어 있는 프로퍼티

protected Thread _readThread
리턴 Thread

_readToEvent 보호되어 있는 프로퍼티

protected AutoResetEvent,System.Threading _readToEvent
리턴 System.Threading.AutoResetEvent

_writeBufferSize 보호되어 있는 프로퍼티

protected int _writeBufferSize
리턴 int

_writeThread 보호되어 있는 프로퍼티

protected Thread _writeThread
리턴 Thread