Documentation for Axxon PSIM 2.0. Documentation for other versions of Axxon PSIM is available too.

Previous page Next page


You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Example 1. Send a command to a camera using the camera HTTP API 

Camera IP address is 192.168.0.13.

The following command turns on the screen wiper on a camera:

192.168.10.101/httpapi/SendPTZ?action=sendptz&PTZ_PRESETSET=85

The following command turns off the screen wiper on a camera:

192.168.10.101/httpapi/SendPTZ?action=sendptz&PTZ_PRESETSET=86

These commands must be sent to a camera using the JScript script.

function DoPreset(preset)
{
    xmlhttp=new ActiveXObject("MSXML2.XMLHTTP");
    if(xmlhttp == null)
    {
           return;
    }
    xmlhttp.open("GET", "http://192.168.0.13/httpapi/SendPTZ?action=sendptz&PTZ_PRESETSET="+preset, false,"admin","1234");
 
    xmlhttp.send();
    DebugLogString(xmlhttp.status);
}
if (Event.SourceType == "MACRO" && Event.SourceId == "6" && Event.Action == "RUN") 
{
 DoPreset("85");
}
 
if (Event.SourceType == "MACRO" && Event.SourceId == "7" && Event.Action == "RUN") 
{
 DoPreset("86");
}

Example 2. Send an email with HTML markup

On macro 1, send a message with the attached detected.png and found.jpg files from the C:\\Pictures\\ folder to example@gmail.com. The message must be formatted as follows:

Face detected

Detected faceFace in database
detected.png filefound.jpg file
if(Event.SourceType == "MACRO" && Event.SourceId=="1" &&Event.Action=="RUN")
{
var file1 = "detected.png";
var file2 = "found.jpg";
var file_folder = "C:\\Pictures\\";

var test_event = CreateMsg();
test_event.StringToMsg("MAIL_MESSAGE|1|SEND_RAW|cc<>,to<daniel@axxonsoft.com>,objname<Mail message 1>,subject<>,parent_id<1>,flags<>,pack<>,name<Mail message 1>,from<example@gmail.com>,_marker<>");

test_event.SetParam("body","<html><body>\r\n<h3>Face found</h3>\r\n<table><tr>\r\n<td>Detected</td><td>Found in DB</td>\r\n</tr><tr>\r\n<td><img width='200' alt='image1' src='cid:"
+
file1
+
"'/></td>\r\n<td><img width='200' alt='image2' src='cid:"
+
file2
+
"'/></td>\r\n</tr><tr>\r\n<td>Email sent from Axxon PSIM</td>\r\n</tr></table>\r\n</body></html>");
test_event.SetParam("attachments",file_folder+file1+";" + file_folder+file2);
test_event.SetParam("is_body_html", 1);
DoReact(test_event);
}

Example 3. Change the position of fisheye camera in the monitor using a macro

On a macro, change the position of fisheye camera 1 in the monitor (Monitor 1) to a new position specified in the script.

if (Event.SourceType == "MACRO" && Event.SourceId == "1" && Event.Action == "RUN")
{
	react = CreateMsg();
	react.StringToMsg("MONITOR|1|CAM_PARAMS|dewarp_display<0>,cam<1>,dewarp_zoom<1.600000,date<22-01-24>,dewarp_y<-0.800000>,dewarp_x<-4.412143>,dewarp_lens<2>,auto_switch<0>");
	react.SetParam("guid", "{3B50FC49-B8F5-00A0-A025-7C10C99D58DE}");
	DoReact(react);
}


  • No labels