# DataMan Control Commands Overview

DataMan Control Commands (DMCC) are a method of configuring and controlling a DataMan reader from a COM port, either directly or programatically through a custom application. Depending on the DataMan reader you are using, the COM port connection be either RS232, USB, or the Telnet protocol in the case of Ethernet capable readers. By default, Ethernet capable readers are configured to communicate over TCP port number 23, but you can use the Setup Tool to assign a different port number as necessary.

Cognex recommends using HyperTerminal, a built-in Windows communications application, to test your ability to connect to an available reader.

## Command Syntax

All DMCC commands are formed of a stream of ASCII printable characters with the following syntax:

command-header command[arguments]footer

For example:

    ||>trigger on\CR\LF

### Command Header Syntax

All options are colon separated ASCII text. A header without the header-option block will use header defaults.

||checksum:command-id>

checksum

      0: no checksum (default)
      1: last byte before footer is XOR of bytes

command-id
  User-provided sequence identifier that will be reported in acknowledgement.

#### Examples

Example | Description
--- | ---
`||>` | Default Header.
`||0:123>` | Header indicating no-checksum and ID of 123.
`||1>` | Header indicating checksum after command and data.

### Command

The command is an ASCII typable string possibly followed by data. All command names and public parameters data are case insensitive. Only a single command may be issued within a header-footer block. Commands, parameters and arguments are separated by a space character.

Commands
  Short names specifying an action.
  A commonly used command is GET or SET followed by a Parameter and Value.
Parameters
  Short names specifying a device setting.
  Parameter names are organized with a group of similar commands with one level of structural organization separated by a period ('.').
Arguments
  Boolean:ON or OFF
  Integer:123456
  String: ASCII text string enclosed by quotes (“).The string content is passed to a function to translate the string to the final format. The following characters must be backslash escaped: quote (\”), backslash (\\), pipe (\|), tab (\t), CR(\r), LF (\n).

### Footer

The footer is a carriage return and linefeed (noted as \CR\LF or \r\n).

## Reader Response

The reader will have one of several response formats. The choice of response format is configured using the SET COM.DMCC-RESPONSE command. Note that while the reader can process a stream of DMCC commands, it is typically more robust to either wait for a response, or insert a delay between consecutive commands.

Silent: (Default) No response will be sent from the reader. Invalid commands are ignored without feedback. Command responses are sent in space delimited ASCII text without a header or footer.

Extended: The reader responds with a header data footer block similar to the command format.

||checksum:command-id[status]

checksum
  The response uses the same checksum format as the command sent to the reader.
  0: no checksum
  1: last byte before footer is XOR of bytes

command-id
  The command-id sent to the reader is returned in the response header.

status
  An integer in ASCII text format.
  0: no error
  1: reader initiated read-string
  100: unidentified error
  101: command invalid
  102: parameter invalid or missing feature
  103: checksum incorrect
  104: parameter rejected/altered due to reader state
  105: assigned wireless reader is not accessible for the base station

## Examples

Command | Silent Response | Extended Response | Description
--- | --- | --- | ---
`||>GET SYMBOL.DATAMATRIX\r\n` | `ON` | `||[0]ON\r\n` | Is the DataMatrix symbology enabled?
`||>SET SYMBOL.DATAMATRIX ON\r\n` | no response | `||[0]\r\n` | Enable the DataMatrix symbology.
`||>TRIGGER ON\r\n` | decoded data or no-read response | `||[0]\r\n ||[1]`decoded data or no-read response in base64`\r\n` | Trigger Command