PZT Commands on Camara

212 views
Skip to first unread message

Teo Gavriel

unread,
Dec 3, 2014, 6:31:44 PM12/3/14
to comman...@googlegroups.com
Hi group,

I have been trying to command this Dahua Camara trough the iViewer.

I looked up the request in the web browser and it show's as follow:

Request Method:POST
Status Code:200 OK
Request Headersview parsed
POST /RPC2 HTTP/1.1
Host: 10.40.7.102
Connection: keep-alive
Content-Length: 136
X-Request: JSON
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-type: application/x-www-form-urlencoded; charset=UTF-8
Accept: text/javascript, text/html, application/xml, text/xml, */*
X-Requested-With: XMLHttpRequest
Accept-Encoding: gzip, deflate
Accept-Language: es-ES,es;q=0.8,en;q=0.6
Cookie: DHLangCookie30=%2Fcustom_lang%2FEnglish.txt; DhWebClientSessionID=1259773813; DhWebCookie=%7B%22username%22%3A%22user%22%2C%22pswd%22%3A%22%22%2C%22talktype%22%3A%221%22%2C%22logintype%22%3A%220%22%2C%22openall%22%3A%221%22%7D
Form Dataview sourceview URL encoded
{"method" : "ptz.start", "session" : 1259773813,"params" : {"channel" : 0, "code" : "Down","arg1" : 5,"arg2" : 0,"arg3" : 0},"id" : 119}:
Response Headersview source
CONNECTION:close
CONTENT-LENGTH:73

So the streaming from the camera is working fine, but then i did a button that makes this HTTP Request:

"POST",
null,
JSON.stringify(
{"method" : "ptz.start", "session" : 1259773813,"params" : {"channel" : 0, "code" : "Down","arg1" : 5,"arg2" : 0,"arg3" : 0},"id" : 119}),
function(status, headers, body){
if (status == 200)
{
CF.log("Send Sucessfull: " + status);
CF.log("headers: " + headers.on);
CF.log("headers: "+ body);
}
else
{
CF.log("Error request returned status: " + status);
}
}

So the problem is that it sends the request and gets the Status 200 correctly, headers UNDIFINED, and in the body it receives a full html web page. But the camera dont moves down as it should...

Any help would be appreciated :)
Greetings

Jarrod Bell

unread,
Dec 3, 2014, 7:03:13 PM12/3/14
to comman...@googlegroups.com
What does the body response contain? It will probably show you some error message or other info as to what is going wrong.
I would guess it's something to do with the authentication, considering there is a session token sent as part of the request.
Most likely you were logged into the camera already when doing your initial web browser testing.
If this is the case, you will need to find out how to authenticate first before sending control requests.

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Teo Gavriel

unread,
Dec 3, 2014, 10:08:13 PM12/3/14
to comman...@googlegroups.com, jar...@commandfusion.com
here is a copy of the body it returns, 
 

Not sure if i have to login in the request, but i already did it on the video tool options that is streaming above

Jarrod Bell

unread,
Dec 3, 2014, 10:46:14 PM12/3/14
to comman...@googlegroups.com
That page shows a login form, so I assume it is failing because it doesn't see you as signed in.
Most likely the session token will change each signin. You should contact the manufacturer to find out how to issue HTTP requests for control with authentication headers or something to that effect.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


Reply all
Reply to author
Forward
0 new messages