Interface ICommunication
Interface for a communication ILisrtModule.
Inherited Members
Namespace: Loehnert.Lisrt.Communication
Assembly: Loehnert.Lisrt.Communication.dll
Syntax
public interface ICommunication : ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged
Properties
Encoding
Gets or sets the encoding for the communication.
Declaration
Encoding Encoding { get; set; }
Property Value
Type | Description |
---|---|
System.Text.Encoding |
Remarks
Default is null.
EndDelimiter
Gets or sets the end delimiter of a transmission.
Declaration
byte[] EndDelimiter { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Remarks
This is add for sending and removed while reading internally. Use the System.Text.Encoding.GetBytes(System.String) to convert.
IsConnected
Gets a value indicating whether the module is connected.
Declaration
bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
StartDelimiter
Gets or sets the ending of a transmission.
Declaration
byte[] StartDelimiter { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Remarks
This is add for sending and removed while reading internally. Use the System.Text.Encoding.GetBytes(System.String) to convert.
Timeout
Gets or sets the timeout for reading and sending in milliseconds.
Declaration
int Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Close()
Close the session.
Declaration
void Close()
Open()
Opens the session.
Declaration
void Open()
Query(Byte[], String)
Clears the received buffer, sends data and returns received data as bytes.
Declaration
byte[] Query(byte[] data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data bytes to send. |
String | logComment | A comment for the communication log. |
Returns
Type | Description |
---|---|
System.Byte[] | The result data bytes. |
QueryString(String, String)
Clears the received buffer, sends data and returns received data.
Declaration
string QueryString(string data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
String | data | The data to send. |
String | logComment | A comment for the communication log. |
Returns
Type | Description |
---|---|
String | The result data. |
Receive()
Receives the data bytes.
Declaration
byte[] Receive()
Returns
Type | Description |
---|---|
System.Byte[] | The received data bytes if buffer is not empty. |
ReceiveString()
Receives the data.
Declaration
string ReceiveString()
Returns
Type | Description |
---|---|
String | The read data. |
Send(Byte[], String)
Sends the raw data.
Declaration
void Send(byte[] data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The raw data bytes to send. |
String | logComment | A comment for the communication log. |
SendString(String, String)
Sends the data.
Declaration
void SendString(string data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
String | data | The data to send. |
String | logComment | A comment for the communication log. |
Events
DataReceived
Occurs when data have been received.
Declaration
event EventHandler<DataReceivedEventArgs> DataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<DataReceivedEventArgs> |