cctv-scheduler/info/hikvision
2023-01-29 16:19:59 +03:00
..
manual add hikvision manual 2023-01-29 16:16:55 +03:00
template add hikvision templates 2023-01-29 16:19:59 +03:00
README.md add hikvision templates 2023-01-29 16:19:59 +03:00

How to use Hikvision templates in bash with curl

Define connection parameters

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:

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:

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

curl -d "$dat" -X "$req" "http://$camuser:$campass@$camaddr:$camport/$url"