Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After each button click on the control panel wait for 2 seconds until clicking another button. If there is no button click, then the camera with dialed number is to be displayed.

Code Block
languagejs
if (Event.SourceType=="TIMER" && Event.SourceId=="1" && Event.Action=="TRIGGER")
{
 mon="1";
 DebugLogString("on monitor "+ Itv_var("cam"));
 DoReactStr("MONITOR",mon,"ACTIVATE_CAM","cam<"+Itv_var("cam")+">");
 Itv_var("cam")="";
}
 
if (Event.GetParam("source_type")=="TELEMETRY" && Event.GetParam("action")=="GO_PRESET")
{
 DoReactStr("TIMER","1","START","bound<2>");
 var key=Event.GetParam("param4_val");
 DebugLogString("Key:"+key);
 Itv_var("cam")=Itv_var("cam")+key;
 DebugLogString(Itv_var("cam"));
}

...

These commands are to be sent to camera using the Jscript script.

Code Block
languagejs
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");
}

...

If the object tracking function is in use (see Creating and configuring the Timer object section of Administrator’s Guide), then detected objects will be framed in video when viewing the archive. To frame abandoned objects in live video use the script aimed to frame an abandoned object when receiving alarm from VMDA detection tool:

Code Block
languagejs
if (Event.SourceType=="CAM_VMDA_DETECTOR")
{
 cam=GetObjectParentId("CAM_VMDA_DETECTOR",Event.SourceId,"CAM");
 if (Event.Action=="ALARM")
 {
 var x1,x2,y1,y2;
 x1=Event.GetParam("x");
 x2=Event.GetParam("w");
 y1=Event.GetParam("y");
 y2=Event.GetParam("h");
 x2=parseInt(x1)+parseInt(x2);
 y2=parseInt(y1)+parseInt(y2);
 DoReactStr("MONITOR","","SET_MARKRECT","cam<"+cam+">,color<255>,id<"+cam+">,x1<"+x1+">,x2<"+x2+">,y1<"+y1+">,y2<"+y2+">");
 DebugLogString("x1:"+x1+" x2:"+x2+" y1:"+y1+" y2:"+y2);
 }
 else
 {
 DoReactStr("MONITOR","","DEL_MARKRECT","cam<"+cam+">,id<"+cam+">");
 }
}

...

Objects from more than one main Server are not to be moved to the Backup Server. For this when moving objects from some main Server to the Backup Server all other Failover objects are to be disabled on this Backup Server.

Code Block
languagejs
if (Event.SourceType == "FAILOVER" )
{
 if (Event.Action == "START") {action="DISABLE";}
 if (Event.Action == "STOP") {action="ENABLE";}
 id=Event.SourceId;
 msg=CreateMsg();
 msg.StringToMsg(GetObjectIds("FAILOVER"));
 var
 objCount=msg.GetParam("id.count");
 for (i=0;i<objCount;i++)
 {
 pid=msg.GetParam("id."+i);
 
 if (!(id==pid)) {
 DoReactStr("FAILOVER",pid,action,"");
 }
 } 
}

...

Upon reaching the number of visitors equal to 20 on the embedded visitors counter of the Bosch FLEXIDOME IP dynamic 7000 VR IP camera (with ID 1), call the macro 1.

Code Block
languagejs
n=20;
if(Event.SourceType == "CAM_IP_DETECTOR" && Event.SourceId=="1" && Event.Action == "DETECTED")
{
 v=Event.GetParam("param0").split(";")[1];
 if (parseInt(v.split(":")[1])==n)
 {
 DoReactStr("MACRO","1","RUN","");
 } 
}

...

Detected faceFace in DB
detected.png filefound.jpg file


Code Block
languagejs
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>E-mail 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);
}

...

Info
titleNote.

For more information on access levels and access cards, see the ACFA-Axxon PSIM documentation in the AxxonSoft documentation repository.

If an ACS integration is configured in Axxon PSIM, which supports dynamic user recording, then the created user will be automatically written to the ACS controller when the CORE||UPDATE_OBJECT|objtype<PERSON> event is sent. If dynamics is not supported, then recording users to the controller will need to be initiated manually.


Code Block
languagejs
dep=10; // department ID
start=100;// first user ID
last=150; // last user ID
acc_lev=1; // access level ID 
dep_count=30; // max number of users in the department

if( Event.SourceType == "MACRO" && Event.Action == "RUN" && Event.SourceId=="101")
 { 
	kol=0;
	card_count=0;
	NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
	for (i=start;i<=last;i++)
	{
		kol++;
		card_count++;
		card=decToHex(card_count);
		if (card[card.length-1]==0) 
		{	
			card_count++;
			card=decToHex(card_count);	
		}
					
		if (kol==dep_count) 
		{						
			NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,parent_id<"+dep+">, level_id<"+acc_lev+">, facility_code<0>, card<"+card+">");
			kol=0;
			dep++;
			NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
		}
		else
		{
			NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,parent_id<"+dep+">,level_id<"+acc_lev+">, facility_code<0>,card<"+card+">");
		}
 Sleep(10);
	}
 }
 
function decToHex(n)
{ 
 return Number(n).toString(16); 
}

...