Versions Compared

Key

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

...

To illustrate available fields of application of scripts in Jscript JScript, see the following examples which can be used to create additional functions in the system on the basis of the Script object.

...

The Queue length detection object (is part of the Detector Pack package), Camera and Captioner objects (instead of N, M, L symbols set the corresponding numbers of the Queue length detection, Camera and Captioner objects) are to be created and configured for correct script working in the Intellect software.

...

Settings of the font, color and position of text is configured on the settings panel of the Captioner object.

Info
titleNote.

When page<BEGIN> and page<END> parameters are in use, the corresponding fields of the subtitles database are filled in – this . This enables data search using the Search by titles interface object.

...

The People Counter Detection object (is part of the Detector Pack package), Camera, Captioner and Macro objects (instead of N, M, L, P symbols set the corresponding numbers of the People counter detection, Camera, Captioner and Macro objects) are to be created and configured for correct script working in the Intellect software.

Code Block
languagejavascript
//Event reading and counting of entered people 
if (Event.SourceType == "PEOPLE_COUNTER" && Event.SourceId == "N" && Event.Action == "IN") //N - Number of People Counter detection  
  {
    i = Itv_var("counter_i");
    k = Itv_var("counter_k");  
    i++;  
    Itv_var("counter_i")=i;
//Displaying the number of people by Captioner in the Monitor
     
    DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id<L>"); //M - Number of Camera  L - Number of Captioner
    DoReactStr("CAM","M","ADD_SUBTITLES","command<Number of people (entering/exiting): "+i+" / "+k+"\r>,page<BEGIN>,title_id<L>"); //M, L - the same
      
  }
//Event reading and counting of exitng people
if (Event.SourceType == "PEOPLE_COUNTER" && Event.SourceId == "N" && Event.Action == "OUT") //N - Number of People Counter detection
  {
    i = Itv_var("counter_i");
    k = Itv_var("counter_k"); 
    k++;  
    Itv_var("counter_k")=k;
//Displaying the number of people by Captioner in the Monitor  
   
   DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id<L>"); //M - Number of Camera  L - Number of Captioner
   DoReactStr("CAM","M","ADD_SUBTITLES","command<Number of people (entering/exiting): "+i+" / "+k+"\r>,page<BEGIN>,title_id<L>"); //M, L - the same
  }
//Null the counter by Macro (previously the Macro is to be created in the Intellect)
if (Event.SourceType == "MACRO" && Event.SourceId == "P" && Event.Action == "RUN") //P - Number of Macro
  {
    Itv_var("counter_i")=0;
    Itv_var("counter_k")=0;
    i=0;
    k=0;
//Displaying number of people by Captioner in the Monitor
      
    DoReactStr("CAM","M","CLEAR_SUBTITLES","title_id<L>"); //M - Number of Camera  L - Number of Captioner
    DoReactStr("CAM","M","ADD_SUBTITLES","command<Number of people (entering/exiting): "+i+" / "+k+"\r>,page<BEGIN>,title_id<L>"); //M, L - the same
  }

As a result the text message about number of entering and exiting people will be imposed on the video image while displaying the corresponding camera in the Video Surveillance monitor.

Info
titleNote.

When page<BEGIN> and page<END> parameters are in use, the corresponding fields of the subtitles database are filled in – this . This enables data search using the Search by titles interface object.

Settings of the font, color and position of text is configured on the settings panel of the Captioner object (see the Configuring captions display on a video image section of the Administrator's Guide document).

Previously create the Macro object on the Programming tab to null the counter of visitors. The name of the object can be changed to “Null of people counter” for ease of using.

Macro of setting to zero can be run manually by main menu of the Intellect software package or  or automatically in any specified time (use the Events table on the settings panel of the Macro object where the previously configured Time zone object is to be specified). Detailed information about using the Macro and Time zone objects is given in the Administrator's Guide document).

...

It is possible to select the type of Text displaying while attaching object to the map (see Administrator's Guide, the Attaching objects to the layers of interactive map section). Also the script on the JScript language can be used for changing the displayed text.

...

Example. When the button is clicked on the control panel, display corresponding camera in the active monitor. The script is to timer trigger with ID=1.  

Info
titleNote.

The Timer object is to be created and configured beforehand and the current year is to be set. Information on how to configure the Timer object can be found in Creating and configuring the Timer object section of Administrator's Guide.

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.

...

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

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

Example 7. Using START and STOP events for the Failover Service

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.

...

Using macro 101, create 50 users in Intellect with IDs from 100 to 150, assigning them an access level with ID 1 (provided that the AL is assigned to the department to which the users are added and users inherit the department AL) and linking an access card with a number, equal to the user ID. The card number must be in HEX format. The department should have no more than 30 users (to speed up the adding process).

Info
titleNote.

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

If an ACS integration is configured in Intellect, 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
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); 
}

Example 11. Changing the status of the event in the Incident manager

When working with objects in the Incident manager, it is possible to change the event status of an object (see Processing events). To change the event status of an object, you can use a JScript script.

Example. On macro 3, change the status of the Alarm event of the camera 1 or 2 to Completed. 

Code Block
if (Event.SourceType == "MACRO" && Event.SourceId == 3 && Event.Action == "RUN")
 {
    DoReactStr("INC_SERVER","1","UPDATE_STATUS","status<3>,objtypes<CAM>,objids<1|2>,actions<MD_START|MD_START>");
 };