diff --git a/info/hikvision/README.md b/info/hikvision/README.md new file mode 100644 index 0000000..b842f56 --- /dev/null +++ b/info/hikvision/README.md @@ -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 **"\"**. + +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" +``` + diff --git a/info/hikvision/template/cgi_GetCapabilities.html b/info/hikvision/template/cgi_GetCapabilities.html new file mode 100644 index 0000000..8e1dfe7 --- /dev/null +++ b/info/hikvision/template/cgi_GetCapabilities.html @@ -0,0 +1,3 @@ + + + diff --git a/info/hikvision/template/cgi_GetJPEG.html b/info/hikvision/template/cgi_GetJPEG.html new file mode 100644 index 0000000..58be372 --- /dev/null +++ b/info/hikvision/template/cgi_GetJPEG.html @@ -0,0 +1,3 @@ + + + diff --git a/info/hikvision/template/cgi_GetPosition.html b/info/hikvision/template/cgi_GetPosition.html new file mode 100644 index 0000000..3d27a11 --- /dev/null +++ b/info/hikvision/template/cgi_GetPosition.html @@ -0,0 +1,3 @@ + + + diff --git a/info/hikvision/template/cgi_GetReboot.html b/info/hikvision/template/cgi_GetReboot.html new file mode 100644 index 0000000..21a338a --- /dev/null +++ b/info/hikvision/template/cgi_GetReboot.html @@ -0,0 +1,3 @@ + + + diff --git a/info/hikvision/template/cgi_PtzDown.html b/info/hikvision/template/cgi_PtzDown.html new file mode 100644 index 0000000..483c8b8 --- /dev/null +++ b/info/hikvision/template/cgi_PtzDown.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/cgi_PtzLeft.html b/info/hikvision/template/cgi_PtzLeft.html new file mode 100644 index 0000000..f0d8b50 --- /dev/null +++ b/info/hikvision/template/cgi_PtzLeft.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/cgi_PtzPreset.html b/info/hikvision/template/cgi_PtzPreset.html new file mode 100644 index 0000000..7c75085 --- /dev/null +++ b/info/hikvision/template/cgi_PtzPreset.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/cgi_PtzRight.html b/info/hikvision/template/cgi_PtzRight.html new file mode 100644 index 0000000..18c3f07 --- /dev/null +++ b/info/hikvision/template/cgi_PtzRight.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/cgi_PtzStop.html b/info/hikvision/template/cgi_PtzStop.html new file mode 100644 index 0000000..b40d624 --- /dev/null +++ b/info/hikvision/template/cgi_PtzStop.html @@ -0,0 +1,3 @@ + + + diff --git a/info/hikvision/template/cgi_PtzUp.html b/info/hikvision/template/cgi_PtzUp.html new file mode 100644 index 0000000..f2fbfcb --- /dev/null +++ b/info/hikvision/template/cgi_PtzUp.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/cgi_PtzZoomIn.html b/info/hikvision/template/cgi_PtzZoomIn.html new file mode 100644 index 0000000..52acec0 --- /dev/null +++ b/info/hikvision/template/cgi_PtzZoomIn.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/cgi_PtzZoomOut.html b/info/hikvision/template/cgi_PtzZoomOut.html new file mode 100644 index 0000000..117cc51 --- /dev/null +++ b/info/hikvision/template/cgi_PtzZoomOut.html @@ -0,0 +1,4 @@ + + + + diff --git a/info/hikvision/template/xml_GoAbsolute.xml b/info/hikvision/template/xml_GoAbsolute.xml new file mode 100644 index 0000000..b7318cf --- /dev/null +++ b/info/hikvision/template/xml_GoAbsolute.xml @@ -0,0 +1,12 @@ + + + + @YYYY@ + @XXXX@ + @ZZZZ@ + + + + + + diff --git a/info/hikvision/template/xml_GoContinuous.xml b/info/hikvision/template/xml_GoContinuous.xml new file mode 100644 index 0000000..7c283ef --- /dev/null +++ b/info/hikvision/template/xml_GoContinuous.xml @@ -0,0 +1,12 @@ + + + @XXXX@ + @YYYY@ + @ZZZZ@ + + + + + + + diff --git a/info/hikvision/template/xml_GoHomeposition.xml b/info/hikvision/template/xml_GoHomeposition.xml new file mode 100644 index 0000000..314b1d2 --- /dev/null +++ b/info/hikvision/template/xml_GoHomeposition.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/info/hikvision/template/xml_GoMomentary.xml b/info/hikvision/template/xml_GoMomentary.xml new file mode 100644 index 0000000..c2e4fc9 --- /dev/null +++ b/info/hikvision/template/xml_GoMomentary.xml @@ -0,0 +1,13 @@ + + + @XXXX@ + @YYYY@ + @ZZZZ@ + + @TTTT@ + + + + + + diff --git a/info/hikvision/template/xml_SetHomeposition.xml b/info/hikvision/template/xml_SetHomeposition.xml new file mode 100644 index 0000000..69b0b9b --- /dev/null +++ b/info/hikvision/template/xml_SetHomeposition.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/info/hikvision/template/xml_SetTextOverlay.xml b/info/hikvision/template/xml_SetTextOverlay.xml new file mode 100644 index 0000000..968941e --- /dev/null +++ b/info/hikvision/template/xml_SetTextOverlay.xml @@ -0,0 +1,13 @@ + + + + @ID@ + @ENABLED@ + @XXXX@ + @YYYY@ + @MSG@ + + + + +