Programming Guide (JScript)



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

17
"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","REC","");
The param argument can take the following values: Type – String, range – available parameters of the specified action. The value argument can take the following values: Type – 
String, range – depends on the parameter.
For all reactions it is possible to specify delay of reaction performing using delay<> parameter. Delay is specified in seconds.
Usage examples
Problem. When an alarm is received from a camera, switch Monitor 1 to single window mode and show the video from the alarmed camera in this window.
 if (Event.SourceType == "CAM" &&  Event.Action == "MD_START")
{
  var camid = Event.SourceId;
  DoReactStr("MONITOR","1","ACTIVATE_CAM","cam<"+ camid +">");
  DoReactStr("MONITOR","1","KEY_PRESSED","key");
}
Problem. When alarm by some camera is completed the record is to be continued for 5 second and after this time the record will be stopped (analogue of Post-record mode).
if (Event.SourceType == "CAM" &&  Event.Action == "MD_STOP")
{
    var camid = Event.SourceId;
    DoReactStr("CAM",camid,"REC_STOP","delay<5>");
}
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


18
Problem. Use macros 1 to enable telemetry control using mouse on the camera 4 displayed in the monitor 10. Use macros 2 to disable it.
if (Event.SourceType == "MACRO" &&  Event.Action == "RUN" &&  Event.SourceId == "1")
{
    DoReactStr("MONITOR","10","CONTROL_TELEMETRY","cam<4>,on<1>");
}
if (Event.SourceType == "MACRO" &&  Event.Action == "RUN" &&  Event.SourceId == "2")
{
    DoReactStr("MONITOR","10","CONTROL_TELEMETRY","cam<4>,on<0>");
}
The DoReact method
The DoReact method generates actions for the objects. It sends the action to the specified object. The action is transferred directly to the kernel where the object belongs, and not to 
the whole system. The action is specified using the MsgObject object.
Method call syntax
 function  DoReact(msgevent : MsgObject)
Method arguments:
msgevent - Required argument. The action sent to the specified object. It takes the following values:  MsgObject objects created earlier in the script.
Usage examples
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


19
1.  
2.  
3.  
Problem. When Relay 1 closes, close Relays 2 and 3. When Relay 1 opens, open Relay 2.
 if (Event.SourceType == "GRELE" && Event.SourceId == "1")
{
  var msgevent = Event.Clone();
  if(Event.Action == "ON")
  {
    msgevent.SourceId = "2";
    DoReact(msgevent);
    msgevent.SourceId = "3";
    DoReact(msgevent);
  }
  if(Event.Action == "OFF")
  {
    msgevent.SourceId = "2";
    DoReact(msgevent);
  }
}
The DoReactSetupCore method
The DoReactSetupCore method is used for changing the parameters of the object. It changes only the specified parameters, leaving other parameters intact.
Method call syntax
 function  DoReactSetupCore(objtype : String,  id : String, param  [, param] : String )
Method arguments
objtype - Required argument. The type of the object whose parameters are to be changed. 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.
param - Required argument. Several arguments of this type can be specified. The parameters of the action.
One parameter has the following syntax:
“param”, where
param – name of the parameter;


20
1.  
2.  
3.  
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: Type – String, range – available parameters of the specified action. The value argument can take the following values: Type – 
String, range – depends on the parameter.
Usage examples
Problem. When Macro 1 starts, set the values of the following parameters of Cameras №1-4: PTZ device number (telemetry_id) and synchronous microphone number (audio_id). The 
values should be equal to the camera numbers plus 1.
 if (Event.SourceType == "MACRO" && Event.SourceId == "1" && Event.Action == "RUN")
{
  var i;
  for(i=1; i<=4; i=i+1)
  {
    DoReactSetupCore ("CAM", i, "telemetry_id<" + (i+1) +">,audio_id<" + (i+1) + ">");
  }
}
The DoReactSetup method
The DoReactSetup method is used for temporary changing parameters of the object. It changes only the specified parameters, leaving other parameters intact.
Method call syntax
function  DoReactSetup (objtype : String,  id : String, param  [, param] : String )
Method arguments:
objtype - required argument. The type of the object the parameters of which are to be changed. 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 objects of the specified type.
param - required argument. Several arguments of this type can be specified. The parameters of the action.
One parameter has the following syntax:


Yüklə 6,96 Mb.

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