BSL430.NET 1.2.1

Public Member Functions | Properties | List of all members
RJCP.IO.Ports.Native.ISerialBufferStreamData Interface Reference

Container structure for properties and methods related to the Stream object. More...

Inheritance diagram for RJCP.IO.Ports.Native.ISerialBufferStreamData:

## Public Member Functions
bool | WaitForRead (int timeout)
| Waits up to a specified time out for data to be available to read. More...
bool | WaitForRead (int count, int timeout)
| Waits up to a specified time out for data to be available to read. More...
int | Read (byte[] buffer, int offset, int count)
| Reads data received by the Serial object, copying it into a buffer and reducing the read buffer size. More...
void | ReadConsume (int count)
| Consume bytes from the incoming buffer. More...
int | Read (char[] buffer, int offset, int count, Decoder decoder)
| Reads data received by the serial object, converted to characters using the specified decoder. More...
int | ReadByte ()
| Reads a single byte from the input queue. More...
void | DiscardInBuffer ()
| Discards data from the receive buffer. More...
bool | WaitForWrite (int count, int timeout)
| Waits up to a specified time out for enough data to be free in the write buffer. More...
void | AbortWait ()
| Aborts the wait for write. More...
int | Write (byte[] buffer, int offset, int count)
| Puts data into the write buffer for the Serial object to send. More...
bool | Flush (int timeout)
| Waits for all data in the write buffer to be written with notification also by the serial buffer. More...
void | Reset (bool clearBuffer)
| Reset the buffer to an initial state ready for a new connection. More...

## Properties
int | BytesToRead`[get]`
| Gets the number of bytes in the internal read buffer only. More...
int | BytesToWrite`[get]`
| Gets the number of bytes in the internal write buffer only. More...

## Detailed Description

Container structure for properties and methods related to the Stream object.

## Member Function Documentation

## ◆ AbortWait()

void RJCP.IO.Ports.Native.ISerialBufferStreamData.AbortWait | ( |  | ) |

Aborts the wait for write.

## ◆ DiscardInBuffer()

void RJCP.IO.Ports.Native.ISerialBufferStreamData.DiscardInBuffer | ( |  | ) |

Discards data from the receive buffer.

## ◆ Flush()

bool RJCP.IO.Ports.Native.ISerialBufferStreamData.Flush | ( | int | timeout | ) |

Waits for all data in the write buffer to be written with notification also by the serial buffer.

Parameters

  timeout | The time out in milliseconds.

Returns
  `true` if the data was flushed within the specified time out; `false` otherwise.

## ◆ Read() [1/2]

int RJCP.IO.Ports.Native.ISerialBufferStreamData.Read | ( | byte [] | buffer,
|  | int | offset,
|  | int | count
| ) |  |

Reads data received by the Serial object, copying it into a buffer and reducing the read buffer size.

Parameters

  buffer | The buffer to copy data into.
  offset | The offset where to copy data into..
  count | The number of bytes to copy.

Returns
  Number of bytes actually read from the queue.

## ◆ Read() [2/2]

int RJCP.IO.Ports.Native.ISerialBufferStreamData.Read | ( | char [] | buffer,
|  | int | offset,
|  | int | count,
|  | Decoder | decoder
| ) |  |

Reads data received by the serial object, converted to characters using the specified decoder.

Parameters

  buffer | The character buffer to read into.
  offset | The offset into buffer .
  count | The number of characters to write into buffer .
  decoder | The decoder to use for the conversion.

Returns
  The number of characters read.

This method has no input checks that it is internal

## ◆ ReadByte()

int RJCP.IO.Ports.Native.ISerialBufferStreamData.ReadByte | ( |  | ) |

Reads a single byte from the input queue.

Returns
  The byte, cast to an Int32, or -1 if the end of the stream has been read.

## ◆ ReadConsume()

void RJCP.IO.Ports.Native.ISerialBufferStreamData.ReadConsume | ( | int | count | ) |

Consume bytes from the incoming buffer.

Parameters

  count | The number of bytes to discard at the beginning of the read byte buffer.

## ◆ Reset()

void RJCP.IO.Ports.Native.ISerialBufferStreamData.Reset | ( | bool | clearBuffer | ) |

Reset the buffer to an initial state ready for a new connection.

Parameters

  clearBuffer | Set to `true` to reset the contents of the buffers.

This should only be closed when the serial port is closed.

## ◆ WaitForRead() [1/2]

bool RJCP.IO.Ports.Native.ISerialBufferStreamData.WaitForRead | ( | int | timeout | ) |

Waits up to a specified time out for data to be available to read.

Parameters

  timeout | The time out in milliseconds.

Returns
  `true` if data is available to read in time; `false` otherwise.

## ◆ WaitForRead() [2/2]

bool RJCP.IO.Ports.Native.ISerialBufferStreamData.WaitForRead | ( | int | count,
|  | int | timeout
| ) |  |

Waits up to a specified time out for data to be available to read.

Parameters

  count | The number of bytes that should be in the read buffer.
  timeout | The time out in milliseconds.

Returns
  `true` if data is available to read in time; `false` otherwise.

## ◆ WaitForWrite()

bool RJCP.IO.Ports.Native.ISerialBufferStreamData.WaitForWrite | ( | int | count,
|  | int | timeout
| ) |  |

Waits up to a specified time out for enough data to be free in the write buffer.

Parameters

  count | The number of bytes required to be free.
  timeout | The time out in milliseconds.

Returns
  `true` if count bytes are available for writing to the buffer; `false` if there is not enough buffer available within the timeout parameter. If count is larger than the capacity of the buffer, `false` is returned immediately.

## ◆ Write()

int RJCP.IO.Ports.Native.ISerialBufferStreamData.Write | ( | byte [] | buffer,
|  | int | offset,
|  | int | count
| ) |  |

Puts data into the write buffer for the Serial object to send.

Parameters

  buffer | The buffer to copy data from.
  offset | The offset where to copy the data from.
  count | The number of bytes to copy.

Returns
  Number of bytes actually written to the queue.

## Property Documentation

## ◆ BytesToRead

int RJCP.IO.Ports.Native.ISerialBufferStreamData.BytesToRead
| get

Gets the number of bytes in the internal read buffer only.

This value is independent of the actual number of bytes in the serial port hardware buffer. It will only return that which is currently obtained by the I/O thread.

## ◆ BytesToWrite

int RJCP.IO.Ports.Native.ISerialBufferStreamData.BytesToWrite
| get

Gets the number of bytes in the internal write buffer only.

This value is independent of the actual number of bytes in the serial port hardware buffer. It will only return that which is currently not completely written by the I/O thread.

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

- C:/PROJECTS/C#/BSL430.NET/src/BSL430.NET/Library/serialportstream/2.1.4/src/Native/ISerialBufferStreamData.cs