Escolar Documentos
Profissional Documentos
Cultura Documentos
This documentation describes how to integrate PTZ function with HIKCGI protocol,
and the main content is to configure and control mechanical PTZ by HIKCGI protocol.
Before reading this documentation, please read HIKCGI Integration Guide at first.
1 Overview
Note: You should configure the 485 serial ports before operating the PTZ, the parameters of the RS485 should match with the configuration of the external PTZ decoder, otherwise the command sent to
the PTZ will not be decoded correctly.
<name>index</name>
<type>Special Resource</type>
</Resource>
<Resource version="1.0" xlink:href="/indexr">
<name>index</name>
<type>Special Resource</type>
</Resource>
<Resource version="1.0" xlink:href="/description">
<name>description</name>
<type>Special Resource</type>
</Resource>
<Resource version="1.0" xlink:href="/System">
<name>System</name>
<type>Service</type>
</Resource>
... ...
<Resource version="1.0" xlink:href="/PTZ">
<name>PTZ</name>
<type>Service</type>
</Resource>
</ResourceList>
From the above example, the path of returned command is /PTZ, you should use the
definition mentioned in HIKCGI 1.5.9 to control PTZ function of the device.
The section will describe the detailed steps of PTZ function development.
Baud Rate
Data Bits
Stop Bits
Parity Type
Decoder Type
Decoder Address
The parameters of decoder include Decoder Type and Decoder Address; it can be
configured by PUT /PTZ/channels/1.
Based on above-mentioned example in Section 2.2, we set Decoder Type as
PELCO_D and Decoder Address as 1, as follows:
PUT /PTZ/channels/1 HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Host:172.8.6.176
Content-Type:text/xml
Content-Length:254
<?xml version="1.0" encoding="UTF-8"?>
<PTZChannel version="1.0"
xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>1</id>
<videoInputID>1</videoInputID>
<controlProtocol>PELCO_D</controlProtocol>
<controlAddress>1</controlAddress>
</PTZChannel>
<zoom> is speed of optical zoom. When the value is greater than 0, it zooms in;
when the value is smaller than 0, it zooms out.
<pan>,<tile> and <zoom> can be used together, you can also use one of them. In
general, you can use <pan> and <tile> simultaneously to control the movement of PTZ
as specific angle; The speed of <zoom> ranges from -100 to 100. 0: stop movement.
Example: The device moves towards the left and the speed is 60.
PUT /PTZCtrl/channels/1/continuous HTTP/1.1
Host: 172.8.11.101
Content-Type: text/xml
Authorization: Basic YWRtaW46MTIzNDU=
Content-Length: 95
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<pan>-60</pan>
<tilt>0</tilt>
</PTZData>
Example: Stop horizontal movement.
PUT /PTZCtrl/channels/1/continuous HTTP/1.1
Host: 172.8.11.101
Content-Type: text/xml
Authorization: Basic YWRtaW46MTIzNDU=
Content-Length: 93
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<pan>0</pan>
<tilt>0</tilt>
</PTZData>
Example: The device moves upwards, and the speed is 60.
PUT /PTZCtrl/channels/1/continuous HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type: text/xml
Host: 172.8.11.101
Content-Length: 94
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<pan>0</pan>
<tilt>60</tilt>
</PTZData>
Example: The device moves toward the upper right and the speed is 60.
PUT /PTZCtrl/channels/1/continuous HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type: text/xml
Host: 172.8.11.101
Content-Length: 95
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<pan>60</pan>
<tilt>60</tilt>
</PTZData>
Example: Set the camera to zoom in.
PUT /PTZCtrl/channels/1/continuous HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type: text/xml
Host: 172.8.11.101
Content-Length: 80
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<zoom>60</zoom>
</PTZData>
<presetName>Preset-1</presetName>
</PTZPreset>
2. Calling Preset
PUT /PTZCtrl/channels/1/presets/ID/goto command is used to call an existing preset.
ID is the identifier of a preset. This command does not need HTTP body; ID is the
only parameter, so HTTP Header doesnt include Content-Length and Content-Type.
Example:
PUT /PTZCtrl/channels/1/presets/1/goto HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Host: 172.8.11.101
<enabled>true</enabled>
<presetName>1</presetName>
</PTZPreset>
<PTZPreset>
<id>2</id>
<enabled>true</enabled>
<presetName>2</presetName>
</PTZPreset>
<PTZPreset>
<id>128</id>
<enabled>true</enabled>
<presetName>128</presetName>
</PTZPreset>
</PTZPresetList>
<PTZPresetList> is a list of all of the presets of current PTZ channel. Each
<PTZPreset> stands for a preset. From the above example, there are 128 presets in
current PTZ channel.
Content-Length:466
<PTZPatrol version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<enabled>true</enabled>
<id>1</id>
<patrolName>1</patrolName>
<PatrolSequenceList>
<PatrolSequence>
<id>1</id>
<presetID>1</presetID>
<seqSpeed>30</seqSpeed>
<delay>2</delay>
</PatrolSequence>
<PatrolSequence>
<id>2</id>
<presetID>2</presetID>
<seqSpeed>30</seqSpeed>
<delay>2</delay>
</PatrolSequence>
</PatrolSequenceList>
</PTZPatrol>
<PatrolSequenceList> is a list. All of the presets of the patrol will be listed in this list.
The information of each preset is included in a <PatrolSequence>.
<id> refers to the sequence of presets of a patrol in the <PatrolSequence>; <presetID>
stands for the identifier of a preset; <delay> means the delay time (unit is milliseconds);
<seqSpeed> stands for the speed of the movement, the value of <seqSpeed> ranges from
1 to 100.
2. Calling a patrol
PUT /PTZCtrl/channels/1/patrols/ID/start is used to start a patrol. ID is the
identifier of a patrol. This command does not need HTTP body; ID is the only
parameter, so HTTP Header doesnt include Content-Length and Content-Type.
Example:
PUT /PTZCtrl/channels/1/patrols/1/start HTTP/1.1
Host:172.8.11.101
Authorization: Basic YWRtaW46MTIzNDU=
3. Stopping a patrol
PUT /PTZCtrl/channels/1/patrols/ID/stop is used to stop a patrol. ID is the
identifier of a patrol. This command does not need HTTP body; ID is the only
parameter, so HTTP Header doesnt include Content-Length and Content-Type.
Example:
PUT /PTZCtrl/channels/1/patrols/1/stop HTTP/1.1
Host:172.8.11.101
Authorization: Basic YWRtaW46MTIzNDU=
Example:
PUT /PTZCtrl/channels/1/homeposition/goto HTTP/1.1
Host:172.8.11.101
Authorization: Basic YWRtaW46MTIzNDU=
2.5 PTZ commands for Type C of IPC (before V4.0.3), DVS and
DVR
2.5.1 PTZ Commands Description
The general PTZ command format is:
PUT /PTZ/channels/1/PTZControl?command=XXX&mode=YY&speed=N
command, mode and speed are three primary parameters.
The common options of command are as follows:
PAN_LEFT :
PAN_RIGHT:
TILT_UP:
TILT_DOWN:
ZOOM_IN:
ZOOM_OUT:
UP_LEFT:
UP_RIGHT:
DOWN_LEFT:
DOWN_RIGHT:
PAN_AUTO:
If this command takes effect, the camera will return OK firstly and then stop moving.
The response is as follows:
HTTP/1.1 200 OK
Date: Mon, 16 Jul 2012 20:17:13 GMT
Server: App-webs/
Connection: close
Content-Length: 246
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="1.0" xmlns="http://www.stdcgi.com/ver10/XMLSchema">
<requestURL>/PTZ/channels/1/PTZControl</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
</ResponseStatus>