Programming Guide (JScript)



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

21
“param”, where
param – name of the parameter;
value – value of the parameter.
Several parameters have the following syntax:
“param1,param2…”.
Elements of the list are separated by commas with no white space.
The param argument can take the following values: values of the String type, range is limited by available parameters of the specified action. The “value” argument can take the 
following values: values of the String type, the range depends on the parameter.
Example. When Macro 1 starts, temporary remove all cameras on the first monitor.
 if (Event.SourceType == "MACRO" && Event.SourceId == "1" && Event.Action == "RUN")
{
DoReactSetup ("MONITOR","1","REMOVE_ALL","");
}
The DoReactGlobal method
The DoReactGlobal method is used to generate object reactions. The DoReactGlobal method transmits a reaction to the required object. The reaction is transmitted not only to the 
kernel, where the object is registered, but to the whole system. For the DoReactGlobal method the reaction is specified by the MsgObject object.
Method call syntax
 function  DoReactGlobal(msgevent : MsgObject)
Method arguments:
msgevent - required argument. It sets a reaction transmitted to the required object. It takes the following values: MsgObject objects created earlier in the script.  
Example. When macro 2 starts, guard on Sensor 2. The command is to be transmitted to all system kernels as the reaction to be registered in the Events Log.
 if (Event.SourceType == "MACRO"&& Event.SourceId == "2" && Event.Action == "RUN")
{
var msgevent = CreateMsg();


22
1.  
2.  
3.  
4.  
msgevent.SourceType = "GRAY";
msgevent.SourceId = "2";
msgevent.Action = "ARM";
DoReactGlobal(msgevent);
}
The NotifyEventStr method
The NotifyEventStr method generates system events. Events are sent to all kernels connected to the local kernel. An event is specified as a group of String arguments.
Method call syntax
 function  NotifyEventStr(objtype : String, id  : String, event : String, param  [, param] : 
String )
Method arguments:
objtype - Required argument. The type of the object that the event should be generated for. It 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 argument. It takes the following values:  Type – String, range – existing identification 
numbers of the object of the specified type.
event - Required argument. The event to be generated. It takes the following values:  Type – String, range – available events for the objects of the specified type.
param - Required argument. Several arguments of this type can be specified. The parameters of the event.
One parameter has the following syntax:
"param", where
param – name of the parameter;
value – value of the parameter.
Several parameters have the following syntax:
"param1,param2…".
Elements of the list are separated by commas with no white space. If no parameters need to be specified, an empty string is used:
DoReactStr("CAM","1","MD_START","");


23
The param argument can take the following values: Type – String, range – available parameters of the event. The value argument can take the following values: Type – String, range 
– depends on the parameter.
Usage examples
Problem. When an alarm is received, send the “panic lock” event corresponding to the camera region. For camera identification numbers from 1 to 4, use region 1; for camera numbers 
from 5 to 10, use region 2.
 if (Event.SourceType == "CAM" && Event.Action == "MD_START")
{
  var regionid;
  if (Event.SourceId <=4)
  {
    regionid = "1";
  }
  if ((Event.SourceId > 4) &&  (Event.SourceId <= 10))
  {
    regionid = "2";
  }
  NotifyEventStr("REGION", regionid, "PANIC_LOCK", "");
}
The NotifyEvent method
The NotifyEvent method generates system events. The event is sent to all kernels connected to the local kernel. The event is specified using the MsgObject object.
Method call syntax
function  NotifyEvent(msgevent : MsgObject)
Note
Two types of system messages are available in the Intellect system: events and actions.
The events usually contain some information and are used as notifications sent to all Intellect kernels connected to each other during the system setup.
The actions are the control commands sent to specific objects. An action is transmitted only to the kernel where the related object belongs, and not to the whole system.
The 
 and 
 methods are used to generate actions. The 
 and 
 methods are used to generate events.
DoReactStr
DoReact
NotifyEventStr
NotifyEvent


24
Method arguments:
msgevent - Required argument. The event sent to the system. It takes the following values:  MsgObject objects created earlier in the script.
Example. When the Backup Archive 1 module starts archiving video recordings, the analog output 1 of the Video Capture Device 2 is disabled. Send the command as an event to be 
registered in the Events Log.
 if (Event.SourceType == "ARCH" && Event.SourceId == "1" && Event.Action == "ACTIVE ")
{
  var msgevent = CreateMsg();
  msgevent.SourceType = " GRABBER ";
  msgevent.SourceId = "2";
  msgevent.Action = "MUX1_OFF";
  NotifyEvent(msgevent);
}
The NotifyEventGlobal method
The NotifyEventGlobal method is used to generate system events. The generated event is transmitted to all system kernels connected via the net. For the NotifyEventGlobal method 
the event is specified using the MsgObject object.
Method call syntax
Note
Two types of system messages are available in Intellect system: events and reactions.
The events usually contain some information and are used as notifications sent to all Intellect kernels connected to each other during the system configuration.
The reactions are the control commands sent to specific objects.
The reactions are transmitted only to the kernel where the object belongs, and not to the whole system.
The 
 and 
 methods are used to generate reactions. The 
 and 
 methods are used to generate events.
DoReactStr
DoReact
NotifyEventStr
NotifyEvent
Note
 While executing this script, the analog output 1 of the Video Capture Device 2 is not disabled


Yüklə 6,96 Mb.

Dostları ilə paylaş:
1   ...   4   5   6   7   8   9   10   11   ...   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ə