add hikvision templates

This commit is contained in:
pavel.muhortov 2023-01-29 16:19:59 +03:00
parent 814c6db38b
commit 32efe22c33
19 changed files with 143 additions and 0 deletions

40
info/hikvision/README.md Normal file
View File

@ -0,0 +1,40 @@
## How to use Hikvision templates in bash with curl
### `Define connection parameters`
```bash
camuser=user
campass=pass
camaddr=192.168.254.254
camport=80
```
### `Define action parameters`
> All variables beginning with **"@"** and ending with **"@"** must be changed to valid data.
> Request path, request type, content type are specified between **"\<!-- "** and **"-->"**.
Example of defining parameters from CGI "GetCapabilities" template:
```bash
dat=""
url=$(cat ./hikvision/template/cgi_GetCapabilities.html | grep 'PATH' | cut -d' ' -f3)
req=$(cat ./hikvision/template/cgi_GetCapabilities.html | grep 'METHOD' | cut -d' ' -f3)
```
Example of defining parameters from XML "SetTextOverlay" template:
```bash
dat=$(cat ./hikvision/template/xml_SetTextOverlay.xml)
dat=${dat//@ID@/1}
dat=${dat//@ENABLED@/true}
dat=${dat//@XXXX@/0}
dat=${dat//@YYYY@/0}
dat=${dat//@MSG@/"text"}
url=$(cat ./hikvision/template/xml_SetTextOverlay.xml | grep 'PATH' | cut -d' ' -f3)
url=${url//@CHANNEL@/101}
req=$(cat ./hikvision/template/xml_SetTextOverlay.xml | grep 'METHOD' | cut -d' ' -f3)
```
### `Send action request`
```bash
curl -d "$dat" -X "$req" "http://$camuser:$campass@$camaddr:$camport/$url"
```

View File

@ -0,0 +1,3 @@
<!-- PATH: /ISAPI/PTZCtrl/channels/1/capabilities -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->

View File

@ -0,0 +1,3 @@
<!-- PATH: /Streaming/channels/@ID@/picture?snapShotImageType=JPEG&videoResolutionWidth=@XXXX@&videoResolutionHeight=@YYYY@ -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->

View File

@ -0,0 +1,3 @@
<!-- PATH: /ISAPI/PTZCtrl/channels/@CHANNEL@/status -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->

View File

@ -0,0 +1,3 @@
<!-- PATH: /System/reboot -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=TILT_DOWN&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=PAN_LEFT&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=GOTO_PRESET&presetNo=@ID@&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=PAN_RIGHT&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,3 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=GOTO_PRESET&mode=stop -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=TILT_UP&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=ZOOM_OUT&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,4 @@
<!-- PATH: /PTZ/channels/1/PTZControl?command=ZOOM_IN&speed=@SSSS@&mode=start -->
<!-- METHOD: GET -->
<!-- TYPE: application/x-www-form-urlencoded -->
<!-- SSSS: 1..7 -->

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<AbsoluteHigh>
<elevation>@YYYY@</elevation>
<azimuth>@XXXX@</azimuth>
<absoluteZoom>@ZZZZ@</absoluteZoom>
</AbsoluteHigh>
</PTZData>
<!-- PATH: /ISAPI/PTZCtrl/channels/@CHANNEL@/absolute -->
<!-- METHOD: PUT -->
<!-- TYPE: text/xml -->
<!-- XXXX: 0..3600 YYYY: -900..2700 ZZZZ: 0..1000 -->

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<pan>@XXXX@</pan>
<tilt>@YYYY@</tilt>
<zoom>@ZZZZ@</zoom>
</PTZData>
<!-- PATH: /ISAPI/PTZCtrl/channels/@CHANNEL@/continuous -->
<!-- METHOD: PUT -->
<!-- TYPE: text/xml -->
<!-- XXXX: -100..100 YYYY: -100..100 ZZZZ: -100..100 -->
<!-- x360* = 3300..10 sec x1* = 9,167..0,028 sec -->
<!-- Max action time: 180sec -->

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<PTZData></PTZData>
<!-- PATH: /ISAPI/PTZCtrl/channels/@CHANNEL@/homeposition/goto -->
<!-- METHOD: PUT -->
<!-- TYPE: text/xml -->

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<PTZData>
<pan>@XXXX@</pan>
<tilt>@YYYY@</tilt>
<zoom>@ZZZZ@</zoom>
<Momentary>
<duration>@TTTT@</duration>
</Momentary>
</PTZData>
<!-- PATH: /ISAPI/PTZCtrl/channels/@CHANNEL@/momentary -->
<!-- METHOD: PUT -->
<!-- TYPE: text/xml -->
<!-- XXXX: -100..100 YYYY: -100..100 ZZZZ: -100..100 TTTT: -->

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<PTZData></PTZData>
<!-- PATH: /ISAPI/PTZCtrl/channels/@CHANNEL@/homeposition -->
<!-- METHOD: PUT -->
<!-- TYPE: text/xml -->

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<TextOverlayList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<TextOverlay>
<id>@ID@</id>
<enabled>@ENABLED@</enabled>
<posX>@XXXX@</posX>
<posY>@YYYY@</posY>
<message>@MSG@</message>
</TextOverlay>
</TextOverlayList>
<!-- PATH: /Video/inputs/channels/@CHANNEL@/overlays/text -->
<!-- METHOD: PUT -->
<!-- TYPE: text/xml -->