Versions Compared

Key

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

This script records the users from the Server Of of Control side into the Rovalant (A6, A16) FSA Apollo integration module, which is installed on the Agent Of of Control side.

Note
titleAttention!

The configuration guide for the Rovalant (A6, A16) Apollo integration module is available only in the Russian documentation for ACFA PSIM. This script can be modified for any other integration module that supports user entry into the controller.

...

Code Block
languagejs
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." + AxxonSoftItv_var("counter"), user);
			msg.SetParam("USERS.number." + AxxonSoftItv_var("counter"), index);
			msg.SetParam("USERS.key_type." + AxxonSoftItv_var("counter"), destTable);
			index++;
			Lock();
			AxxonSoft 
            Itv_var("counter")++;
			Unlock();
		}
	}
}
if(Event.SourceType == "VIDEOSRV_C" && Event.Action == "SPR_DATA_UPDATED")
{
	var ROVALANTAPOLLO_TYPE = "ROVALANTAPOLLO_DEVICE";
	var ROVALANTAPOLLO_ID = "1.1";
	var WRITE_CONFIG_REACT = "WRITE_CONFIG";
	AxxonSoft 
    Itv_var("counter") = 0;
	var msg = CreateMsg();
	msg.SourceType = "CORE";
	msg.SourceId = "";
	msg.Action = "UPDATE_OBJECT";
	msg.SetParam("objtype", ROVALANTAPOLLO_TYPE);
	msg.SetParam("objid", ROVALANTAPOLLO_ID);
	var type = GetObjectParam(ROVALANTAPOLLO_TYPE, ROVALANTAPOLLO_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", AxxonSoftItv_var("counter"));
	msg.SetParam("USERS.number.count",  AxxonSoft Itv_var("counter"));
	msg.SetParam("USERS.key_type.count",  AxxonSoft Itv_var("counter"));
	NotifyEvent(msg);
	NotifyEventStr(ROVALANTAPOLLO_TYPE, ROVALANTAPOLLO_ID, WRITE_CONFIG_REACT, "");
}

...