Versions Compared

Key

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

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

Note
titleAttention!

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


Info
titleNote

For details, see Configuring the special mode of Monitoring operation with ACFA Intellect.


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." + 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 ROVALANT_TYPE = "ROVALANT_DEVICE";
	var ROVALANT_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", ROVALANT_TYPE);
	msg.SetParam("objid", ROVALANT_ID);
	var type = GetObjectParam(ROVALANT_TYPE, ROVALANT_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(ROVALANT_TYPE, ROVALANT_ID, WRITE_CONFIG_REACT, "");
}