Programming Guide (JScript)



Yüklə 6,96 Mb.
Pdf görüntüsü
səhifə13/22
tarix07.11.2018
ölçüsü6,96 Mb.
#78683
1   ...   9   10   11   12   13   14   15   16   ...   22

43
“param1,param2…”, where
param1,param2 - list of parameters and their values. Elements of the list are separated by commas with no white space. If no parameters need to be specified, 
an empty string is used after the vertical line (|), for example:
“CAM|1|MD_START|”
Usage examples
Example. Upon registration the connection (“Attach”) event for any camera, in the system retrigger the “Attach” event with modified 
 (telemetry_id) and 
Number of the PTZ device
N
 (audio_id) parameters.  The values should be equal to the corresponding  camera numbers plus 1.
umber of the microphone for  synchronous recoeding
if (Event.SourceType == "CAM" && Event.Action == "ATTACH") 
 {
var i;
for (i=1,i<=4;i=i+1)
{
 var msg = Event.Clone(); 
 var str = "telemetry_id<" + (i+1) +">,audio_id<" + (i+1) + ">"; 
 msg.StringToParams(str); 
 NotifyEvent(msg); 
 }

The Clone method
The Clone method creates a copy of an 
 or
 object.
MsgObject
 Event
Method call syntax
Clone() : MsgObject
Method arguments: no arguments.
Usage examples
Problem. When Relay №1 closes, start video recording from Camera 1 and close Relay №2. When Relay №1  opens, start video recording from Camera 2 and open Relay №2.


44
 if (Event.SourceType == "GRELE" && Event.SourceId == "1")
{
  var msgevent = Event.Clone();
  if(Event.Action == "ON")
  {
    msgevent.SourceId = "2";
    DoReact(msgevent);
    DoReactStr("CAM","1","REC","");
DoReactStr("GRELE","2","ON","");
 
  }
  if(Event.Action == "OFF")
  {
    msgevent.SourceId = "2";
    DoReact(msgevent);
    DoReactStr("CAM","2","REC","");
DoReactStr("GRELE","2","OFF","");
 
  }
}
The GetObjectIds method
GetObjectIds  method is responsible for receiving identifiers from all the objects of a specified type.
Method call syntax:
 function GetObjectIds(objectType : String)
A line is replied :
CAM||COUNT|id.3<5>,id.count<4>,id.0<2>,id.1<3>,id.2<4>
where 
 – number of  ID objects,
 id.count<>
       
 – ID object.
id.[count]<>
Method’s arguments:


45
1.  
2.  
objectType  required argument. Set the type of the system object, for which   the value of the given parameter should be given back ("CAM","GRAY","GRABBER" e.t.c.).Accepted 

values: type String, range is restricted by object types  registered in the system.
Example. All the cameras should be armed upon the start of Macros№1.
 if (Event.SourceType == "MACRO" && Event.SourceId && Event.Action == "RUN")
{
var msg = CreateMsg();
msg.StringToMsg(GetObjectIds("CAM"));
var objCount = msg.GetParam("id.count");
var i;
for(i = 0; i < objCount; i++)
{
DoReactStr("CAM", msg.GetParam("id." + i), "ARM", "");
}
}
The GetObjectParams method
GetObjectParams method is designed for getting the object’s parameters.
Method call syntax:
 function GetObjectParams(objectType : String, objectId : String)
Method arguments:
objectType – required argument. Set the type of the system object ("CAM", "GRAY", "GRABBER" e.t.c.), for which the type of a parent object should be given back. Accepted 
values: type String, range is restricted by object types  registered in the system.
objectId – object’s identifier. Accepted values: String type.
Example. It is necessary to check the color control of camera №2  upon the start of Macros№1. If camera 2 is a color one, set it to recording.
 if (Event.SourceType == "MACRO" && Event.SourceId && Event.Action == "RUN")
{
var msg = CreateMsg();
msg.StringToMsg(GetObjectParams("CAM", "2"));


46
if(msg.GetParam("color") == "1")
{
DoReactStr("CAM", "2", "REC", "");
}
}
The SourceType property
The SourceType property stores the system type of the 
 or 
 object.
MsgObject
Event
Property call syntax
 SourceType : String
Usage examples
Problem. When Relay 1 closes (for example, the button connected to the relay is pressed), print the frames from Cameras 1 and 2.
 if (Event.SourceType == "GRELE" && Event.SourceId == "1" && Event.Action == "ON")
{
  //activating the Camera 1 window
  DoReactStr("MONITOR","1","ACTIVATE_CAM", "cam<1>");  
  //printing the frame from Camera 1
  DoReactStr("MONITOR","1","KEY_PRESSED","key
");
  //activating the Camera 2 window
  DoReactStr("MONITOR","1","ACTIVATE_CAM", "cam<2>");
  //printing the frame from Camera 2
  DoReactStr("MONITOR","1","KEY_PRESSED","key
");
}
The SourceId property
The SourceType property stores the identification number of the 
 or 
 object.
MsgObject
Event
Property call syntax


47
 SourceId : String
Usage examples
See the example for the 
.
 
SourceType property
The Action property
The Action property stores the action or event of the 
 or 
 object.
MsgObject
Event
Property call syntax
 SourceId : String
Usage examples
See the example for the 
.
SourceType property
 
Programming tools
The Script object
The 
 object is designed for initializing and setting the parameters of JScript scripts in Intellect system.
Script
Figure shows the settings panel for the 
 object.
Script


Yüklə 6,96 Mb.

Dostları ilə paylaş:
1   ...   9   10   11   12   13   14   15   16   ...   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ə