# NikonD3Server Interface Control Document #

## Introduction ##

The `nikonD3Server` application employs a binary communcation scheme intended for transmission over tcp sockets. File `nikonD3Messages.h` provides the structures. Each message consists of a fixed width header followed by a variable width message whose length is contained within the header.

The `nikonD3Message` class provides a conveinient interface for encoding and decoding these messages within your application. 

## Table of Values

Below is a table of the format as of January 30th, 2014. Please refer to the source files in case field or commands have been added.

Byte(s)           | Type              | Contents                                 |
----------------- | ----------------- | ---------------------------------------- |
0-1               | unsigned short    | Message Start (0x1801)                   |
2                 | unsigned char     | Version                                  |
3                 | unsigned char     | NikonCommandType (get/set/error)         |
4-5               | unsigned short    | NikonMessageType (message)               |
6                 | unsigned char     | cameraID (reserved)                      |
7-8               | unsigned char[2]  | empty (reserved for future use)          |
9-12              | unsigned long     | byteCount (msg size to follow)           |
13-byteCount      | variable          | message as defined by bytes 4-5 and 9-12 | 

For the data field, a NikonMessageXXXXType should be defined. 

