User:Drew7766/Sandbox

Overview
This protocol is built on top of the TCP/IP protocol. The client will usually be System Test. The server is an application that runs on the target system. The purpose of the protocol is to present a standard interface to the client, which the client can use to control the devices on the server.

The protocol will not allow the client to control every device in any manner possible. Instead, the protocol will only allow the client to access the basic functionality needed for testing.

All data must be in big endian format. The client sends commands to the server, and the server always sends back a response. It is up to the client to decide how long to wait for a response from the server.

All strings shall be preceded by a 32-bit number that specifies the length of the string, and all strings shall be padded with zeroes to make them 32-bit aligned.

Packet Header
All packets (commands and responses) will begin with the following fields:

For commands, the packet header should also include the following fields:

For responses, the packet header should also include the following field:

Function Type
The function type must be a value from the following table:

Channel Headers
All channel headers (commands and responses) will include the following fields:

Channel Data
The channel offset will be used to find the corresponding channel data structure. Using the channel offset prevents a missing word in one channel data structure from completely throwing off the parsing of the remaining channel data structures.

At the beginning of each channel data structure, response packets will include the following field:

The rest of the channel data structure is specific to the function type.

SERVER_GET_PROTOCOL_VERSION
When a client issues this command, the server will report the protocol version that it is using. This document describes version 1.0.

The response packet will contain the following fields:

SERVER_GET_APP_INFO
When a client issues this command, the server will report information about the server application.

The response packet will contain the following fields:

SERVER_OPEN_DEVICE
This function tells the server to open a device, if it has not already been opened.

The command will include the following fields:

The response packet will contain the following fields:

DEVICE_SET_CONFIG
Sets the configuration of a channel on a device. A config type must be specified in the command packet:

Config Types
The config type must be a value from the following table:

CONFIG_DISCRETE
Configures a discrete device. The command packet must specify the following fields:

CONFIG_SERIAL
Configures a serial device. The command packet must specify the following fields:

CONFIG_M1553
Configures a M1553 device. The command packet must specify the following fields:

The setup type must be a value from the following table:

CONFIG_VIDEO
Configures a video device. The command packet must specify the following fields:

DEVICE_CLOSE
This function closes a device and all of its channels.

ANALOG_SET_VOLTAGE
Sets the voltage of an analog output device.

The command packet will contain the following fields:

ANALOG_GET_VOLTAGE
Returns the voltage of an analog input.

The response packet will contain the following fields:

ANALOG_GET_CURRENT
Returns the current of an analog device.

The response packet will contain the following fields:

DISCRETE_SET_STATE
Sets the stage of a discrete output.

The command packet will contain the following fields:

DISCRETE_GET_STATE
Returns the state of a discrete input.

The response packet will contain the following fields:

MSGDEV_SEND_MSG
Tells the server to transmit a message on a message device. How this works depends on the message device and how it is configured. For example, a serial device will simply transmit a string of bytes. An M1553 device, if it configured in the BCRT setup, will execute the BCRT chain, with this message as the link data.

The command packet will contain the following fields:

MSGDEV_RECV_MSG
Receives a message on a message device.

The response packet will contain the following fields: