Communicator#
This is the generic communicator class for communication with any device.
constructor Communicator()#
This is the generic communicator class for communication with any device.
property communicator_type#
Queries the type of the communicator.
Returns#
| Type | Description |
|---|---|
| CommunicatorType | The type of the communicator. |
property configuration#
Queries the configuration of the communicator.
Returns#
| Type | Description |
|---|---|
| CommunicatorConfiguration | The configuration of the communicator. |
property enable_send_receive_log#
If this flag is set, communication is written to the log file.
Returns#
| Type | Description |
|---|---|
| bool | True if send and receive is enabled otherwise False . |
property is_initialized#
If the device is initialized.
Returns#
| Type | Description |
|---|---|
| bool | True if device is initialized otherwise False . |
property last_line_sent#
The last line sent (useful for error handling).
Returns#
| Type | Description |
|---|---|
| str | The last line sent. |
property termination_character#
The terminator character is used in SendLine() when set.
Returns#
| Type | Description |
|---|---|
| str | The termination character. |
property timeout_ms#
Returns or sets the timeout for communication in milliseconds.
Returns#
| Type | Description |
|---|---|
| int | The timeout in ms. |
method discard()#
Discards all data in the input buffer.
method initialize()#
Initializes the communicator so that communication with a remote station is possible.
method query(str: str)#
Writes a string followed by the termination character, reads a line of characters, and returns it as a string.
Parameters#
| Name | Description |
|---|---|
| str | The string to be sent. |
Returns#
| Type | Description |
|---|---|
| str | The character string read by the interface. |
method receive_binary(numBytes: int)#
Receives a binary array of bytes.
Parameters#
| Name | Description |
|---|---|
| numBytes | The number of bytes to be read. |
Returns#
| Type | Description |
|---|---|
| byte | The binary data read by the interface. |
method receive_line()#
Receives a character string until the termination character is received.
Returns#
| Type | Description |
|---|---|
| str | The character string read by the interface. |
method receive_response()#
Receives the response.
Returns#
| Type | Description |
|---|---|
| str | The character string read by the interface. |
method send(str: str)#
Sends a character string without a termination character.
Parameters#
| Name | Description |
|---|---|
| str | The string to be sent |
method send_line(str: str)#
Sends a character string followed by the termination character.
Parameters#
| Name | Description |
|---|---|
| str | The string to be sent |
method terminate()#
Terminates the communicator and prevents further communication with the remote station.