rosstalk Object

In ogScript, use the rosstalk object to communicate over the network to other devices that speak RossTalk protocol. Functions in the rosstalk object are typically set through a user interface.

To call a general-purpose function, use:

rosstalk.functionname (parameters);

For example:

rosstalk.setHost (Server01);

The following table lists the functions of the rosstalk object.

Function

Parameters

Returns

Description

setHost

String [Host]

N/A

Set a default host to use for RossTalk commands where no host has been defined.

getHost

N/A

String

Get the default host previously defined.

setPort

Integer [Port]

N/A

Set a default port to use for RossTalk commands where no host has been defined.

getPort

N/A

Integer

Get the default port previously defined.

sendAsBytes

String [Host], Int [Port],

String [Bytes as Hex String]

N/A

Equivalent of calling: sendAsBytes(host, port, bytes, null);

sendAsBytes

String [Host], Int [Port],

String [Bytes as Hex String], Function [Callback]

N/A

Convert bytes from string (where string is formatted as ASCII representations of bytes e.g. "FDDFEAAE12F9…") and send them to the provided host at the provided port. Invoke the callback function when done.

sendAsBytesWithResponse

String [Host], Int [Port],

String [Bytes as Hex String], String [responseBytes], Function [Callback]

Response message provided by the recipient.

Convert bytes from string (where string is formatted as ASCII representations of bytes e.g. "FDDFEAAE12F9…") and send them to the provided host at the provided port. Invoke the callback function when done.

The [responseBytes] string, when received from the recipient, indicates the end of the response message.

sendBytes

String [Host], Int [Port],

Byte[] [Data to Send], Function [Callback]

N/A

Send the provided bytes to the provided host at the provided port. Invoke the callback function when done.

sendBytesWithResponse

String [Host], Int [Port],

Byte[] [Data to Send], Byte [responseTerminator] Function [Callback]

Response message provided by the recipient.

Send the provided bytes to the provided host at the provided port. Invoke the callback function when done.

The [responseTerminator] byte, when received from the recipient, indicates the end of the response message.

sendMessage

String [RossTalk Command]

N/A

Equivalent of calling:

sendMessage (getHost(), getPort(), RossTalk Command, null);

sendMessage

String [RossTalk Command], Function [Callback]

N/A

Equivalent of calling:

sendMessage (getHost(), getPort(), RossTalk Command, Callback);

sendMessage

String [Host], Int [Port],

String [RossTalk Command]

N/A

Equivalent of calling:

sendMessage (Host, Port, RossTalk Command, null);

sendMessage

String [Host], Int [Port],

String [RossTalk Command] Function [Callback]

N/A

Send the provided string as UTF-8 followed by CRLF bytes to the provided host at the provided port. Invoke the callback function when done.

sendMessageWithResponse

String [Host], Int [Port],

String [RossTalk Command], String [responseTerminator], Function [Callback]

Response message provided by the recipient.

Send the provided string as UTF-8 followed by CRLF bytes to the provided host at the provided port. Invoke the callback function when done.

The [responseTerminator] string, when received from the recipient, indicates the end of the response message.