Go to documentation repository
Page History
...
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 Failove
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,"");
}
}
} |
Overview
Content Tools