Table of Contents

Interface ICommunication

Namespace
Loehnert.Lisrt.Communication
Assembly
Loehnert.Lisrt.Communication.dll

Interface for a communication ILisrtModule.

public interface ICommunication : ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged
Inherited Members
INotifyPropertyChangedEx.Refresh()
INotifyPropertyChangedEx.IsNotifying

Properties

Encoding

Gets or sets the encoding for the communication.

Encoding Encoding { get; set; }

Property Value

Encoding

Remarks

Default is null.

EndDelimiter

Gets or sets the end delimiter of a transmission.

byte[] EndDelimiter { get; set; }

Property Value

byte[]

Remarks

This is add for sending and removed while reading internally. Use the GetBytes(string) to convert.

IsConnected

Gets a value indicating whether the module is connected.

bool IsConnected { get; }

Property Value

bool

StartDelimiter

Gets or sets the ending of a transmission.

byte[] StartDelimiter { get; set; }

Property Value

byte[]

Remarks

This is add for sending and removed while reading internally. Use the GetBytes(string) to convert.

Timeout

Gets or sets the timeout for reading and sending in milliseconds.

int Timeout { get; set; }

Property Value

int

Methods

Close()

Close the session.

void Close()

Open()

Opens the session.

void Open()

Query(byte[], string)

Clears the received buffer, sends data and returns received data as bytes.

byte[] Query(byte[] data, string logComment = "")

Parameters

data byte[]

The data bytes to send.

logComment string

A comment for the communication log.

Returns

byte[]

The result data bytes.

QueryString(string, string)

Clears the received buffer, sends data and returns received data.

string QueryString(string data, string logComment = "")

Parameters

data string

The data to send.

logComment string

A comment for the communication log.

Returns

string

The result data.

Receive()

Receives the data bytes.

byte[] Receive()

Returns

byte[]

The received data bytes if buffer is not empty.

ReceiveString()

Receives the data.

string ReceiveString()

Returns

string

The read data.

Send(byte[], string)

Sends the raw data.

void Send(byte[] data, string logComment = "")

Parameters

data byte[]

The raw data bytes to send.

logComment string

A comment for the communication log.

SendString(string, string)

Sends the data.

void SendString(string data, string logComment = "")

Parameters

data string

The data to send.

logComment string

A comment for the communication log.

Events

DataReceived

Occurs when data have been received.

event EventHandler<DataReceivedEventArgs> DataReceived

Event Type

EventHandler<DataReceivedEventArgs>