Metratec devices library 3.1.1.0
|
The Ethernet version of the interface used for communication. More...
Public Member Functions | |
EthernetInterface (string address, int port) | |
The constructor. | |
override string | ToString () |
Returns a string that represents the current object. | |
void | Connect () |
The method to connect the communication interface. | |
void | Disconnect () |
The method to close the communication interface. | |
void | Send (byte[] data, int offset, int count) |
Method to write a byte-array to the device (e.g. a binary file) | |
void | SendCommand (string outputBuffer) |
The method used to send data to the reader. | |
byte[] | Read (int count) |
Method to read a stream of bytes from device. | |
string | Read (string endLineString) |
The method used to synchronously read data from the reader. | |
string | ReadResponse () |
The method used to read a complete answer from the reader, check it for error messages and crc mismatch. | |
![]() | |
void | Connect () |
The method to connect the communication interface. | |
void | Disconnect () |
The method to close the communication interface. | |
void | Send (byte[] data, int offset, int count) |
Method to write a byte-array to the device (e.g. a binary file) | |
void | Send (byte[] data) |
Method to write a byte-array to the device (e.g. a binary file) | |
void | Send (string data) |
Method to write a string to the device. | |
void | SendCommand (string command) |
The method used to send a command to the reader. | |
byte[] | Read (int count) |
Method to read a stream of bytes from device. | |
string | ReadResponse () |
The method used to synchronously read a reader response. | |
Properties | |
int | BaudRate [get, set] |
The communication baud rate. | |
int | ReceiveTimeout [get, set] |
The communication receive timeout. | |
string | NewlineString [get, set] |
The communication new line string. | |
bool | DataAvailable [get] |
Indicates whether data is available for reading. | |
bool | IsConnected [get] |
Returns if the connection is established. | |
![]() | |
int | ReceiveTimeout [get, set] |
The communication receive timeout. | |
int | BaudRate [get, set] |
The communication baud rate. | |
string | NewlineString [get, set] |
The communication new line string. | |
bool | DataAvailable [get] |
Indicates whether data is available for reading. | |
bool | IsConnected [get] |
Connection flag. | |
The Ethernet version of the interface used for communication.
CommunicationInterfaces.EthernetInterface.EthernetInterface | ( | string | address, |
int | port | ||
) |
The constructor.
address | The IP address of the reader |
port | The TCP port the reader is communicating on (default is 10,001) |
T:System.ArgumentNullException | Thrown when the specified address is null . |
T:System.ArgumentException | Thrown when the specified address cannot be parsed into an IP address. |
T:System.ArgumentOutOfRangeException | Thrown when the specified port is outside of the range of valid TCP ports (1-65535). |
T:System.InvalidOperationException | Thrown when the socket could not be connected to the IPEndpoint (socket closed or insufficient permissions). |
void CommunicationInterfaces.EthernetInterface.Connect | ( | ) |
The method to connect the communication interface.
T:System.InvalidOperationException | Thrown when the serial port could not be set up (e.g. wrong parameters, insufficient permissions, invalid port state). |
Implements CommunicationInterfaces.ICommunicationInterface.
void CommunicationInterfaces.EthernetInterface.Disconnect | ( | ) |
The method to close the communication interface.
Implements CommunicationInterfaces.ICommunicationInterface.
byte[] CommunicationInterfaces.EthernetInterface.Read | ( | int | count | ) |
Method to read a stream of bytes from device.
count | Number of bytes to read |
Implements CommunicationInterfaces.ICommunicationInterface.
string CommunicationInterfaces.EthernetInterface.Read | ( | string | endLineString | ) |
The method used to synchronously read data from the reader.
T:System.TimeoutException | Thrown when no answer is received for more than 400ms. |
T:System.ObjectDisposedException | Thrown when the underlying function reports a broken stream |
string CommunicationInterfaces.EthernetInterface.ReadResponse | ( | ) |
The method used to read a complete answer from the reader, check it for error messages and crc mismatch.
T:System.TimeoutException | Thrown when no answer is received for more than 400ms. |
T:System.ObjectDisposedException | Thrown when the underlying function reports a broken stream |
T:System.InvalidOperationException | Thrown when the answer from the reader contained errors |
Implements CommunicationInterfaces.ICommunicationInterface.
void CommunicationInterfaces.EthernetInterface.Send | ( | byte[] | data, |
int | offset, | ||
int | count | ||
) |
Method to write a byte-array to the device (e.g. a binary file)
data | The overall byte-array of data |
offset | The starting address in the array |
count | The number of characters to write |
Implements CommunicationInterfaces.ICommunicationInterface.
void CommunicationInterfaces.EthernetInterface.SendCommand | ( | string | outputBuffer | ) |
The method used to send data to the reader.
outputBuffer | The data / command sent to the reader |
T:System.ArgumentNullException | Thrown when the specified outputBuffer is null . |
T:System.InvalidOperationException | Thrown when an exception occurs when trying to access the port (e.g. port closed, timeout). |
T:System.ObjectDisposedException | Thrown when the underlying function reports a broken stream |
Implements CommunicationInterfaces.ICommunicationInterface.
override string CommunicationInterfaces.EthernetInterface.ToString | ( | ) |
Returns a string that represents the current object.
|
getset |
The communication baud rate.
T:System.InvalidOperationException | Thrown in case baud rate setting did not work |
Implements CommunicationInterfaces.ICommunicationInterface.
|
get |
Indicates whether data is available for reading.
T:System.ObjectDisposedException | Thrown when the underlying function reports a broken stream |
Implements CommunicationInterfaces.ICommunicationInterface.
|
get |
Returns if the connection is established.
Implements CommunicationInterfaces.ICommunicationInterface.
|
getset |
The communication new line string.
Implements CommunicationInterfaces.ICommunicationInterface.
|
getset |
The communication receive timeout.
T:System.InvalidOperationException | Thrown in case baud rate setting did not work |
Implements CommunicationInterfaces.ICommunicationInterface.