#ifndef _DCPROT_H_
#define _DCPROT_H_
#include <sys\types.h>
#if (_MSC_VER >= 1000)
#pragma pack(push, 1)
#else
#pragma pack(1)
#endif
//-------------------------------------------------------------------
// constants
//-------------------------------------------------------------------
//
// common constants
//
#define DCP_PORT
7411 // UDP-port (control)
#define DCP_MAX_MSG_SIZE
1430 // max UDP message size
#define DCP_MANAGERNAME_LEN
20 // length of a manager name
#define DCP_AGENTNAME_LEN
20 // length of a agent name
//
// agent capabilities
//
// used in DCP_MA_REGISTER_REQ
#define DCP_ACAP_NO_CAPS
0x0L
//no capabilities
#define DCP_ACAP_AUDIO
0x00000001L //audio
#define DCP_ACAP_STILL_IMAGES
0x00000002L //still image video
#define DCP_ACAP_MPEG_VIDEO
0x00000004L //mpeg video
#define DCP_ACAP_CAMERA_CNTL
0x00000008L //controllable camera
#define DCP_ACAP_BELL_CNTL
0x00000010L //controllable door bell
#define DCP_ACAP_LOCK_CNTL
0x00000020L //controllable door lock
#define DCP_ACAP_LIGHT_CNTL
0x00000040L //controllable door light
#define DCP_ACAP_SENSOR_CNTL
0x00000080L //controllable sensor
// !!! voilf1 modification !!!
#define DCP_ACAP_NO_VIDEO_DRV
0x00000100L
// !!!
//
// door peripherial commands, several commands may be sent in one
// message by logical OR-ing the commands
//
// used in DCP_MA_LIGHT_REQ
#define DCP_DOOR_LIGHT_ON
0x0001L // turns the light
on
#define DCP_DOOR_LIGHT_OFF
0x0002L // turns the light
off
// used in DCP_MA_DOOR_REQ
#define DCP_OPEN_DOOR
0x0004L // opens the door
#define DCP_CLOSE_DOOR
0x0008L // closes the door
#define DCP_SEND_DOOR_STATE
0x0010L // state of the
door
//
// DCP status
//
#define DCP_OK
0L
// OK, no problems
#define DCP_VIDEO_BUSY
0x00000001L
#define DCP_DOOR_LIGHT
0x00000002L //bit set means on
#define DCP_DOOR_LOCK
0x00000004L //bit set means locked
#define DCP_CAMERA_ERR
0x00000008L //see camera err flags
// used in DCP_MA_REGISTER_REPLY
#define DCP_REFUSE_REGISTRATION
0x00000010L //user registration refuesed
#define DCP_SECURITY_ERROR
0x00000020L //user registration failed in combination
//with
DCP_REFUSE_REGISTRATION
// !!! thx13 modification !!!
// used in DCP_AM_REGISTER_REPLY, DCP_AM_DOOR_REPLY,
// DCP_AM_LIGHT_REPLY, DCP_AM_CAMERA_REPLY
// DCP_AM_MAIN_CTRL_REPLY
#define DCP_REFUSE_MAIN_CTRL
0x00000040L // an other manager has the control
// used in DCP_AM_DOOR_REPLY,
// DCP_AM_LIGHT_REPLY, DCP_AM_CAMERA_REPLY
// DCP_AM_MAIN_CTRL_REPLY, DCP_AM_AV_CTRL_REPLY
#define DCP_REFUSE_CMD
0x00000080L // command, which are not supported
// !!!
// ###
// modification through Diploma Cyclop
// ###
// used in DCP_AM_AV_CTRL_REPLY, DCP_AM_ALIVE_REPLY
// DCP_AM_LIGHT_REPLY, DCP_AM_CAMERA_REPLY
// DCP_AM_MAIN_CTRL_REPLY, DCP_AM_AV_CTRL_REPLY
// DCP_AM_DOOR_REPLY
#define DCP_REJECT
0x00000100L // No registered as activ manager
// or
not registered
// used in DCP_AM_REGISTER_REPLY
#define DCP_ACAP_AUDIO_ERROR
0x00000200L // no suitable audio capability
#define DCP_ACAP_VIDEO_ERROR
0x00000400L // no suitable video capability
// ### end modification
//
// agent indications in message DCP_MA_AGENT_IND
//
#define DCP_AGENT_BELL_IND
0x00000001L // somebody is ringing the bell
// ###
// modification through Diploma Cyclop
// ###
#define DCP_AGENT_BELL1_IND
0x00000001L // is identical with BELL
#define DCP_AGENT_BELL2_IND
0x00000002L // Bell 2 was pushed
// ### end modification
#define DCP_AGENT_SENSOR_IND
0x00000004L // Movments were dedected
#define DCP_AGENT_VIDEO_BUSY_IND
0x00000008L
//
// camera control commands
//
// A camera control command consists of a one byte command code.
// An optional 16-bit parameter may follow for some commands
//
// 31
16 8
0
// [
ÝARGUMENTÝCOMMAND]
//
// used in DCP_MA_AV_CTRL_REQ
//
// definition for 8-bit command
// <****** COMMAND NAME ******>
<VAL > <* PARAMETER **>
#define CONTROL_PAN_MOTOR_SPEED
0x50L // 0x0064 - 0x01F4
#define CONTROL_TILT_MOTOR_SPEED
0x51L // 0x0064 - 0x01F4
#define REQUEST_MOTOR_SPEED
0x52L // See below
#define MOVE_CAMERA
0x53L // See below
#define ACCESS_ABSOLUTE_PAN_ANGLE
0x54L // 0x0000 - 0x053B
#define ACCESS_ABSOLUTE_TILT_ANGLE 0x55L
// 0x0000 - 0x028A
#define REQUEST_ABSOLUTE_ANGLE
0x56L // See below
#define GOTO_HOME_POSITION
0x57L // none
#define BASE_INITIALIZE
0x58L // See below
#define REQUEST_MOTOR_VALUE
0x59L // See below
#define REQUEST_ANGLE_VAL
0x5AL // See below
#define REQUEST_GEAR_RATIO
0x5bL // See below
#define CAMERA_POWER
0xA0L // See below
#define SET_FOCUS_MODE
0xA1L // See below
#define SET_ZOOM
0xA2L // See below
#define ACCESS_TO_ZOOM_POSITION
0xA3L // 0x0000 - 0x0080
#define REQUEST_ZOOM_POSITION
0xA4L // none
#define BACK_LIGHT_COMPENSATION
0xA5L // See below
#define SET_WHITE_BALANCE
0xA7L // See below
#define SET_SHUTTER_SPEED
0xA8L // See below
#define SET_FADE
0xA9L // See below
#define CAMERA_RESET
0xAAL // none
#define REQUEST_ZOOM_RATIO
0xABL // none
#define REQUEST_CCD_IMAGE_SIZE
0xACL // none
#define SET_WIRELESS_CONTROLLER
0x80L // See below
#define REQUEST_OPERATION_STATUS
0x86L // none
#define REQUEST_MODEL_NAME
0x87L // none
#define REQUEST_ROM_VERSION
0x88L // none
#define RECORD_PRESET_POS_DATA_TO_MEM 0x89L
// 0x0001 - 0x0006
#define MOVE_TO_PRESET_POSITION
0x8AL // 0x0001 - 0x0006
#define REQUEST_PRESET_STATUS
0x8BL // none
#define CONTROL_AUDIO_OUTPUT_LEVEL 0x8CL
// 0x0000 - 0x00FF
#define SET_WCPT_MODE
0x8DL // See below
#define SET_LED_MODE
0x8EL // See below
//
// definition for the optional 16-bit parameter
// <***** ARGUMENT NAME *****>
<VAL > <**** COMMAND *****>
#define REQUEST_PAN_MOTOR_SPEED
0x30L // REQUEST_MOTOR_SPEED
#define REQUEST_TILT_MOTOR_SPEED
0x31L // *******************
#define STOP_PAN_AND_TILT
0x30L // MOVE_CAMERA
#define START_PANNING_RIGHT
0x31L // ***********
#define START_PANNING_LEFT
0x32L // ***********
#define START_TILTING_UP
0x33L // ***********
#define START_TILTING_DOWN
0x34L // ***********
#define REQUEST_ABSOLUTE_PAN_ANGLE 0x30L
// REQUEST_ABSOLUTE_ANGLE
#define REQUEST_ABSOLUTE_TILT_ANGLE 0x31L
// **********************
#define BASE_INITIALIZE_1
0x30L // BASE_INITIALIZE
#define BASE_INITIALIZE_2
0x31L // ***************
#define REQUEST_PAN_MOTOR_SPD_LOW_VAL 0x30L
// REQUEST_MOTOR_VALUE
#define REQUEST_PAN_MOTOR_SPD_FAST_VAL 0x31L
// *******************
#define REQUEST_TILT_MOTOR_SPD_LOW_VAL 0x32L
// *******************
#define REQUEST_TILT_MOTOR_SPD_FAST_VAL 0x33L //
*******************
#define REQUEST_MIN_PAN_ANGLE
0x30L // REQUEST_ANGLE_VAL
#define REQUEST_MAX_PAN_ANGLE
0x31L // *****************
#define REQUEST_MIN_TILT_ANGLE
0x32L // *****************
#define REQUEST_MAX_TILT_ANGLE
0x33L // *****************
#define REQUEST_PAN_ANGLE_PULSE_RATIO 0x30L
// REQUEST_GEAR_RATIO
#define REQUEST_TILT_ANGLE_PULSE_RATIO 0x31L
// ******************
#define CAMERA_POWER_OFF
0x30L // CAMERA_POWER
#define CAMERA_POWER_ON
0x31L // ************
#define AF_FOCUS_MODE
0x30L // SET_FOCUS_MODE
#define MANUAL_FOCUS_MODE
0x31L // **************
#define MOVE_FOCUS_NEAR
0x32L // **************
#define MOVE_FOCUS_FAR
0x33L // **************
#define STOP_ZOOMING
0x30L // SET_ZOOM
#define LOW_SPEED_WIDE_ZOOMING
0x31L // ********
#define LOW_SPEED_TELE_ZOOMING
0x32L // ********
#define HI_SPEED_WIDE_ZOOMING
0x33L // ********
#define HI_SPEED_TELE_ZOOMING
0x34L // ********
#define BACK_LIGHT_COMPENSATION_OFF 0x30L
// BACK_LIGHT_COMPENSATION
#define BACK_LIGHT_COMPENSATION_ON 0x31L
// ***********************
#define AUTO_WHITE_BALANCE
0x30L // SET_WHITE_BALANCE
#define WHITE_BALANCE_LOCK
0x31L // *****************
#define PROGRAM_SHUTTER_SPEED
0x30L // SET_SHUTTER_SPEED
#define SHUTTER_SPEED_1_60
0x31L // *****************
#define SHUTTER_SPEED_1_100
0x32L // *****************
#define NORMAL_FADE
0x30L // SET_FADE
#define WHITE_FADE
0x31L // ********
#define HI_SPEED_WHITE_FADE
0x32L // ********
#define HI_SPEED_BLACK_FADE
0x33L // ********
#define WIRELESS_CONTROLLER_ON
0x30L // SET_WIRELESS_CONTROLLER
#define WIRELESS_CONTROLLER_OFF
0x31L // ***********************
#define WCPT_ON
0x30L // SET_WCPT_MODE
#define WCPT_OFF
0x31L // *************
#define NORMAL_LED_DISPLAY
0x30L // SET_LED_MODE
#define LED_FORCED_ON
0x31L // ************
#define LED_FORCED_OFF
0x32L // ************
//
// camera error flags
//
// used in DCP_AM_CAMERA_REPLY
#define DCP_CAMERA_BUSY
0x0001L
#define DCP_CAMERA_CMD_ERR
0x0002L // camera cmd is not supported
#define DCP_CAMERA_PAR_ERR
0x0004L
#define DCP_CAMERA_MODE_ERR
0x0008L
#define DCP_CAMERA_SYSTEM_ERR
0x0010L
#define DCP_CAMERA_NO_ANSWER
0x0020L
//
// commands for video and audio endoding/decoding on the agent
//
// used in DCP_MA_MAIN_CTRL_REQ
#define DCP_GET_MAIN_CTRL
0x0001L // request to be the activ manager
// used in DCP_MA_AV_CTRL_REQ
#define DCP_RELEASE_MAIN_CTRL
0x0001L // release manager as activ manager
#define DCP_SEND_VIDEO_STILL
0x0002L // one image only
#define DCP_SEND_VIDEO_MPEG1
0x0004L
#define DCP_SEND_AUDIO_MPEG1
0x0008L
#define DCP_SEND_VIDEO_AVI
0x0010L
#define DCP_SEND_AUDIO_AVI
0x0020L
#define DCP_SEND_AV_MPEG1
0x0040L
#define DCP_SEND_AV_AVI
0x0080L
#define DCP_SEND_VIDEO_MPEG1_RECV_AUDIO 0x0100L
#define DCP_SEND_VIDEO_AVI_RECV_AUDIO 0x0200L
// ###
// modification through Diploma Cyclop
// ###
#define DCP_RECV_AUDIO
0x0400L // receive audio from manager
#define DCP_SEND_AUDIO
0x0800L // send audio to manager
#define DCP_STOP_AUDIO
0x1000L // stop all audio send/receive
#define DCP_SEND_VIDEO
0x2000L // start continues image sending (video)
#define DCP_STOP_VIDEO
0x4000L // stop continues image sending (video)
// ### end modification
//
// message numbers
//
#define DCP_MA_REGISTER_REQ
0x0010L
#define DCP_AM_REGISTER_REPLY
0x0011L
#define DCP_MA_UNREGISTER_REQ
0x0020L
#define DCP_AM_UNREGISTER_REPLY
0x0021L
#define DCP_MA_LIGHT_REQ
0x0040L
#define DCP_AM_LIGHT_REPLY
0x0041L
#define DCP_MA_DOOR_REQ
0x0050L
#define DCP_AM_DOOR_REPLY
0x0051L
#define DCP_MA_CAMERA_REQ
0x0060L
#define DCP_AM_CAMERA_REPLY
0x0061L
#define DCP_MA_MAIN_CTRL_REQ
0x0070L
#define DCP_AM_MAIN_CTRL_REPLY
0x0071L
#define DCP_MA_AV_CTRL_REQ
0x0080L
#define DCP_AM_AV_CTRL_REPLY
0x0081L
// ###
// modification through Diploma Cyclop
// ###
// updates the timestamp on the agent side
// prevents a prematurely removing of the manager out of the list
#define DCP_MA_ALIVE_REQ
0x0090L
#define DCP_AM_ALIVE_REPLY
0x0091L
// ### end modification
#define DCP_AM_AGENT_IND 0x0100L
//===================================================================
// Protocol Specification
//-------------------------------------------------------------------
// Generalities
// ------------
// The messages defined in this file specify the door control protocol.
// It is a communication protcol between a door manager process and
// a door agent process. The door manager runs on any NT workstation
// on the network, whereas the door agent is an embedded PC system
on
// the network with the purpose to control the door devices such as
// door lock, supervision camera, door bell, door light, etc.
// The system is based on the master/slave principle. The door
// manager (master) governs the door agent (slave). As usual in
// telecommunication systems, there are two message pairs:
//
// REQUEST / REPLY used by the door manager
(master) to request a
//
service offered by the door agent (slave).
// INDICATE/ CONFIRM used by the door agent (slave)
to indicate an
//
event and to offer the manager (master) a service
//
on the agent to handle the event on manager's
//
request. The manager may or may not confirm an
//
indication. Confirmation is not necessary, for
//
example, if the manager requests the service
//
explicitly by a REQUEST message.
//
// Message Length
// --------------
// The message length fields gives the length of the message in bytes
// INCLUDING the length field.
//
// Message Number
// --------------
// Each message in the DCP is referenced to by a unique message number.
// The message number are defined as macros such as DCP_MA_AGENTINFO_REQ.
//
// Message Identification
// ----------------------
// The message identification field is present in all messages. It
may
// be used to match request and reply messages, as well as indication
// and comfirmation messages.
//
// Authentication
// --------------
// In all protocol messages there is a security key field that can
be
// used for authentication. Authentication is necessary when a manager
// contacts an agent and is recommeded in all subsequent messages of
// the DCP. No authenication is done in video and audio messages.
//
// General Message Format
// ----------------------
// A message in the Door Control Protocol (DCP) consists of three
// parts
// (1) The length of the message including this length
field
// (2) The message number. Message number should be managed
in the
// form of macros such as DCP_MA_MAIN_CTRL_REQ.
// (3) A security key that allows a manager to authenticate
an agent
// and vice versa. It is allowed
to define additional security
// keys in the payload of the message.
// (4) A message identification that allows to match a
reply with
// its corresponding request.
// (5) The message body (variable size payload data field).
The
// message body may contain zero
or more bytes.
// Note that baData[] is also a
pointer to the first data byte
// in the message. A structure
such as DcpMaMainCtrlReq can be
// used to access the fields in
the message body.
//
// Byte Order and Alignment
// ------------------------
// All integer fields are carried in little endian byte order.
The
// fields in the messages are aligned to their natural length,
i. e.
// 16-bit fields are aligned on even offsets, 32-bit fields are
// aligned at offsets divisible by four, etc.
//
// It is important that the compiler aligns the elements in a
structure
// on byte boundary. The compiler must not generate fillers to
// optimize access performance in a structure.
//-------------------------------------------------------------------
typedef struct {
U16 uMsgLen;
//the length of the message
U16 uMsgNo;
//the message number (or msg identifier)
U32 ulSecurity;
//security key
U32 ulIdent;
//identification to match request and reply
BYTE baData[1];
//begin of the data field
} DcpMsg;
//===================================================================
// Part 1: Registration.
// The following messages define registration. A manager
that
// desires to be served by an agent must register on that
agent.
// The manager maintains a table with the IP addresses
of all known
// agents. All messages contain a security ID that allows
an agent
// to authenticate the manager.
// An agent, on the other hand, sends a security ID in
its reply that
// allows a manager to authenticate the agent. An agent
maintains a
// table with the IP addresses of all registered managers.
// A manager should only communicate with an authenticated
agent, and
// vice versa.
// All subsequent messages may only be sent from a manager
to an agent
// when the manager has successfully registered.
// When the manager shuts down, for example, it unregisters.
//
// The agent waits passively for a manager to register.
//
// During the registration, the manager tells the agent
his favorit
// wave and video format. It can make several choices.
The first one
// fitting will be chosen.
//
//===================================================================
//-------------------------------------------------------------------
// DCP_MA_REGISTER_REQ CONTROLPORT(UDP)
MANAGER --> AGENT
//
// This message is sent by a manager to contact an agent in order to
// register. The manager sends also its name to the agent as
// information.
// It also sends the capability. Like, what kind of a videoformat
// it likes, e.g. MPEG, RGB etc.
// The agent repeats the value of the identification in its
// response message.
// The agent sends its security key value to allow the manager
// to authenticate the agent.
// If the agent and the manager find a matching pair of wave-
// and videoformat the manager will be registered.
// baFlags contains a sequence of U32 values, terminated with
// 0L. An ACAP value (e.g. DCP_ACAP_AUDIO) is in the highword.
// In the lowword we put a Multimedia Extension (mmreg.h, mmagent.h)
//-------------------------------------------------------------------
typedef struct {
char caManagerName[DCP_MANAGERNAME_LEN];
// ###
// modification through Diploma Cyclop
// ###
BYTE baFlags[1];
// Flagarray of capabilities
// ### end modification
} DcpMaRegisterReq;
//-------------------------------------------------------------------
// DCP_AM_REGISTER_REPLY CONTROLPORT(UDP)
AGENT --> MANAGER
//
// The agent sends this message after having successfully authenticated
// and registered the manager.
// If the agent find a matching pair in the capabilities, it sends
// DCP_OK. If the audio capability is not matching, it sends
// DCP_ACAP_AUDIO_ERROR. If the video capability fails, the answer
// will be DCP_ACAP_VIDEO_ERROR. Both errors can be put together.
// In this case, the manager will not be registrated.
// Also, if there is no space left to register a manager, it sends
// a DCP_REFUSE_REGISTRATION
// The agent fills in the message his security ID that allows the
// manager to authenticate the agent.
//-------------------------------------------------------------------
typedef struct {
U32 uStatus;
// DCP_OK, DCP_REFUSE_REGISTRATION,
// DCP_ACAP_AUDIO_ERROR, DCP_ACAP_VIDEO_ERROR
U32 ulCapability;
char caAgentName[DCP_AGENTNAME_LEN];
} DcpAmRegisterReply;
//-------------------------------------------------------------------
// DCP_MA_UNREGISTER_REQ CONTROLPORT(UDP)
MANAGER --> AGENT
//
// This message is sent by a manager to an agent to unregister
//-------------------------------------------------------------------
// currently no message body defined
//-------------------------------------------------------------------
// DCP_AM_UNREGISTER_REPLY CONTROLPORT(UDP)
AGENT --> MANAGER
//
// The agent sends this message after having successfully unregistered
// the manager.
//-------------------------------------------------------------------
typedef struct {
U32 uStatus;
// DCP_OK
} DcpAmUnregisterReply;
// ###
// modification through Diploma Cyclop
// ###
//-------------------------------------------------------------------
// DCP_MA_ALIVE_REQ CONTROLPORT(UDP)
MANAGER --> AGENT
//
// This message is sent by a manager to an agent to tell
// it's still alive
//-------------------------------------------------------------------
// currently no message body defined
//-------------------------------------------------------------------
// DCP_AM_ALIVE_REPLY CONTROLPORT(UDP)
AGENT --> MANAGER
//
// The agent sends this message after having successfully reanimated
// the manager.
//-------------------------------------------------------------------
typedef struct {
U32 uStatus;
// DCP_OK, DCP_REJECT (If the manager is
// not anymore registered)
} DcpAmAliveReply;
// ### end modification
//===================================================================
// Part 2: Door Light Control
//===================================================================
//-------------------------------------------------------------------
// DCP_MA_LIGHT_REQ
CONTROLPORT(UDP)
MANAGER --> AGENT
//
// A manager sends this message to an agent to switch the door light
// on or off.
//-------------------------------------------------------------------
typedef struct {
U16 uCommand; //DCP_DOOR_LIGHT_ON, DCP_DOOR_LIGHT_OFF
} DcpMaLightReq;
//-------------------------------------------------------------------
// DCP_AM_LIGHT_REPLY CONTROLPORT(UDP)
AGENT --> MANAGER
AGENT --> MANAGER
//
// An agent sends this message to a manager to confirm the door
// light on/off command. It contains the door light status.
//-------------------------------------------------------------------
typedef struct {
U16 uStatus; // DCP_OK, DCP_REFUSE_MAIN_CTRL
(an activ manager
// has taken the control), DCP_REJECT
} DcpAmLightReply;
//===================================================================
// Part 3: Door Lock Control
//===================================================================
//-------------------------------------------------------------------
// DCP_MA_DOOR_REQ
CONTROLPORT(UDP)
MANAGER --> AGENT
//
// A manager sends this message to an agent to open/close the
// door lock.
//-------------------------------------------------------------------
typedef struct {
U16 uCommand; // DCP_OPEN_DOOR, DCP_CLOSE_DOOR, DCP_SEND_DOOR_STATE
} DcpMaDoorReq;
//-------------------------------------------------------------------
// DCP_AM_DOOR_REPLY
CONTROLPORT(UDP)
AGENT --> MANAGER
//
// An agent sends this message to a manager to confirm the door
// open/close command.
//-------------------------------------------------------------------
typedef struct {
U16 uStatus; // DCP_OK, DCP_REFUSE_MAIN_CTRL
(an activ manager
// has taken the control), DCP_REJECT
} DcpAmDoorReply;
//===================================================================
// Part 4: Bell and Presence Sensor Control
// When someone presses on the bell button, or when
the IR sensor
// detects somebody in front of the door, the agent
sends
// a DCP_AM_AGENT_IND message to all registered managers
to report
// the event.
// This message is not confirmed by the receiver.
The users on all
// manager stations are notified. Normally, a user
wants to see
// video, or talk to the person. Therefore, the agent
waits for a
// DCP_MA_MAIN_CTRL_REQ from any manager (see part
6).
// The first manager that sends this message gets
the main control
// of the agent. No other manager may control anything
or get anything.
// Only the activ manager gets video and audio.
// All request from other manager will be answered
with
// DCP_DEFUSE_MAIN_CTRL
//===================================================================
//-------------------------------------------------------------------
// DCP_AM_AGENT_IND
DCP_PORT(UDP) AGENT
--> MANAGER
//
// An agent sends this message to a manager when someone presses
// on the bell button, or when the agent's sensor detects an activity.
//-------------------------------------------------------------------
typedef struct {
U32 ulIndication; // DCP_AGENT_BELL_IND,
DCP_AGENT_BELL1_IND
// DCP_AGENT_BELL2_IND, DCP_AGENT_SENSOR_IND
} DcpAmAgentInd;
//===================================================================
// Part 5: Camera Control
// The camera control
is a protocol to govern a camera.
// These protocol messages
extend the DCP to allow the
// manager to control
the camera.
// The command structure
was given through Canon. Now
// it serves as a pseudo
control. Not every command will
// be supported. Not
supported commands will be replied
// with DCP_CAMERA_CMD_ERR.
//
// The manager sends
command control requests that are
// executed by the
agent. The agent reports success or error.
//===================================================================
//-------------------------------------------------------------------
// DCP_MA_CAMERA_REQ
CONTROLPORT(UDP)
MANAGER --> AGENT
//
// A manager sends this message to an agent to control its camera.
// The command consists of a byte command and an optional 16-bit word
// parameter, depending on the command. The commands and parameters
// are specified in the VC-C1 manual.
//-------------------------------------------------------------------
typedef struct {
U32 ulCommand; //byte command, word argument,
byte reserved
} DcpMaCameraReq;
//-------------------------------------------------------------------
// DCP_AM_CAMERA_REPLY CONTROLPORT(UDP)
AGENT --> MANAGER
//
// An agent sends this message to a manager to confirm the camera
// commands. Some commands generate status information or error codes.
// If the camera status is not DCP_OK, the error flags may specify
the
// error.
//-------------------------------------------------------------------
typedef struct {
U32 ulStatus; // DCP_OK, DCP_CAMERA_CMD_ERR,
// DCP_REFUSE_MAIN_CTRL, DCP_REJECT
U32 ulErrFlags; // Camera Errors
U32 ulValue1; // for future use
U32 ulValue2; // for future use
} DcpAmCameraReply;
//===================================================================
// Part 6: Video and Audio Transfer
// When someone rings
the bell or when the presence sensor
// detects an activity,
or when the user of the manager wants
// it, the manager
can request the agent to capture video and
// audio, depending
on the agent's capabilities and hardware
// support:
// * still
images, compressed or uncompressed
// * AVI
or MPEG-1 encoded motion video.
// * request
audio encoding
// * request
audio playout
// Consequently, the
video transmission is a simplex flow from
// the agent to the
manager.
// Since most audio
boards cannot encode and decode
// simultaneously,
audio is realized as half duplex flows.
// If one end is encoding
audio the other end is decoding and
// playing it out,
and vice versa.
// If the agent's hardware
supports AVI or MPEG-1 audio may
// be multiplexed into
the video stream.
// The transmission
for audio and video is performed in a
// connection less
fashion on dynamically assigned ports
// on the manager and
on the agent.
//===================================================================
//-------------------------------------------------------------------
// DCP_MA_MAIN_CTRL_REQ CONTROLPORT(UDP)
MANAGER --> AGENT
//
// A manager sends this message to get the main control of the agent.
// It becomes the activ manager. It has now the full and only control
// of everything.
// If the activ manager doesn't do anything in a period of time, it
// can be deactivated and somebody else can become the activ manager.
//-------------------------------------------------------------------
typedef struct {
U32 ulCommand;
// DCP_GET_MAIN_CTRL
U16 uVideoPort;
// manager's video port
U16 uAudioPort;
// manager's audio port
U32 ulMaxDgramSize; // manager's max
datagram size
} DcpMaMainCtrlReq;
//-------------------------------------------------------------------
// DCP_AM_MAIN_CTRL_REPLY CONTROLPORT(UDP)
AGENT --> MANAGER
//
// This message is sent by an agent to a manager to ack the request
// for video and/or audio.
//-------------------------------------------------------------------
typedef struct {
U32 ulStatus;
//DCP_OK, DCP_REFUSE_MAIN_CTRL, DCP_REJECT
U32 ulMaxDgramSize; //agent's max datagram
size
U16 uAudioPort;
//agent's audio port
U16 uImageHdrSize;
char baImageHdr[1]; //depends on various
things
} DcpAmMainCtrlReply;
//-------------------------------------------------------------------
// DCP_MA_AV_CTRL_REQ CONTROLPORT(UDP)
MANAGER --> AGENT
//
// A manager sends this message to an agent to start or stop sending
// video and/or audio. Only the activ manager can use this message.
// Not activ manager will receive the error message
// DCP_REJECT.
// The manager may now control the flow of the data.
// The video/audio data is transmitted connection less by using the
// UDP protocol on the transport layer.
//
// With DCP_RELEASE_MAIN_CTRL the activ manager will release his
// exclusively control. Somebody else may now take over.
//-------------------------------------------------------------------
typedef struct {
U32 ulCommand; // DCP_SEND_VIDEO_STILL,
DCP_SEND_VIDEO_MPEG1,
// DCP_SEND_AUDIO_MPEG1, DCP_SEND_VIDEO_AVI,
// DCP_SEND_AUDIO_AVI, DCP_SEND_AV_MPEG1,
// DCP_SEND_VIDEO_MPEG1_RECV_AUDIO,
// DCP_SEND_VIDEO_AVI_RECV_AUDIO,
// DCP_RECV_AUDIO, DCP_SEND_AUDIO,
// DCP_STOP_AUDIO, DCP_SEND_VIDEO
// DCP_STOP_VIDEO, DCP_RELEASE_MAIN_CTRL
} DcpMaAvCtrlReq;
//-------------------------------------------------------------------
// DCP_AM_AV_CRTL_REPLY CONTROLPORT(UDP)
AGENT -->> MANAGER
//
// An agent sends this message to a manager to report success or
// failure of a control request.
//-------------------------------------------------------------------
typedef struct {
U32 uStatus; // DCP_OK, DCP_REJECT, DCP_REFUSE_CMD
U32 uErrFlags;
} DcpAmAvCtrlReply;
//===================================================================
// Audio/Video Data Packet DATAPORT(UDP)
AGENT <--> MANAGER
//
//
// The audio/video data is sent by an agent to a manager or vice
// versa in the form of enumerated (ulSequenceNr) variable size
// packets of audio and/or video data.
// The size of the packet must be smaller than the maximum datagram
// size advertized by the other end.
// This is not a protocol message, there is no message number,
// no message identification, and no security key.
// Sending continues images, the Hiword of SequenceNr, will be
// the counter of a whole picture.
// The Loword of SequenceNr is a counter of the chunk.
//===================================================================
typedef struct {
U32 ulSequenceNr; //sequence
number of the packet
U32 ulAudioSize; //size
of audio part in data field
U32 ulVideoSize; //size
of video part in data field
BYTE baData[1];
//begin of data field
} DcpAvPacket;
#if (_MSC_VER >= 1000)
#pragma pack(pop)
#else
#pragma pack()
#endif
#endif
//end of file:dcprot.h