Go to documentation repository
This script determines the current state of the relay on the Agent Of of Control side. Also, when the GET_OBJECT_STATE event is received, this script generates the OBJECT_STATE_INFO event (for details, see Configuring alarms for monitoring object's state on the Agent Of of Control side). Using the card parameter from the Agent Of of Control, it is possible to transfer any additional information to the Server Of of Control. This information will be displayed in the Event Loglog (see Event log).
| Code Block | ||
|---|---|---|
| ||
function GetReleStateMsg(type, id, action, card)
{
var state = GetObjectState("GRELE","1");
var msg = CreateMsg();
msg.SourceType = type;
msg.SourceId = id;
msg.Action = action;
msg.SetParam("state",(state=="OFF")?"DISARMED":"ARMED");
msg.SetParam("card",card);
return msg;
}
if(Event.SourceType=="VIDEOSRV_C" && Event.SourceId=="1" && Event.Action=="GET_OBJECT_STATE")
{
NotifyEvent(GetReleStateMsg(Event.SourceType, Event.SourceId,"OBJECT_STATE_INFO",""));
}
else if(Event.SourceType=="GRELE" && (Event.Action=="ON" || Event.Action=="OFF"))
{
NotifyEvent(GetReleStateMsg("VIDEOSRV_C", "1","OBJECT_STATE_INFO",""));
} |
...