BSL430.NET  1.2.1
Public Member Functions | Properties | List of all members
RJCP.IO.Ports.Native.ReadToCache Class Reference

Public Member Functions

int Read (SerialBuffer sbuffer, char[] cbuffer, int offset, int count)
 Reads characters from the byte buffer into the character buffer, consuming data from the byte buffer. More...
 
int ReadChar (SerialBuffer sbuffer)
 Synchronously reads one character from the SerialPortStream input buffer. More...
 
bool ReadTo (SerialBuffer sbuffer, string text, out string line)
 Reads from the cached and byte stream looking for the text specified. More...
 
bool ReadToWaitForNewData (SerialBuffer sbuffer, int timeout)
 Waits for new data to arrive that can be used to recheck for new data. More...
 
string ReadExisting (SerialBuffer sbuffer)
 Reads all immediately available bytes. More...
 
void Reset (bool withOverflow)
 Resets the cache, taking optionally into account a previous overflow. More...
 

Properties

Encoding Encoding [get, set]
 Gets or sets the byte encoding for pre- and post-transmission conversion of text. More...
 

Member Function Documentation

◆ Read()

int RJCP.IO.Ports.Native.ReadToCache.Read ( SerialBuffer  sbuffer,
char []  cbuffer,
int  offset,
int  count 
)

Reads characters from the byte buffer into the character buffer, consuming data from the byte buffer.

Parameters
sbufferThe byte buffer to read from.
cbufferThe character buffer to write to.
offsetThe offset to write to in cbuffer .
countThe number of characters to read into cbuffer .
Returns
The number of bytes read into cbuffer .

Data is read from the read byte buffer kept in sbuffer , converted using the decoder into cbuffer . As data is read from sbuffer, it is consumed.

◆ ReadChar()

int RJCP.IO.Ports.Native.ReadToCache.ReadChar ( SerialBuffer  sbuffer)

Synchronously reads one character from the SerialPortStream input buffer.

Parameters
sbufferThe byte buffer to read from.
Returns
The character that was read. -1 indicates no data was available within the time out.

◆ ReadExisting()

string RJCP.IO.Ports.Native.ReadToCache.ReadExisting ( SerialBuffer  sbuffer)

Reads all immediately available bytes.

Parameters
sbufferThe byte buffer to read from.
Returns
The contents of the stream and the input buffer of the SerialPortStream.

◆ ReadTo()

bool RJCP.IO.Ports.Native.ReadToCache.ReadTo ( SerialBuffer  sbuffer,
string  text,
out string  line 
)

Reads from the cached and byte stream looking for the text specified.

Parameters
sbufferThe byte buffer to read from.
textThe text to indicate where the read operation stops.
lineOn success, contains the line up to the text string requested.
Returns
true if a line was found; false otherwise.

◆ ReadToWaitForNewData()

bool RJCP.IO.Ports.Native.ReadToCache.ReadToWaitForNewData ( SerialBuffer  sbuffer,
int  timeout 
)

Waits for new data to arrive that can be used to recheck for new data.

Parameters
sbufferThe byte buffer to read from.
timeoutThe time out in milliseconds.
Returns
true if one more byte is available since the last ReadTo call; false otherwise

◆ Reset()

void RJCP.IO.Ports.Native.ReadToCache.Reset ( bool  withOverflow)

Resets the cache, taking optionally into account a previous overflow.

Parameters
withOverflowif set to true a previous overflow is taken into account and reinserted into the buffer, as if the first character had already been read.

Property Documentation

◆ Encoding

Encoding RJCP.IO.Ports.Native.ReadToCache.Encoding
getset

Gets or sets the byte encoding for pre- and post-transmission conversion of text.

The encoding is used for encoding string information to byte format when sending over the serial port, or receiving data via the serial port. It is only used with the read/write functions that accept strings (and not used for byte based reading and writing).


The documentation for this class was generated from the following file: