HTTP commands of Dahua NVR
Hi guys,
I wanted to ask on here as im not sure whether this will be ok.
We are hoping to implement control of a Dahua NVR which has firmware on it to allow HTTP control of its onscreen display.
The document reckons the command for nav up would be;
http://admin:[email protected]:80/cgi-bin/keyBoardCtrl.cgi?setAction=Up
I have done other devices using HTTP Get type commands by connected to the device on say Port 80 TCP , on the button press,
then linking the command as per below on a button switch case;
CASE 1: SEND_STRING dvDevice_IP,"'GET //cgi-bin/keyBoardCtrl.cgi?setAction=Up HTTP/1.1',$0D,$0A,$0D,$0A"
Then disconnect the connection on release..
I have never had to supply credential before.
How do I go about providing credentials in the connect? at the moment my connects are basic;
DEFINE_CALL 'XBMC CONNECT'
{
IP_CLIENT_OPEN(dvXBMC_IP.port,XBMC_IP_IpAddress,XBMC_IP_Port,IP_TCP)
}
DEFINE_CALL 'XBMC DISCONNECT'
{
IP_CLIENT_CLOSE(dvXBMC_IP.port)
}
Any direction really appreciated..
I wanted to ask on here as im not sure whether this will be ok.
We are hoping to implement control of a Dahua NVR which has firmware on it to allow HTTP control of its onscreen display.
The document reckons the command for nav up would be;
http://admin:[email protected]:80/cgi-bin/keyBoardCtrl.cgi?setAction=Up
I have done other devices using HTTP Get type commands by connected to the device on say Port 80 TCP , on the button press,
then linking the command as per below on a button switch case;
CASE 1: SEND_STRING dvDevice_IP,"'GET //cgi-bin/keyBoardCtrl.cgi?setAction=Up HTTP/1.1',$0D,$0A,$0D,$0A"
Then disconnect the connection on release..
I have never had to supply credential before.
How do I go about providing credentials in the connect? at the moment my connects are basic;
DEFINE_CALL 'XBMC CONNECT'
{
IP_CLIENT_OPEN(dvXBMC_IP.port,XBMC_IP_IpAddress,XBMC_IP_Port,IP_TCP)
}
DEFINE_CALL 'XBMC DISCONNECT'
{
IP_CLIENT_CLOSE(dvXBMC_IP.port)
}
Any direction really appreciated..
0
Comments
The resulting string then needs to be sent as an Authorization header
SEND_STRING dvDVR,"'GET /cgi-bin/keyBoardCtrl.cgi?setAction=Up HTTP/1.1',13,10"
SEND_STRING dvDVR,"'Authorization: Basic ',fnBase64('admin:admin'),13,10,13,10"
Hopefully that should work.
Simon
The two steps are 1) establish the connection socket and 2) once the connection is established - send your message.
So, you need to have a DATA_EVENT[dvXBMC_IP] on the IP port. In that data_event>online: is where you now know the IP Port is connected and it is now time to send your message.
I then took this code and the NVR to site and installed it onto the customers NI3100 and it wouldnt work......
I can get the onscreen display to change by typing the commands into a browser and then manually inputting username and password into the prompt but I just cannot get it to work from Netlinx.
Lots of head scratching and back onto it tomorrow I guess... I am wondering if 3.60 Duet firmware may be the issue as our 3101Sig is on 4.xx.. very strange..
I have checked the router and no VLANs are setup, very odd indeed.. The only difference between the controllers is our office unit a NI-3101-SIG on 192.168.0 range with Duet firmware of 4.1.373 and the customers is a NI-3100 on a 192.168.1 range with firmware of 3.60.453.
Firmware on the NVR might be a possibility but I agree not he master. I've come across several devices over the years that would not work because of the firmware variant used. Heck even when AMX came out with that audio system whose name escapes me they changed the communication baud rate between versions with out documenting that fact so the NVR could have changed many things from port or going from HTTP/1.0 to 1.1 or vice verse between versions.
Line 5 (14:17:29):: HTTP/1.1 401 Unauthorized$0D$0AWWW-Authenticate: Digest realm="Login to 1L04659PAMZVS6J",qop="auth",nonce="1659866321",opaque="9ceb3a49
Does this mean digest type authentication? I defintately had it working perfectly in our office - this is driving me nuts =/
Have parsed digest info and sent back the correct credential and am controlling perfectly again...