Programming Guide (JScript)



Yüklə 6,96 Mb.
Pdf görüntüsü
səhifə5/22
tarix07.11.2018
ölçüsü6,96 Mb.
#78683
1   2   3   4   5   6   7   8   9   ...   22

10
function  Itv_var (globalvar : String) : String
Method arguments:
globalvar - Required argument. The name of the global variable. It takes the following values:  Type – String, satisfying the rules for the names of the string parameters in the 
Windows registry.
Global variables are stored in the Windows registry to maintain their values after Windows restart. All global variables are stored in the registry branch  HKEY_USERS\S-1-5-21-
…\Software\ITVScript\ITVSCRIPT and HKEY_CURRENT_USER\Software\ITVScript\ ITVSCRIPT. To access a global variable directly from the registry, search the registry for it by its 
name.
Usage examples
Problem. When Macro 1 starts, save the value of the bright parameter of Camera 10 to the cam10bright global variable. When Macro 2 starts, set the bright parameter of Cameras 1 to 
4 to the value of the cam10bright global variable.
if (Event.SourceType == "MACRO" && Event.Action == "RUN")
{
  if(Event.SourceId == "1")
  {
    Itv_var("cam10bright") = GetObjectParam("CAM", "10", "bright");
  }
  if (Event.SourceId == "2")
  {
    var cam10bright = Itv_var("cam10bright");
    for(i=1; i<=4; i=i+1)
    {
      SetObjectParam("CAM", i, "bright", cam10bright);
    }
  }
}
The Int_var method
The Int_var method sets and returns values of global variables of integer type.
Attention!


11
1.  
Method call syntax:
function  Int_var (globalvar : String) : int
Method arguments:
globalvar – required argument. The name of the global variable. It takes the following values: type – String, satisfying the rules for the names of the string parameters  in the 
Windows registry.
Usage examples. To check the method operation in the following test example the value 1 sets to the "2" global variable and then increases per 1 and displays on the script debug 
window. 
if(Event.Action =="RUN")
{
    Int_var(2) = 1;
    Int_var("2")++;
    DebugLogString(Int_var("2").toString());
}
The GetObjectParentType method
The GetObjectParentType method returns the type of the parent object of the current object according to the object hierarchy.          
Method call syntax
function  GetObjectParentType (objtype : String) : String
Method arguments:
The Int_var method uses the same storage as 
, but modify the type of variable to the integer type.
the Itv_var method
Note.
Global variables are stored in the system registry to maintain their values after Windows restart. All global variables are stored in the registry branch HKEY_USERS\S-1-5-21-
…\Software\ITVScript\ITVSCRIPT and HKEY_CURRENT_USER\Software\ITVScript\ ITVSCRIPT. To access a global variable directly from the registry, search the registry for it 
by the same name.


12
1.  
2.  
objtype - Required argument. The type of the object whose parent’s type should be returned. It takes the following values:  Type – String, range – existing object types.
The Main object is the highest level object in the hierarchy. It is the parent for all objects of the Computer, Screen, and other types.
Usage examples
Problem. When Macro 1 starts, display in the debugger window the names of four object types of higher hierarchical order starting from the detection zone.
if (Event.SourceType == "MACRO" && Event.SourceId == "1" && Event.Action == "RUN")
{
  var objtype = "CAM_ZONE";
  DebugLogString(objtype);
  for(var i = 1; i<=4; i=i+1)
  {
    objtype = GetObjectParentType(objtype);
    DebugLogString(objtype);
  }
}
The GetIPAddress method
The GetIPAddress method returns the IP-address of the Intellect kernel according to current video surveillance system architecture.
Method call syntax
function  GetIPAddress (dst : String, src : String) : String
Method arguments:
dst - Required argument. The name of the remote computer where the Intellect kernel is installed. The value of dst should correspond to one of the names of the computers 
registered during setup of the video surveillance system.  It takes the following values:  Type – String, meeting the requirements for network computer names; range – 
computer names existing in the system.
src - Required argument. The name of the local computer where the script executes. The value of src should match the name of the local computer as it is registered in 
Intellect.  It takes the following values:  Type – String; meeting the requirements for network computer names.
The information about all connections of the local computer (kernel) to other remote computers (kernels) registered during the setup of the distributed architecture, is displayed in the 
 tab of the 
 window.
Architecture
System Settings
Usage examples


13
1.  
2.  
Problem. Upon a camera alarm, determine the name of the server this camera is connected to, and output the IP-address of the connection between this server and the local computer 
where the script executes, to the debugger window.
if (Event.SourceType == "CAM" && Event.Action == "MD_START")
{
  var camid = Event.SourceId;
  var compname = GetObjectParentId("CAM", camid, "COMPUTER");
  var ip = GetIPAddress("WS1","WS1"); \\if the script is run on the computer where kernel of  Intellect  
software has been installed
  DebugLogString("IP-address of the alarmed camera computer" + ip);
}
The GetObjectName method
The GetObjectName method returns the name of the object that it was given upon creation.
Method call syntax
function  GetObjectName(objtype : String, id : String) : String
Method arguments:
objtype - Required argument. The type of the object whose name is to be returned. It takes the following values:  Type – String, range – existing object types.
id - Required argument. Identification number of the object of the type set in the objtype parameter. It takes the following values:  Type – String, range – existing object 
identification numbers of the specified type.
Usage examples
Problem. In case of alarm in any sensor, open the information window with the following text - "Alarm in the sensor connected to the sensor is connected to> server”.
if (Event.SourceType == "GRAY" && Event.Action == "ALARM")
{
Note
Create the information dialog window beforehand using the Arpedit.exe utility and save it as test.dlg in the \Program folder.


Yüklə 6,96 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   ...   22




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə