will be dened in a separate document that is specic to the device you are wanting to control.
Protocol Denition
The protocol is command/response from client to server and from server to client. A client can send
one command to the server, then it must wait for a response from the server before sending another
command. In the meantime, the server can send one command to the client, but must wait for a
response from the client before sending another command. In a way, this is peer-to-peer, but the
dierence is, the client is simply the endpoint that initiated the TCP connection.
Syntax
The general syntax of a DCP-555 API message is:
<command/reply> <JSON> [\r]\n
Spaces are used as delimiters between the items in a message, and the message is terminated by an
optional carriage return (\r) followed by a mandatory newline (\n).
Leading and trailing spaces on all arguments and commands are stripped and not preserved. Embedded
spaces are preserved, so keys and names and so on can have embedded spaces.
The JSON portion contains all the arguments for the command. The JSON portion must be a JSON
Object {}.
The DCP-555 API is case sensitive. All commands and keywords are lower case.
Case-insensitivity only applies to ascii, since UTF-8 may contain encodings that are not to-lower’able.
DCP-555 Control API Guide
3
Path Syntax
A crucial concept in the DCP-555 API is that of a path name. The path name is the name given to an
element. The path name includes the path and the name of the element. A forward slash “/” is used to
distinguish hierarchy in the path name. Paths can be surrounded by double quotes if required due to
white space in the path. An example of a path name is:
“/Audio/P1/Channel 1/Gain”
The forward slash at the start indicates that the path is absolute. There is no need to include the device
name in the path.
Command / Reply
Each command has a specic reply. The reply prepends @ to the original command to form the reply.
This prepending makes it easy for a parser to quickly distinguish a reply command.
command
@command
Arguments
Arguments are specied by JSON. It is possible for a command to have no arguments. If a command/
reply only ever has one argument, it may be a more simple JSON string (always quoted) or JSON
number (never quoted).
Creating the Connection
DCP-555 devices listen on port 4197 and can support multiple connections. To connect to a DCP-555
device, you must open a TCP socket to the IP address of the device. Once the connection is open, the
device will not close the connection until either the client (your program) closes the connection or
issues a goodbye command.
Working with Parameters
A DCP-555 device is made up of objects and parameters. All parameters have a parent object and some
objects may also have other objects as children. Each object and parameter is named and you can think
of the structure like s le system where objects are like folders and parameters are like les. You can
access a parameter or object using its full path name. An example of a path name could be:
“/Audio/Output Level/Gain”
In this example, Audio and Output Level are both objects, and Gain is the parameter.
Understanding Control Laws
All Parameters in the model have an underlying ‘control law’. This allows the parameter to convert between
various representations of the parameter value. The main representations (also called formats) are:
• Normalized(Norm):astringrepresentationofthevalueasaoatingpointnumberbetween0.0and 1.0,
where 0.0 indicates the parameter is at its minimum value and 1.0 indicates the parameter is at its
maximum value. Note that the value is not always mapped linearly to the range of the parameter.
For example, frequency parameters typically use a logarithmic mapping.
DCP-555 Control API Guide
4
The mapping from normalized to value is part of the control law and the DCP-555 API is designed in
such a way that the GUI designer can mostly simply control the parameter using values from 0.0 to 1.0
without having to understand what is going on inside the model.
When controlling a parameter using a slider you would generally simply map the value of the slider to a
range from 0.0 to 1.0. Then you can control the parameter using the normalized format of the value. To
use the normalized value you must specify “format”:”Norm” in the set, get, or subscribe messages:
set {“path”:”/Cong/Channel4PEQ/Band_1_Frequency”, “value”:”0.5”, “format”:”Norm”}
As can be seen, the model has responded with a very slightly dierent value to the one requested
(0.49993 instead of 0.5). Since the normalized value may not map precisely to an exact value in Hz it
is rounded by the model and then the actual normalized value returned. In the case of this frequency
parameter the dierence is small but for other parameters it may be much more signicant.
For example, the lter type parameter is in integer from 0 to 2 and represents the following values:
• 0: Bell
• 1: LowShelf
• 2: HighShelf
Although you would typically use a list box for this type of parameter it could be controlled by a slider
too. In this case setting a normalized value will return a rounded value:
set {“path”:”/Cong/Channel4PEQ/Band_1_Type”, “value”:”0.2”, “format”:”Norm”} @set
{“format”:”Norm”,”path”:”/Cong/Channel4PEQ/Band_1_Type”,”value”:”0”}
set {“path”:”/Cong/Channel4PEQ/Band_1_Type”, “value”:”0.4”, “format”:”Norm”} @set
{“format”:”Norm”,”path”:”/Cong/Channel4PEQ/Band_1_Type”,”value”:”0.5”}
This is because the parameter can only have 3 values and these correspond to the following normalized
values:
• 0.0: Bell
• 0.5: LowShelf
• 1.0: HighShelf
Default Format
The ‘Default’ format for a parameter varies depending on the type of the parameter. However, the
‘Default’ format is intended to be a ‘nice’ human readable string. For the frequency parameter we’ve
used above this means rounding to either Hz or kHz depending on the value and adding the correct
units after the number.
For other parameters this may mean returning a string from an enum. For example, the lter type
actually has internal values of 0, 1, and 2 but these are represented by strings “Bell”, “Low Shelf”
and High Shelf”. Therefore, the ‘Default’ format would be one of the 3 enum strings. Interestingly, the
‘Number’ format would return 0, 1, or 2, and the ‘Normalized’ format would be 0.0, 0.5, or 1.0.
DCP-555 Control API Guide
5
Parameter Formats and Control Types
The dierent control types will be used by dierent types of control in your application. Examples are:
• Slider: Generally uses normalized value from 0.0 to1.0.
• Text display or edit box: Uses the default format (text).
• List box: Uses the default format (text).
• Button: Usesnormalizedvalue0.0and1.0.
DCP-555 Control API Guide
6
Commands
Set Value
Sets one or more parameter values using paths to each element being set. The path points to a
parameter. Setting attributes from the client is not supported.
<value> is a JSON Value, so it can be true, false, null, JSON String, or JSON Number.
Set one parameter with no format string
set { “path” : “<parameter path>”, “value” : <value> }
Set multiple parameters within same object (optimized)
Setting multiple parameters in the same object is an optimized version of ‘set multiple parameters’. It
does not support format strings and is set using the data type of the parameter.
In the case of multiple parameters, the <path> points to the parent object instead of all the way to the
parameter name. Then the parameter names appear inside the “value” object as keyword tags.
Errors can be returned for just the parameters that failed, and values for the parameters that worked.
The <error message> is a JSON String.
DCP-555 Control API Guide
9
Get Value
Get is exactly like Set, except the Get Command won’t have values, but the Get Reply will. Therefore, the
Get Reply will look exactly like the Set Reply.
Get multiple parameters for an object; get an attribute
If the path points to an object name instead of a parameter, then all the parameters that live directly
under that object will be returned in the Get Reply. The “format” string is not used in an “object get.”
The parameters will come back in their default formats. In the following example, an object is queried,
and an attribute is also queried.
As well as using the set messages to control the parameter, you will also want to subscribe to listen for
changes that come from other sources (i.e. from other controllers or internally from the device itself).
All subscription messages response with an @subscription that contain the current values. Once
subscribed, parameter changes will be sent to the client using ‘publish’ messages.
NOTE: Publish, @set, @get and @subscribe messages all use the same JSON format and for the
purposes of the GUI can be treated in a very similar fashion. The main dierence is that publish
messages MUST be acknowledged with an @publish response from the GUI before another publish will
be sent. Failure to respond to a publish message will mean that publish messages would stop.
To read more about the JSON format for publish, @set, @get and @subscribe messages, see
“Understanding the Parameter Value Format” on page 15.
Subscribe to a Parameter Directly
Subscribe to a parameter directly with dierent formats:
If you are subscribed to the same parameter using multiple formats then each parameter change will
result in a single publish message containing all subscribed formats. For example, if you subscribe to
the frequency parameter like so:
It is even possible to subscribe to all parameters in all objects under Cong. Since the subscribe
is recursive this means that ALL parameters in all child objects are subscribed to. Note that when
subscribing to all parameters under Cong you will get a very large @subscribe message back since it
contains values for ALL parameters in all objects.
subscribe {“path”:”/Cong”, “format”:”Norm”}
Or
subscribe {“path”:”/Cong”, “format”:”Default”}
The responses to these messages are far too large to show here.
DCP-555 Control API Guide
15
Understanding the Parameter Value Format
It is important to understand the JSON format used to return parameter values in publish, @set, @get
and @subscribe messages. There are various ways in which the DCP-555 server may decide to format
the JSON.
Individual values can be formatted in a JSON object like so:
In the above format, the path points to the owning object and then the value contains pairs of
parameter:value.
When decoding this you should look at the value type and, if it is a JSON object, then you know every
key/value pair inside is a parameter/value pair. In this case you must concatenate the path and the
parameter name to get the full path to the parameter.
There may be more than one parameter inside the value object:
Although get messages and their @get responses can be quite long, they have the advantage of using
the same JSON format as the @set, @subscribe, and publish messages. Therefore, a single piece of
code can decode all those messages. Another advantage is that dierent formats can be requested in
the same message. For example:
get [{“path”:”/Cong/PeakMeters/In1InputLevel”, “format”:”Number”}, {“path”:”/Cong/PeakMeters/
Subscribepoll allows the GUI to specify a list of meter parameters that will be read together. This
list is given a name and then polled collectively using the ‘poll’ message. The advantage with the
subscribepoll is that it avoids having to specify the paths of all the parameters you wish to read in every
meter read.
For example, a subscribepoll is initially set up like so:
The advantage of the subscribepoll messages are the small size and simplicity of the poll and @poll
response. This could make parsing much faster on small devices. However, they do require the GUI to
maintain information about the collections of parameters that it has subscribed to so that it can decode
the responses.