cctv-scheduler/info/hikvision/README.md

41 lines
1.2 KiB
Markdown

## 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"
```