Common communication functions

Written by Pintér Gábor
Purbach am Neusiedlersee
Feuerwehrgasse 1/2/9
A-7083
Austria

Tel: +36 20 4331532, +43 681 20821067
Skype: pinter.gabor.at
Email: pinter.gabor@gmx.at
Web: http://www.pintergabor.eu

See Also

Other Resources

Version History


Version History

Version History
Revision | Date | Description
V1.0 | 2010-07-12 | Original
V1.1 | 2010-11-17 | Recompiled with VS2010
V1.2 | 2010-09-14 | Recompiled with VS2013, Help added
See Also

Other Resources

Common communication functions


ComCommonLib Namespace

ComCommonLib Namespace
Library default namespace.
Classes
 | Class | Description
Public class | FIFO2T | Generic 2 pointer FIFO.
Public class | FIFO3T | Generic 3 pointer FIFO.
Interfaces
 | Interface | Description
Public interface | IOpenClose | An simple stream
Public interface | IRead | A readable stream.
Public interface | IReadT | A readable stream.
Public interface | IWrite | A writable stream.
Public interface | IWriteT | A writable stream.


FIFO2(T) Class

FIFO2T Class
Generic 2 pointer FIFO.
Inheritance Hierarchy
SystemObject
ComCommonLibFIFO2T
ComCommonLibFIFO3T

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public class FIFO2<T>

Type Parameters

T
Element type.

The FIFO2T type exposes the following members.

Constructors
 | Name | Description
Public method | FIFO2T | Set buffer size too.
Top
Methods
 | Name | Description
Protected method | AddPtr | Advance internal circular pointer.
Public method | Clear | Clear all items from internal buffer.
Public method | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method | Finalize | Release both NotEmpty and NotFull prior to destroy. (Overrides ObjectFinalize.)
Public method | Free | Number of free items in internal buffer.
Public method | Get | Get one item from internal buffer.
Public method | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
Public method | GetType | Gets the Type of the current instance. (Inherited from Object.)
Protected method | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
Public method | Put | Put item to internal buffer.
Public method | Read(T, Int32) | Read items from internal buffer.
Public method | Read(T, Int32, Int32) | Read items from internal buffer.
Protected method | SubPtr | Calculate difference between two protected circular pointers.
Public method | ToString | Returns a string that represents the current object. (Inherited from Object.)
Public method | Used | Number of used items in internal buffer.
Public method | Write(T, Int32) | Write items to internal buffer.
Public method | Write(T, Int32, Int32) | Write items to internal buffer.
Top
Fields
 | Name | Description
Protected field | Buffer | Internal buffer.
Public field | NotEmpty | True if the internal buffer is not empty.
Public field | NotFull | True if the internal buffer is not full.
Protected field | ReadPtr | Read pointer.
Protected field | WritePtr | Write pointer.
Top
Properties
 | Name | Description
Public property | BufferSize | Size of internal buffer.
Top
Remarks
Reasonably thread safe. Read and write can be called from different threads.
See Also

Reference

ComCommonLib Namespace


FIFO2(T) Constructor

FIFO2T Constructor
Set buffer size too.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public FIFO2(
    int buffersize
)

Parameters

buffersize
Type: SystemInt32
Inital buffer size.
See Also

Reference

FIFO2T Class


FIFO2(T) Fields

FIFO2T Fields

The FIFO2T generic type exposes the following members.

Fields
 | Name | Description
Protected field | Buffer | Internal buffer.
Public field | NotEmpty | True if the internal buffer is not empty.
Public field | NotFull | True if the internal buffer is not full.
Protected field | ReadPtr | Read pointer.
Protected field | WritePtr | Write pointer.
Top
See Also

Reference

FIFO2T Class


FIFO2(T).Buffer Field

FIFO2TBuffer Field
Internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected T[] Buffer

Field Value

Type: T
See Also

Reference

FIFO2T Class


FIFO2(T).NotEmpty Field

FIFO2TNotEmpty Field
True if the internal buffer is not empty.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public ManualResetEvent NotEmpty

Field Value

Type: ManualResetEvent
Remarks
It is also true if BufferSize==0.
See Also

Reference

FIFO2T Class


FIFO2(T).NotFull Field

FIFO2TNotFull Field
True if the internal buffer is not full.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public ManualResetEvent NotFull

Field Value

Type: ManualResetEvent
Remarks
It is also true if BufferSize==0.
See Also

Reference

FIFO2T Class


FIFO2(T).ReadPtr Field

FIFO2TReadPtr Field
Read pointer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected int ReadPtr

Field Value

Type: Int32
See Also

Reference

FIFO2T Class


FIFO2(T).WritePtr Field

FIFO2TWritePtr Field
Write pointer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected int WritePtr

Field Value

Type: Int32
See Also

Reference

FIFO2T Class


FIFO2(T) Methods

FIFO2T Methods

The FIFO2T generic type exposes the following members.

Methods
 | Name | Description
Protected method | AddPtr | Advance internal circular pointer.
Public method | Clear | Clear all items from internal buffer.
Public method | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method | Finalize | Release both NotEmpty and NotFull prior to destroy. (Overrides ObjectFinalize.)
Public method | Free | Number of free items in internal buffer.
Public method | Get | Get one item from internal buffer.
Public method | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
Public method | GetType | Gets the Type of the current instance. (Inherited from Object.)
Protected method | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
Public method | Put | Put item to internal buffer.
Public method | Read(T, Int32) | Read items from internal buffer.
Public method | Read(T, Int32, Int32) | Read items from internal buffer.
Protected method | SubPtr | Calculate difference between two protected circular pointers.
Public method | ToString | Returns a string that represents the current object. (Inherited from Object.)
Public method | Used | Number of used items in internal buffer.
Public method | Write(T, Int32) | Write items to internal buffer.
Public method | Write(T, Int32, Int32) | Write items to internal buffer.
Top
See Also

Reference

FIFO2T Class


FIFO2(T).AddPtr Method

FIFO2TAddPtr Method
Advance internal circular pointer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected void AddPtr(
    ref int ptr,
    int add
)

Parameters

ptr
Type: SystemInt32
Buffer pointer.
add
Type: SystemInt32
Advance amount.
See Also

Reference

FIFO2T Class


FIFO2(T).Clear Method

FIFO2TClear Method
Clear all items from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public virtual void Clear()
See Also

Reference

FIFO2T Class


FIFO2(T).Finalize Method

FIFO2TFinalize Method
Release both NotEmpty and NotFull prior to destroy.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected override void Finalize()
See Also

Reference

FIFO2T Class


FIFO2(T).Free Method

FIFO2TFree Method
Number of free items in internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Free()

Return Value

Type: Int32
Number of free items.
See Also

Reference

FIFO2T Class


FIFO2(T).Get Method

FIFO2TGet Method
Get one item from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public virtual bool Get(
    out T b
)

Parameters

b
Type: T
Item to return.

Return Value

Type: Boolean
True on success.
Remarks
The item is consumed.
See Also

Reference

FIFO2T Class


FIFO2(T).Put Method

FIFO2TPut Method
Put item to internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public virtual bool Put(
    T b
)

Parameters

b
Type: T
Item.

Return Value

Type: Boolean
True on success.
See Also

Reference

FIFO2T Class


FIFO2(T).Read Method

FIFO2TRead Method
Overload List
 | Name | Description
Public method | Read(T, Int32) | Read items from internal buffer.
Public method | Read(T, Int32, Int32) | Read items from internal buffer.
Top
See Also

Reference

FIFO2T Class


FIFO2(T).Read Method (T[], Int32)

FIFO2TRead Method (T, Int32)
Read items from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Read(
    T[] b,
    int count
)

Parameters

b
Type: T
Array of items to return.
count
Type: SystemInt32
Max number of items requested.

Return Value

Type: Int32
Actual number of items returned.
Remarks
Items are consumed.
See Also

Reference

FIFO2T Class
Read Overload


FIFO2(T).Read Method (T[], Int32, Int32)

FIFO2TRead Method (T, Int32, Int32)
Read items from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Read(
    T[] b,
    int start,
    int count
)

Parameters

b
Type: T
Array of items to return.
start
Type: SystemInt32
Start position in array.
count
Type: SystemInt32
Max number of items requested.

Return Value

Type: Int32
Actual number of items returned.
Remarks
Items are consumed.
See Also

Reference

FIFO2T Class
Read Overload


FIFO2(T).SubPtr Method

FIFO2TSubPtr Method
Calculate difference between two protected circular pointers.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected int SubPtr(
    int ptr1,
    int ptr0
)

Parameters

ptr1
Type: SystemInt32
Buffer pointer.
ptr0
Type: SystemInt32
Buffer pointer.

Return Value

Type: Int32
ptr1-ptr0
See Also

Reference

FIFO2T Class


FIFO2(T).Used Method

FIFO2TUsed Method
Number of used items in internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Used()

Return Value

Type: Int32
Number of used location.
See Also

Reference

FIFO2T Class


FIFO2(T).Write Method

FIFO2TWrite Method
Overload List
 | Name | Description
Public method | Write(T, Int32) | Write items to internal buffer.
Public method | Write(T, Int32, Int32) | Write items to internal buffer.
Top
See Also

Reference

FIFO2T Class


FIFO2(T).Write Method (T[], Int32)

FIFO2TWrite Method (T, Int32)
Write items to internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Write(
    T[] b,
    int count
)

Parameters

b
Type: T
Array of items to store.
count
Type: SystemInt32
Number of items in the array.

Return Value

Type: Int32
Actual number of items stored.
See Also

Reference

FIFO2T Class
Write Overload


FIFO2(T).Write Method (T[], Int32, Int32)

FIFO2TWrite Method (T, Int32, Int32)
Write items to internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Write(
    T[] b,
    int start,
    int count
)

Parameters

b
Type: T
Array of items to store.
start
Type: SystemInt32
Start position in array.
count
Type: SystemInt32
Number of items in the array.

Return Value

Type: Int32
Actual number of items stored.
See Also

Reference

FIFO2T Class
Write Overload


FIFO2(T) Properties

FIFO2T Properties

The FIFO2T generic type exposes the following members.

Properties
 | Name | Description
Public property | BufferSize | Size of internal buffer.
Top
See Also

Reference

FIFO2T Class


FIFO2(T).BufferSize Property

FIFO2TBufferSize Property
Size of internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int BufferSize { get; set; }

Property Value

Type: Int32
Remarks
Changing it will clear the buffer contents. Setting it to 0 sets both NotEmpty and NotFull.
See Also

Reference

FIFO2T Class


FIFO3(T) Class

FIFO3T Class
Generic 3 pointer FIFO.
Inheritance Hierarchy
SystemObject
ComCommonLibFIFO2 T
ComCommonLibFIFO3T

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public class FIFO3<T> : FIFO2<T>

Type Parameters

T
Item type.

The FIFO3T type exposes the following members.

Constructors
 | Name | Description
Public method | FIFO3T | Set buffer size too.
Top
Methods
 | Name | Description
Protected method | AddPtr | Advance internal circular pointer. (Inherited from FIFO2T.)
Public method | Clear | Clear all items from internal buffer. (Overrides FIFO2TClear.)
Public method | Discard | Consume items already peeked.
Public method | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method | Finalize | Release both NotEmpty and NotFull prior to destroy. (Inherited from FIFO2T.)
Public method | Free | Number of free items in internal buffer. (Inherited from FIFO2T.)
Public method | Get | Get one item from internal buffer. (Overrides FIFO2TGet(T).)
Public method | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
Public method | GetType | Gets the Type of the current instance. (Inherited from Object.)
Protected method | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
Public method | Peek(T) | Get one item from internal buffer.
Public method | Peek(T, Int32) | Read items from internal buffer.
Public method | Put | Put item to internal buffer. (Overrides FIFO2TPut(T).)
Public method | Read(T, Int32) | Read items from internal buffer. (Inherited from FIFO2T.)
Public method | Read(T, Int32, Int32) | Read items from internal buffer. (Inherited from FIFO2T.)
Public method | Seek | Move the Peek pointer relative to Read pointer.
Protected method | SubPtr | Calculate difference between two protected circular pointers. (Inherited from FIFO2T.)
Public method | ToString | Returns a string that represents the current object. (Inherited from Object.)
Public method | Used | Number of used items in internal buffer. (Inherited from FIFO2T.)
Public method | Write(T, Int32) | Write items to internal buffer. (Inherited from FIFO2T.)
Public method | Write(T, Int32, Int32) | Write items to internal buffer. (Inherited from FIFO2T.)
Top
Fields
 | Name | Description
Protected field | Buffer | Internal buffer. (Inherited from FIFO2T.)
Public field | NotEmpty | True if the internal buffer is not empty. (Inherited from FIFO2T.)
Public field | NotFull | True if the internal buffer is not full. (Inherited from FIFO2T.)
Protected field | ReadPtr | Read pointer. (Inherited from FIFO2T.)
Protected field | SeekPtr | Seek pointer.
Protected field | WritePtr | Write pointer. (Inherited from FIFO2T.)
Top
Properties
 | Name | Description
Public property | BufferSize | Size of internal buffer. (Inherited from FIFO2T.)
Top
Remarks
Reasonably thread safe. Read/peek/seek and write can be called from different threads.
See Also

Reference

ComCommonLib Namespace


FIFO3(T) Constructor

FIFO3T Constructor
Set buffer size too.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public FIFO3(
    int buffersize
)

Parameters

buffersize
Type: SystemInt32
Inital buffer size.
See Also

Reference

FIFO3T Class


FIFO3(T) Fields

FIFO3T Fields

The FIFO3T generic type exposes the following members.

Fields
 | Name | Description
Protected field | Buffer | Internal buffer. (Inherited from FIFO2T.)
Public field | NotEmpty | True if the internal buffer is not empty. (Inherited from FIFO2T.)
Public field | NotFull | True if the internal buffer is not full. (Inherited from FIFO2T.)
Protected field | ReadPtr | Read pointer. (Inherited from FIFO2T.)
Protected field | SeekPtr | Seek pointer.
Protected field | WritePtr | Write pointer. (Inherited from FIFO2T.)
Top
See Also

Reference

FIFO3T Class


FIFO3(T).SeekPtr Field

FIFO3TSeekPtr Field
Seek pointer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
protected int SeekPtr

Field Value

Type: Int32
See Also

Reference

FIFO3T Class


FIFO3(T) Methods

FIFO3T Methods

The FIFO3T generic type exposes the following members.

Methods
 | Name | Description
Protected method | AddPtr | Advance internal circular pointer. (Inherited from FIFO2T.)
Public method | Clear | Clear all items from internal buffer. (Overrides FIFO2TClear.)
Public method | Discard | Consume items already peeked.
Public method | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method | Finalize | Release both NotEmpty and NotFull prior to destroy. (Inherited from FIFO2T.)
Public method | Free | Number of free items in internal buffer. (Inherited from FIFO2T.)
Public method | Get | Get one item from internal buffer. (Overrides FIFO2TGet(T).)
Public method | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
Public method | GetType | Gets the Type of the current instance. (Inherited from Object.)
Protected method | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
Public method | Peek(T) | Get one item from internal buffer.
Public method | Peek(T, Int32) | Read items from internal buffer.
Public method | Put | Put item to internal buffer. (Overrides FIFO2TPut(T).)
Public method | Read(T, Int32) | Read items from internal buffer. (Inherited from FIFO2T.)
Public method | Read(T, Int32, Int32) | Read items from internal buffer. (Inherited from FIFO2T.)
Public method | Seek | Move the Peek pointer relative to Read pointer.
Protected method | SubPtr | Calculate difference between two protected circular pointers. (Inherited from FIFO2T.)
Public method | ToString | Returns a string that represents the current object. (Inherited from Object.)
Public method | Used | Number of used items in internal buffer. (Inherited from FIFO2T.)
Public method | Write(T, Int32) | Write items to internal buffer. (Inherited from FIFO2T.)
Public method | Write(T, Int32, Int32) | Write items to internal buffer. (Inherited from FIFO2T.)
Top
See Also

Reference

FIFO3T Class


FIFO3(T).Clear Method

FIFO3TClear Method
Clear all items from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public override void Clear()
See Also

Reference

FIFO3T Class


FIFO3(T).Discard Method

FIFO3TDiscard Method
Consume items already peeked.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Discard()

Return Value

Type: Int32
Number of items freed.
See Also

Reference

FIFO3T Class


FIFO3(T).Get Method

FIFO3TGet Method
Get one item from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public override bool Get(
    out T b
)

Parameters

b
Type: T
Item to return.

Return Value

Type: Boolean
True on success.
Remarks
The item is consumed. Seek pointer is reset.
See Also

Reference

FIFO3T Class


FIFO3(T).Peek Method

FIFO3TPeek Method
Overload List
 | Name | Description
Public method | Peek(T) | Get one item from internal buffer.
Public method | Peek(T, Int32) | Read items from internal buffer.
Top
See Also

Reference

FIFO3T Class


FIFO3(T).Peek Method (T)

FIFO3TPeek Method (T)
Get one item from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public bool Peek(
    out T b
)

Parameters

b
Type: T
Item to return.

Return Value

Type: Boolean
True on success.
Remarks
The item is not consumed.
See Also

Reference

FIFO3T Class
Peek Overload


FIFO3(T).Peek Method (T[], Int32)

FIFO3TPeek Method (T, Int32)
Read items from internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Peek(
    T[] b,
    int count
)

Parameters

b
Type: T
Array of items to return.
count
Type: SystemInt32
Max number of items requested.

Return Value

Type: Int32
Actual number of items returned.
Remarks
The items are not consumed.
See Also

Reference

FIFO3T Class
Peek Overload


FIFO3(T).Put Method

FIFO3TPut Method
Put item to internal buffer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public override bool Put(
    T b
)

Parameters

b
Type: T
Item.

Return Value

Type: Boolean
True on success.
See Also

Reference

FIFO3T Class


FIFO3(T).Seek Method

FIFO3TSeek Method
Move the Peek pointer relative to Read pointer.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public int Seek(
    int n
)

Parameters

n
Type: SystemInt32
Must be positive or zero.

Return Value

Type: Int32
New position.
Remarks
Seek(0) allows reading the already peeked items again.
See Also

Reference

FIFO3T Class


FIFO3(T) Properties

FIFO3T Properties

The FIFO3T generic type exposes the following members.

Properties
 | Name | Description
Public property | BufferSize | Size of internal buffer. (Inherited from FIFO2T.)
Top
See Also

Reference

FIFO3T Class


IOpenClose Interface

IOpenClose Interface
An simple stream

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public interface IOpenClose

The IOpenClose type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream
Public method | Open | Open stream
Top
Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open
Top
See Also

Reference

ComCommonLib Namespace


IOpenClose Methods

IOpenClose Methods

The IOpenClose type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream
Public method | Open | Open stream
Top
See Also

Reference

IOpenClose Interface


IOpenClose.Close Method

IOpenCloseClose Method
Close stream

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool Close()

Return Value

Type: Boolean
IsOpen
See Also

Reference

IOpenClose Interface


IOpenClose.Open Method

IOpenCloseOpen Method
Open stream

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool Open()

Return Value

Type: Boolean
IsOpen
See Also

Reference

IOpenClose Interface


IOpenClose Properties

IOpenClose Properties

The IOpenClose type exposes the following members.

Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open
Top
See Also

Reference

IOpenClose Interface


IOpenClose.IsOpen Property

IOpenCloseIsOpen Property
Return true if the underlying stream is open

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool IsOpen { get; }

Property Value

Type: Boolean
See Also

Reference

IOpenClose Interface


IRead Interface

IRead Interface
A readable stream.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public interface IRead : IRead<byte>,
    IOpenClose

The IRead type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Get | Read T (Inherited from IReadT.)
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Read | Read data (Inherited from IReadT.)
Public method | ReadPurge | Cancel pending read and purge read buffer (Inherited from IReadT.)
Public method | ReadQueue | Ts in read queue (Inherited from IReadT.)
Top
Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | ReadBuffered | True if read is buffered (Inherited from IReadT.)
Public property | ReadBufferSize | Buffer size (Inherited from IReadT.)
Public property | ReadTimeout | Read timeout (Inherited from IReadT.)
Top
See Also

Reference

ComCommonLib Namespace


IRead Methods

IRead Methods

The IRead type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Get | Read T (Inherited from IReadT.)
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Read | Read data (Inherited from IReadT.)
Public method | ReadPurge | Cancel pending read and purge read buffer (Inherited from IReadT.)
Public method | ReadQueue | Ts in read queue (Inherited from IReadT.)
Top
See Also

Reference

IRead Interface


IRead Properties

IRead Properties

The IRead type exposes the following members.

Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | ReadBuffered | True if read is buffered (Inherited from IReadT.)
Public property | ReadBufferSize | Buffer size (Inherited from IReadT.)
Public property | ReadTimeout | Read timeout (Inherited from IReadT.)
Top
See Also

Reference

IRead Interface


IRead(T) Interface

IReadT Interface
A readable stream.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public interface IRead<T> : IOpenClose

Type Parameters

T
Element type.

The IReadT type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Get | Read T
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Read | Read data
Public method | ReadPurge | Cancel pending read and purge read buffer
Public method | ReadQueue | Ts in read queue
Top
Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | ReadBuffered | True if read is buffered
Public property | ReadBufferSize | Buffer size
Public property | ReadTimeout | Read timeout
Top
See Also

Reference

ComCommonLib Namespace


IRead(T) Methods

IReadT Methods

The IReadT generic type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Get | Read T
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Read | Read data
Public method | ReadPurge | Cancel pending read and purge read buffer
Public method | ReadQueue | Ts in read queue
Top
See Also

Reference

IReadT Interface


IRead(T).Get Method

IReadTGet Method
Read T

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool Get(
    out T buffer
)

Parameters

buffer
Type: T
buffer to store the read T

Return Value

Type: Boolean
True on success
Remarks
Return if data has been read, timeout elapsed or port is closed
See Also

Reference

IReadT Interface


IRead(T).Read Method

IReadTRead Method
Read data

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int Read(
    T[] buffer,
    int count
)

Parameters

buffer
Type: T
buffer to store the read Ts
count
Type: SystemInt32
Number of Ts to read

Return Value

Type: Int32
Number of Ts actually read
Remarks
Return if all data has been read, timeout elapsed or port is closed
See Also

Reference

IReadT Interface


IRead(T).ReadPurge Method

IReadTReadPurge Method
Cancel pending read and purge read buffer

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
void ReadPurge()
See Also

Reference

IReadT Interface


IRead(T).ReadQueue Method

IReadTReadQueue Method
Ts in read queue

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int ReadQueue()

Return Value

Type: Int32
Number of bytes in read queue
See Also

Reference

IReadT Interface


IRead(T) Properties

IReadT Properties

The IReadT generic type exposes the following members.

Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | ReadBuffered | True if read is buffered
Public property | ReadBufferSize | Buffer size
Public property | ReadTimeout | Read timeout
Top
See Also

Reference

IReadT Interface


IRead(T).ReadBuffered Property

IReadTReadBuffered Property
True if read is buffered

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool ReadBuffered { get; }

Property Value

Type: Boolean
See Also

Reference

IReadT Interface


IRead(T).ReadBufferSize Property

IReadTReadBufferSize Property
Buffer size

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int ReadBufferSize { get; set; }

Property Value

Type: Int32
Remarks
If 0, read is not buffered
See Also

Reference

IReadT Interface


IRead(T).ReadTimeout Property

IReadTReadTimeout Property
Read timeout

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int ReadTimeout { get; set; }

Property Value

Type: Int32
See Also

Reference

IReadT Interface


IWrite Interface

IWrite Interface
A writable stream.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public interface IWrite : IWrite<byte>,
    IOpenClose

The IWrite type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Put | Write T (Inherited from IWriteT.)
Public method | Write | Write data (Inherited from IWriteT.)
Public method | WritePurge | Cancel pending write and purge write buffer (Inherited from IWriteT.)
Public method | WriteQueue | Ts in write queue (Inherited from IWriteT.)
Top
Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | WriteBuffered | True if write is buffered (Inherited from IWriteT.)
Public property | WriteBufferSize | Buffer size (Inherited from IWriteT.)
Public property | WriteTimeout | Write timeout (Inherited from IWriteT.)
Top
See Also

Reference

ComCommonLib Namespace


IWrite Methods

IWrite Methods

The IWrite type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Put | Write T (Inherited from IWriteT.)
Public method | Write | Write data (Inherited from IWriteT.)
Public method | WritePurge | Cancel pending write and purge write buffer (Inherited from IWriteT.)
Public method | WriteQueue | Ts in write queue (Inherited from IWriteT.)
Top
See Also

Reference

IWrite Interface


IWrite Properties

IWrite Properties

The IWrite type exposes the following members.

Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | WriteBuffered | True if write is buffered (Inherited from IWriteT.)
Public property | WriteBufferSize | Buffer size (Inherited from IWriteT.)
Public property | WriteTimeout | Write timeout (Inherited from IWriteT.)
Top
See Also

Reference

IWrite Interface


IWrite(T) Interface

IWriteT Interface
A writable stream.

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
public interface IWrite<T> : IOpenClose

Type Parameters

T
Element type.

The IWriteT type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Put | Write T
Public method | Write | Write data
Public method | WritePurge | Cancel pending write and purge write buffer
Public method | WriteQueue | Ts in write queue
Top
Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | WriteBuffered | True if write is buffered
Public property | WriteBufferSize | Buffer size
Public property | WriteTimeout | Write timeout
Top
See Also

Reference

ComCommonLib Namespace


IWrite(T) Methods

IWriteT Methods

The IWriteT generic type exposes the following members.

Methods
 | Name | Description
Public method | Close | Close stream (Inherited from IOpenClose.)
Public method | Open | Open stream (Inherited from IOpenClose.)
Public method | Put | Write T
Public method | Write | Write data
Public method | WritePurge | Cancel pending write and purge write buffer
Public method | WriteQueue | Ts in write queue
Top
See Also

Reference

IWriteT Interface


IWrite(T).Put Method

IWriteTPut Method
Write T

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool Put(
    ref T buffer
)

Parameters

buffer
Type: T
T to write

Return Value

Type: Boolean
True on success
Remarks
Return if all data has been written, timeout elapsed or port is closed
See Also

Reference

IWriteT Interface


IWrite(T).Write Method

IWriteTWrite Method
Write data

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int Write(
    T[] buffer,
    int count
)

Parameters

buffer
Type: T
Ts to write
count
Type: SystemInt32
Length of buffer

Return Value

Type: Int32
Number of Ts written
Remarks
Return if all data has been written, timeout elapsed or port is closed
See Also

Reference

IWriteT Interface


IWrite(T).WritePurge Method

IWriteTWritePurge Method
Cancel pending write and purge write buffer

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
void WritePurge()
See Also

Reference

IWriteT Interface


IWrite(T).WriteQueue Method

IWriteTWriteQueue Method
Ts in write queue

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int WriteQueue()

Return Value

Type: Int32
Number of Ts in write queue
See Also

Reference

IWriteT Interface


IWrite(T) Properties

IWriteT Properties

The IWriteT generic type exposes the following members.

Properties
 | Name | Description
Public property | IsOpen | Return true if the underlying stream is open (Inherited from IOpenClose.)
Public property | WriteBuffered | True if write is buffered
Public property | WriteBufferSize | Buffer size
Public property | WriteTimeout | Write timeout
Top
See Also

Reference

IWriteT Interface


IWrite(T).WriteBuffered Property

IWriteTWriteBuffered Property
True if write is buffered

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
bool WriteBuffered { get; }

Property Value

Type: Boolean
See Also

Reference

IWriteT Interface


IWrite(T).WriteBufferSize Property

IWriteTWriteBufferSize Property
Buffer size

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int WriteBufferSize { get; set; }

Property Value

Type: Int32
Remarks
If 0, write is not buffered
See Also

Reference

IWriteT Interface


IWrite(T).WriteTimeout Property

IWriteTWriteTimeout Property
Write timeout

Namespace: ComCommonLib
Assembly: ComCommonLib (in ComCommonLib.dll) Version: 1.2.5370.16731
Syntax
C#
Copy
int WriteTimeout { get; set; }

Property Value

Type: Int32
See Also

Reference

IWriteT Interface