How To Integrate Hikvision PTZ Function
How To Integrate Hikvision PTZ Function
1 Overview
This paper is intended to help integrators to integrate PTZ function. Common problems proposed
during integration are summarized here to help solve PTZ related ISAPI problems.
2. Integration flow
For IP Dome, no doubt PTZ function is generally supported; for IP Camera/IP Zoom, part of them
support PTZ, however, for IP Camera/IP Zoom don’t support PTZ but with RS485 serial port, PTZ
function also can be integrated. Therefore, I summarize out the following flow chart, which
shows the integration process clearly.
Device type
No IP camera/
IPDome?
IP zoom
No Support
Support PTZ
RS485
Yes Yes
Configure
Yes RS485 serial
port info and
decoder info
Pan Tilt Zoom
control
Preset/Patrol/
Homeposition/
Poweroffmemory
End
3 PTZ integration
</DeviceInfo>
You can see clearly the type via this item <deviceDescription>.
(2)How to judge whether one device support PTZ or not and the supported PTZ channel
number?
GET /ISAPI/PTZCtrl/channels
HTTP/1.1 200 OK
Date: Mon, 03 Nov 2014 16:45:16 GMT
Server: App-webs/
Connection: close
Content-Length: 754
Content-Type: application/xml
</SerialPortList>
(4) Configure RS485 serial port info and decoder info
The following parameters should be configured:
a. Baud rate
b. Data bits
c. Stop bits
d. Parity type: odd, even, none
e. Decoder address
1)Configure RS485 serial port info
Put /ISAPI/System/Serial/ports/1
Xml
PUT /ISAPI/System/Serial/ports/1 HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type:text/xml
Content-Length:399
</PTZPresetList>
In this <PTZPresetList>, all presets that have been set will be listed here. There are 105 presets
have been set for this example.
(8) Patrol set and call
1)Set patrol
PUT /ISAPI/PTZCtrl/channels/1/patrols/1
xml
<PTZPatrol version="2.0" xmlns="http://www.isapi.org/ver20/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>
<patrolName> represents one patrol, each preset begin with <PatrolSequence>.
Response
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 11:35:46 GMT
Server: App-webs/
Connection: close
Content-Length: 291
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL>/ISAPI/PTZCtrl/channels/1/patrols/1</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>
2)Call patrol
PUT /ISAPI/PTZCtrl/channels/1/patrols/1/start
Response
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 14:44:05 GMT
Server: App-webs/
Connection: close
Content-Length: 297
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL>/ISAPI/PTZCtrl/channels/1/patrols/1/start</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>
Send PUT /ISAPI/PTZCtrl/channels/1/patrols/1/stop to stop the patrol.
(9)How to configure the homeposition?
PUT /ISAPI/PTZCtrl/channels/1/homeposition
Response
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 15:14:21 GMT
Server: App-webs/
Connection: close
Content-Length: 294
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL>/ISAPI/PTZCtrl/channels/1/homeposition</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>
The current PT position will be set as homeposition.
Note: zoom position isn’t included in homeposition.
Send PUT /ISAPI/PTZCtrl/channels/1/homeposition/goto to call the homeposition.
(10)How to configure Power off memory?
Power off memory function is used to memorize the PTZ position before power off.
1)Get the power off memory info
GET /ISAPI/PTZCtrl/channels/1/saveptzpoweroff
Response
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 15:43:25 GMT
Server: App-webs/
Connection: close
Content-Length: 192
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<savePtzPoweroff version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<savePtzPoweroffType>30sec</savePtzPoweroffType>
</savePtzPoweroff>
2)Set the power off memory
PUT /ISAPI/PTZCtrl/channels/1/saveptzpoweroff
XML
<savePtzPoweroff version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<savePtzPoweroffType>30sec</savePtzPoweroffType>
</savePtzPoweroff>
Note: <savePtzPoweroffType> parameter options can be 30sec, 60sec, 300sec, 600sec and
disable. When the option is ‘disable’, it means, power off memory is closed.
Response
HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 15:51:53 GMT
Server: App-webs/
Connection: close
Content-Length: 297
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL>/ISAPI/PTZCtrl/channels/1/saveptzpoweroff</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>