Documentation for Monitoring PSIM 1.0 (english)

Previous page Sample scripts for the special mode of Monitoring PSIM operation with ACFA PSIM  Sample scripts for determining the current state of the zones of the Apollo object on the Agent of Control side Next page

This script records the users from the Server of Control side into the Apollo integration module, which is installed on the Agent of Control side.

Attention!

The configuration guide for the Apollo integration module is available in the documentation for ACFA PSIM. This script can be modified for any other integration module that supports user entry into the controller.

function SetPersons(srcDepartment, destTable, destTableSize, msg)
{
	var users = CreateMsg();
	users.StringToMsg(GetObjectIds("PERSON"));
	var userCount = users.GetParam("id.count");
	var i;
	var index;
	for(i = 0, index = 1; (index <= destTableSize) && (i < userCount); ++i)
	{
		var user = users.GetParam("id." + i);
		if(GetObjectParentId("PERSON", user, "DEPARTMENT") == srcDepartment)
		{
			msg.SetParam("USERS.user_id." + Itv_var("counter"), user);
			msg.SetParam("USERS.number." + Itv_var("counter"), index);
			msg.SetParam("USERS.key_type." + Itv_var("counter"), destTable);
			index++;
			Lock(); 
            Itv_var("counter")++;
			Unlock();
		}
	}
}
if(Event.SourceType == "VIDEOSRV_C" && Event.Action == "SPR_DATA_UPDATED")
{
	var APOLLO_TYPE = "APOLLO_DEVICE";
	var APOLLO_ID = "1.1";
	var WRITE_CONFIG_REACT = "WRITE_CONFIG"; 
    Itv_var("counter") = 0;
	var msg = CreateMsg();
	msg.SourceType = "CORE";
	msg.SourceId = "";
	msg.Action = "UPDATE_OBJECT";
	msg.SetParam("objtype", APOLLO_TYPE);
	msg.SetParam("objid", APOLLO_ID);
	var type = GetObjectParam(APOLLO_TYPE, APOLLO_ID, "type");
	if(type == "A6")
	{
		SetPersons("1", "USER", 79, msg);
	}
	else
	{
		SetPersons("1", "USER", 255, msg);
	}
	SetPersons("2", "POLICE", 15, msg);
	SetPersons("3", "ELECTRIC", 15, msg);

	msg.SetParam("USERS.user_id.count", Itv_var("counter"));
	msg.SetParam("USERS.number.count",  Itv_var("counter"));
	msg.SetParam("USERS.key_type.count",  Itv_var("counter"));
	NotifyEvent(msg);
	NotifyEventStr(APOLLO_TYPE, APOLLO_ID, WRITE_CONFIG_REACT, "");
}
  • No labels