Remote Control Socket Protocol
Remote Control Socket Protocol
Table of Contents
CoolTerm Remote Control Socket Protocol ....................................................................... 1
Table of Contents ................................................................................................................ 1
List of Figures ..................................................................................................................... 2
List of Tables ...................................................................................................................... 2
1. Introduction ................................................................................................................. 3
2. CoolTerm Remote Control Socket Protocol ............................................................... 3
2.1. Overview ............................................................................................................. 3
2.2. Server .................................................................................................................. 3
2.3. Client ................................................................................................................... 4
2.4. Remote Packet .................................................................................................... 4
2.4.1. Remote Packet Format ................................................................................ 4
2.4.2. Examples ..................................................................................................... 5
2.4.3. Remote Packet OP Codes ........................................................................... 6
2.4.4. Remote Packet ACK Codes ...................................................................... 10
List of Figures
Figure 1: Remote Packet Format. ....................................................................................... 4
List of Tables
Table 1: Remote Packet OP Codes. .................................................................................. 10
Table 2: Remote Packet ACK Codes. ............................................................................... 10
2.2. Server
The CoolTerm application has an embedded Remote Control Socket that is configured as
server. The socket is normally disabled, but it can be enabled via the CoolTerm GUI. If
enabled, the socket listens on a specified port for incoming connections. Once connected,
the server waits for incoming packets. The server always responds to packets from the
client to acknowledge them and to return data asked for by the client. The server does not
send any unsolicited data.
The specifications for the Remote Control Socket configured as server are as follows:
2.3. Client
The client is an application that connects to the server on a specified port, using an
embedded Remote Control Socket configured as client. Once a connection with the
server is established, it is the responsibility of the client to drive the communication. The
server will not send any data without a request from the client. The server will
acknowledge any Remote Packet sent by the client with a response. If data is requested
by the client, the server will attach the requested data to the response. The client always
expects a response from the server for any sent packet. If no response is received within a
specified timeout, it is the responsibility of the client application to either retry the
communication or alert the user.
• 1F: This preamble is present at the beginning of all Remote Packets. This
allows the Remote Control Socket to recognize the beginning of a new packet.
As the name suggests, the value is 0x1F.
• LEN: This is the length field of the packet. Its value is the length of the
DATA field. LEN is UInt16, and the byte-order is little endian.
• PID: This is the Packet ID. It is the client’s responsibility to pick a new
Packet ID for every new packet. The server will respond to received packets
by using the received packet ID in its response. This allows the client to
associated sent packets with corresponding response (ACK) packets from the
server.
• OP/ACK: This field is used for the OP (Operator) code for packets sent from
the client to the server, and for the ACK (Acknowledge) code for packets sent
from the server to the client.
• ID: This is the terminal ID to which the packet is to be directed. Each
CoolTerm terminal window has its own, unique, terminal ID. This allows OP
packets to be addressed to specific terminal windows. While not all OP codes
are address to specific terminal windows, the ID byte needs to be present in
the packet regardless (the actual value will be ignored by the server).
Responses from the server will always be addressed to 0xFF
Packets sent from the Client to the Server always contain an OP Code. The DATA field
is only populated if required by the OP Code.
Packets sent from the Server to the Client always contain an ACK Code. Data requested
by the Client will be sent via the DATA field.
2.4.2. Examples
The following examples illustrate possible communications between Client and Server.
Refer to 2.4.3 and 2.4.4 for details on OP and ACK codes, respectively.
Example 1: The following example, the Client sends an OP_PING command to the
server, and the server responds with and ACK_SUCCESS code. The packet bytes are
shown in hexadecimal format:
Example 2: In this example, the client requests the name of the window with index 3
from CoolTerm:
• ID: 0xFF
• DATA: “CoolTerm_0”)
System Commands
Description OP Data Return Data
OP_PING 0 - -
Instructs CoolTerm to save the settings of the FilePath can be either “True”: Success
terminal window specified by WindowName at absolute or relative to the “False”: No Success
the path specified by FilePath location of the CoolTerm
executable.
OP_GET_WINDOW_COUNT 23 - WindowCount as String
Quits CoolTerm.
OP_VERSION 30 - CoolTermVersion as String
“True”: On
“False: Off
Serial Port Commands
Description OP Data Return Data
OP_CONNECT 40 - Success as String
and OP_BYTES_AVAILABLE.
OP_READ 55 NumBytes as String Data as String
Sends the text file with the specified FilePath.. FilePath can be either “True”: Success
absolute or relative to the “False”: No Success
location of the CoolTerm
executable.
OP_CAPTURE_START 91 FilePath as String Success as String
Starts capture of data to the text file at the FilePath can be either “True”: Success
specified FilePath absolute or relative to the “False”: No Success
location of the CoolTerm
executable.
OP_CAPTURE_PAUSE 92 - -
Selects the serial port with the specified index. [0..SerialPortCount-1] “True”: Success
This can only be done while the port is closed. “False”: No Success
Returns True on success.
OP_GET_PARAMETER 110 ParameterName as String Value as String
It is the responsibility of the Server (i.e. CoolTerm) to execute the proper operations upon
receipt of one of these OP packets. It is also the Server’s responsibility to verify the
validity of received packets and respond to the client accordingly using ACK Codes.
Description ACK
ACK_SUCCESS 255
ACK_BAD_OPCODE 254
ACK_BAD_ARGUMENT 253
ACK_TIMEOUT 252
ACK_OFFLINE 251
Table 2: Remote Packet ACK Codes.
Upon receipt of an ACK code that indicates an error, it is the responsibility of the Client
software to either retry the communication or to alert the user.