|
BSL430.NET
1.2.1
|
Manages two buffers, for reading and writing, between a Stream and a Native Serial object. More...
Public Member Functions | |
| SerialBuffer (int readBuffer, int writeBuffer) | |
| Initializes a new instance of the SerialBuffer class, where the buffer is not pinned. More... | |
| SerialBuffer (int readBuffer, int writeBuffer, bool pinned) | |
| Initializes a new instance of the SerialBuffer class. More... | |
| void | Dispose () |
| Releases unmanaged and - optionally - managed resources. More... | |
Protected Member Functions | |
| virtual void | Dispose (bool disposing) |
| Releases unmanaged and - optionally - managed resources. More... | |
Properties | |
| ISerialBufferSerialData | Serial [get] |
| Access to properties and methods specific to the native serial object. More... | |
| ISerialBufferStreamData | Stream [get] |
| Access to properties and methods specific to the native serial object. More... | |
| object | ReadLock [get] |
| Object to use for locking access to the byte read buffer. More... | |
| object | WriteLock [get] |
| Object to use for locking access to the byte write buffer. More... | |
Properties inherited from RJCP.IO.Ports.Native.ISerialBufferSerialData | |
| CircularBuffer< byte > | ReadBuffer [get] |
| Access the read buffer directly. More... | |
| IntPtr | ReadBufferOffsetEnd [get] |
| Gets the read buffer offset end, used for giving to native API's. More... | |
| CircularBuffer< byte > | WriteBuffer [get] |
| Access the write buffer directly. More... | |
| IntPtr | WriteBufferOffsetStart [get] |
| Gets the write buffer offset start, used for giving to native API's. More... | |
| bool | IsPinnedBuffer [get] |
| Gets a value indicating whether this instance uses a pinned buffer. More... | |
| WaitHandle | ReadBufferNotFull [get] |
| Gets the event handle that is signalled when the read buffer is not full. More... | |
| WaitHandle | WriteBufferNotEmpty [get] |
| Gets the event handle that is signalled when data is in the write buffer. More... | |
Properties inherited from RJCP.IO.Ports.Native.ISerialBufferStreamData | |
| 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... | |
Events | |
| EventHandler | WriteEvent |
| Event raised when data is available to write. This could be used to abort an existing connection. More... | |
Manages two buffers, for reading and writing, between a Stream and a Native Serial object.
This class is used to help implement streams with time out functionality when the actual object that reads and writes data doesn't support streams, but simply reads and writes data using low level APIs.
It is to be expected that this object is only used by one reader and one writer. The reader and writer may be different threads. That is, the properties under SerialData are accessed only by one thread, the properties under StreamData are accessed only by one single (but may be different to SerialData) thread.
| RJCP.IO.Ports.Native.SerialBuffer.SerialBuffer | ( | int | readBuffer, |
| int | writeBuffer | ||
| ) |
Initializes a new instance of the SerialBuffer class, where the buffer is not pinned.
| readBuffer | The read buffer size in bytes. |
| writeBuffer | The write buffer size in bytes. |
Allocates buffer space for reading and writing (accessible via the Serial and Stream properties). The buffers are not pinned, meaning they should not be used for native methods (unless pinned explicitly).
| RJCP.IO.Ports.Native.SerialBuffer.SerialBuffer | ( | int | readBuffer, |
| int | writeBuffer, | ||
| bool | pinned | ||
| ) |
Initializes a new instance of the SerialBuffer class.
| readBuffer | The read buffer size in bytes. |
| writeBuffer | The write buffer size in bytes. |
| pinned | if set to true then the read and write buffers are pinned. |
Allocates buffer space for reading and writing (accessible via the Serial and Stream properties). If specified, the buffers can be pinned. THis causes the buffers to not move for the duration of the program. The usual warnings apply with pinning buffers, you must be careful to avoid memory problems as the GC will not be able to reallocate or free space. Note, you must pin the buffers if you intend to use overlapped I/O.
| void RJCP.IO.Ports.Native.SerialBuffer.Dispose | ( | ) |
Releases unmanaged and - optionally - managed resources.
|
protectedvirtual |
Releases unmanaged and - optionally - managed resources.
| disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
|
get |
Object to use for locking access to the byte read buffer.
The object to use for locking access to the byte read buffer.
|
get |
Access to properties and methods specific to the native serial object.
Access to properties and methods specific to the native serial object.
|
get |
Access to properties and methods specific to the native serial object.
Access to properties and methods specific to the native serial object.
|
get |
Object to use for locking access to the byte write buffer.
The object to use for locking access to the byte write buffer.
| EventHandler RJCP.IO.Ports.Native.SerialBuffer.WriteEvent |
Event raised when data is available to write. This could be used to abort an existing connection.
1.8.15