you don't need WireShark or any special software to track down the commands. Just open your camera in the Chrome Browser, and press Ctrl Shift i (or Cmd Shift i on a Mac); then click on the "Network" tab at the top. Then run your camera using the regular controls and you will see the corresponding network commands appear in the network list. You can then click on each one, and look at the other tabs, Header, Preview, Response
Just a quick look, I can see that the PTZ control, you POST to this address (substitute in your cameras IP address AAA, BBB, and then also your token)
along with the request payload; this is a payload to move to preset 1:
[{"cmd":"PtzCtrl","action":0,"param":{"channel":0,"op":"ToPos","speed":32,"id":1}}]
move to preset 2
[{"cmd":"PtzCtrl","action":0,"param":{"channel":0,"op":"ToPos","speed":32,"id":2}}]
move right
[{cmd: "PtzCtrl", action: 0, param: {channel: 0, op: "Right", speed: 32}}]
to get your token for the URL above, you need to post here:
with this payload (substituted in your username and password)
[{"cmd":"Login","action":0,"param":{"User":{"userName":"admin","password":"abcdefg"}}}]
the response that comes back has the token in the name field
[
{
"cmd" : "Login",
"code" : 0,
"value" : {
"Token" : {
"leaseTime" : 3600,
"name" : "75a35d0a5a30680"
}
}
}
]
all of these commands can be sent in javascript very easily like so:
var url="
";
var json=[{"cmd":"PtzCtrl","action":0,"param":{"channel":0,"op":"ToPos","speed":32,"id":1}}];
/create request for shopify
var req=new XMLHttpRequest();
req.onreadystatechange=function(e) {
if(req.readyState==4) {
var showErrorTab=false;
if(req.status==200) {
console.log("response:"+req.responseText);
} else {
console.log("Error calling PtzCtrl");
}
}
}
req.open("POST",url);
req.setRequestHeader("Accept","application/json");
req.send(JSON.stringify(json));