Go to documentation repository
Page History
...
Section | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
To illustrate available fields of application of scripts in Jscript see the following examples which can be used to create additional functions in the system on the basis of the Script object.
...
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
...
Failover
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 |
---|
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,""); } } } |
Example 8. Using the embedded visitors counter on Bosch FLEXIDOME IP dynamic 7000 VR IP camera
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 |
---|
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","");
}
} |
Overview
Content Tools