Programming Guide
Programming Guide
1
1.3.3 Creating your first script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
1.3.4 Working with script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
[Link] Creating a script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
[Link] Saving a script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
[Link] Deleting a script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
[Link] Searching text in script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
[Link] Replacing text in script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
1.3.5 Script debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
[Link] Script debugging features . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
[Link] Creating and using test events . . . . . . . . . . . . . . . . . . . . . . . 118
[Link] Working with the debugging windows of the Editor-Debugger utility
120
[Link].1 Viewing the script messages . . . . . . . . . . . . . . . . . . . . . . 121
[Link].2 Displaying messages about starting, verifying, changing and
executing scripts in the debugging windows . . . . . . . . . . . . . . . . . . 123
[Link] Using third-party debugger programs . . . . . . . . . . . . . . . . . . . 125
1.3.6 Examples of scripts in the JScript language . . . . . . . . . . . . . . . . . . 126
[Link] Examples of scripts with Video surveillance monitor and Cameras . 1
27
[Link] Examples of scripts with Map . . . . . . . . . . . . . . . . . . . . . . . . 131
[Link] Examples of scripts with detection tools . . . . . . . . . . . . . . . . . 132
[Link] Examples of scripts with Macros . . . . . . . . . . . . . . . . . . . . . . 133
[Link] Example of script with Users . . . . . . . . . . . . . . . . . . . . . . . . . 135
[Link] Examples of scripts with Incident server and Incident manager . 137
[Link] Example of script with Failover service . . . . . . . . . . . . . . . . . . 138
[Link] Examples of scripts with BacNet . . . . . . . . . . . . . . . . . . . . . . 139
[Link] Example with Telegram bot . . . . . . . . . . . . . . . . . . . . . . . . . . 141
[Link] Examples of scripts with Event Viewer . . . . . . . . . . . . . . . . . 142
1.3.7 Appendix 1. Description of the Editor-Debugger utility . . . . . . . . . . 143
[Link] The purpose of the Editor-Debugger utility . . . . . . . . . . . . . . . 144
[Link] The interface of the Editor-Debugger utility . . . . . . . . . . . . . . . 145
[Link].1 The Editor-Debugger interface . . . . . . . . . . . . . . . . . . . . 146
[Link].2 The Debug-edit script tab . . . . . . . . . . . . . . . . . . . . . . . . 147
[Link].3 The Script messages tab . . . . . . . . . . . . . . . . . . . . . . . . 149
[Link].4 Main menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
[Link].5 Description of the Filter dialog window . . . . . . . . . . . . . . . 158
[Link].6 Description of the Highlight dialog window . . . . . . . . . . . . 159
[Link].7 Description of the toolbar of the Editor-Debugger utility . . 161
1.3.8 Appendix 2. Creating custom objects with ability to set events, reactions
and states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
[Link] Purpose of custom objects and their implementation in Axxon PSIM
163
[Link] How to create a custom object . . . . . . . . . . . . . . . . . . . . . . . 164
[Link].1 DBI file preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
[Link].2 DDI file preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
[Link].3 XML file preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
[Link].4 Creating and using a custom object in Axxon PSIM . . . . . . 170
1.4 Description of events and reactions of system objects . . . . . . . . . . . . . . 173
1.4.1 GRABBER Video capture device . . . . . . . . . . . . . . . . . . . . . . . . . . 174
1.4.2 CAM Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
2
1.4.3 MONITOR Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
1.4.4 MACRO Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
1.4.5 SLAVE Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
1.4.6 DISPLAY Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
1.4.7 PLAYER Audio player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
1.4.8 CORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
1.4.9 MAP Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
1.4.10 OLXA_LINE Microphone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
1.4.11 TELEMETRY PTZ device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
1.4.12 TELEMETRY_EXT Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
1.4.13 JOYSTICK Control device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
1.4.14 TIME_ZONE Time zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
1.4.15 ARCH Backup archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
1.4.16 FAILOVER Failover service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
1.4.17 OPERATORPROTOCOL Operator protocol . . . . . . . . . . . . . . . . . . . 217
1.4.18 EVENT_VIEWER Event Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
1.4.19 GATE Videogate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
1.4.20 CAM_VMDA_DETECTOR VMDA detection . . . . . . . . . . . . . . . . . . . 221
1.4.21 TITLEVIEWER Captions search . . . . . . . . . . . . . . . . . . . . . . . . . . 222
1.4.22 PERSON User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
1.4.23 CAM_FACECAPTURE Face Detection . . . . . . . . . . . . . . . . . . . . . . 224
1.4.24 IPSTORAGE Edge storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
1.4.25 CAM_TITLE Captioner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
1.4.26 TELEGRAM Telegram bot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
1.4.27 CAM_IP_DETECTOR Embedded detection . . . . . . . . . . . . . . . . . . . 228
1.4.28 SIP_TERMINAL SIP-terminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
1.4.29 INC_MANAGER Incident manager . . . . . . . . . . . . . . . . . . . . . . . . 230
1.4.30 INC_SERVER Incident server . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
1.4.31 DIALOG Operator query panel . . . . . . . . . . . . . . . . . . . . . . . . . . 232
1.4.32 MMS Mail Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
1.4.33 MAIL_MESSAGE Mail message . . . . . . . . . . . . . . . . . . . . . . . . . . 234
1.4.34 VMS Voice Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
1.4.35 GRELE Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
1.4.36 GRAY Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
1.4.37 VNS Voice notification service . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
1.4.38 SMS Short Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
1.4.39 SSS_WATCHDOG System restart service . . . . . . . . . . . . . . . . . . . 242
1.4.40 BACNET BacNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
1.5 Description of the object model in Axxon PSIM . . . . . . . . . . . . . . . . . . . 244
1.5.1 The Core object and its built-in methods . . . . . . . . . . . . . . . . . . . . 245
[Link] The Core object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
[Link] The SetObjectParam method . . . . . . . . . . . . . . . . . . . . . . . . . 247
[Link] The SetObjectState method . . . . . . . . . . . . . . . . . . . . . . . . . 248
[Link] The DebugLogString method . . . . . . . . . . . . . . . . . . . . . . . . . 249
[Link] The Base64Decode method . . . . . . . . . . . . . . . . . . . . . . . . . . 250
[Link] The Sleep method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
[Link] The Itv_var method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
[Link] The Int_var method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
[Link] The GetObjectParentType method . . . . . . . . . . . . . . . . . . . . . 254
[Link] The GetIPAddress method . . . . . . . . . . . . . . . . . . . . . . . . . . 255
3
[Link] The GetObjectName method . . . . . . . . . . . . . . . . . .... . . . 256
[Link] The GetObjectState method . . . . . . . . . . . . . . . . . .... . . . 257
[Link] The GetObjectParam method . . . . . . . . . . . . . . . . . .... . . . 258
[Link] The GetObjectParentId method . . . . . . . . . . . . . . . .... . . . 259
[Link] The DoReactStr method . . . . . . . . . . . . . . . . . . . . .... . . . 260
[Link] The DoReact method . . . . . . . . . . . . . . . . . . . . . . .... . . . 262
[Link] The DoReactSetupCore method . . . . . . . . . . . . . . . .... . . . 263
[Link] The DoReactSetup method . . . . . . . . . . . . . . . . . . .... . . . 264
[Link] The DoReactGlobal method . . . . . . . . . . . . . . . . . . .... . . . 265
[Link] The NotifyEventStr method . . . . . . . . . . . . . . . . . . .... . . . 266
[Link] The NotifyEvent method . . . . . . . . . . . . . . . . . . . . .... . . . 267
[Link] The NotifyEventGlobal method . . . . . . . . . . . . . . . . .... . . . 268
[Link] The CreateMsg method . . . . . . . . . . . . . . . . . . . . . .... . . . 269
[Link] The Lock and Unlock methods . . . . . . . . . . . . . . . . .... . . . 270
[Link] The IsAvailableObject method . . . . . . . . . . . . . . . . .... . . . 272
[Link] The GetUserId method . . . . . . . . . . . . . . . . . . . . . .... . . . 273
[Link] The GetEventDescription method . . . . . . . . . . . . . . .... . . . 274
[Link] The GetObjectIdByParam method . . . . . . . . . . . . . .... . . . 275
[Link] The SaveToFile method . . . . . . . . . . . . . . . . . . . . . .... . . . 276
[Link] The GetLinkedObjects method . . . . . . . . . . . . . . . . .... . . . 277
[Link] The WriteIni method . . . . . . . . . . . . . . . . . . . . . . . .... . . . 278
[Link] The ReadIni method . . . . . . . . . . . . . . . . . . . . . . . .... . . . 279
[Link] The AddIni method . . . . . . . . . . . . . . . . . . . . . . . . .... . . . 280
[Link] The SetTimer method . . . . . . . . . . . . . . . . . . . . . . .... . . . 281
[Link] The KillTimer method . . . . . . . . . . . . . . . . . . . . . . .... . . . 282
[Link] The GetObjectChildIds method . . . . . . . . . . . . . . . .... . . . 283
[Link] The Base64EncodeFile method . . . . . . . . . . . . . . . . .... . . . 284
[Link] The Base64EncodeW method . . . . . . . . . . . . . . . . . .... . . . 285
[Link] The run_cmd and run_cmd_timeout methods . . . . . .... . . . 286
[Link] The WriteIniAny method . . . . . . . . . . . . . . . . . . . . .... . . . 287
[Link] The ReadIniAny method . . . . . . . . . . . . . . . . . . . . .... . . . 288
[Link] The AddIniAny method . . . . . . . . . . . . . . . . . . . . . .... . . . 289
1.5.2 The MsgObject and Event objects and their built-in methods and
properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . 290
[Link] The MsgObject and Event objects . . . . . . . . . . . . . . .... . . . 291
[Link] The GetSourceType method . . . . . . . . . . . . . . . . . . .... . . . 292
[Link] The GetSourceId method . . . . . . . . . . . . . . . . . . . . .... . . . 293
[Link] The GetAction method . . . . . . . . . . . . . . . . . . . . . . .... . . . 294
[Link] The GetParam method . . . . . . . . . . . . . . . . . . . . . . .... . . . 295
[Link] The SetParam method . . . . . . . . . . . . . . . . . . . . . . .... . . . 296
[Link] The MsgToString method . . . . . . . . . . . . . . . . . . . . .... . . . 297
[Link] The StringToMsg method . . . . . . . . . . . . . . . . . . . . .... . . . 298
[Link] The StringToParams method . . . . . . . . . . . . . . . . . . .... . . . 299
[Link] The Clone method . . . . . . . . . . . . . . . . . . . . . . . . .... . . . 300
[Link] The GetObjectIds method . . . . . . . . . . . . . . . . . . . .... . . . 301
[Link] The GetObjectParams method . . . . . . . . . . . . . . . . .... . . . 302
[Link] The SourceType property . . . . . . . . . . . . . . . . . . . .... . . . 303
[Link] The SourceId property . . . . . . . . . . . . . . . . . . . . . .... . . . 304
[Link] The Action property . . . . . . . . . . . . . . . . . . . . . . . .... . . . 305
1.6 Programming guide. Conclusion . . . . . . . . . . . . . . . . . . . . . . .... . . . 306
4
Guide for creating scripts (programming)
Guide for creating scripts. Introduction
The Program object. Programming using the embedded language of Axxon PSIM
Programming tools in Axxon PSIM
The Program system object
Debug window
Syntax analyser
Recommended procedure of writing programs
Description of syntax
Description of variables
Description of procedures
Standard procedures
Creating custom procedures
Description of operators
Operators and expressions
Description of functions
Examples of scripts in the embedded language
Examples with Cameras and Video surveillance monitors
Examples with Computer and Display
Examples with Map
Examples with Archive and Edge storage
Examples with Macros and Time zones
Examples with PTZ devices and Control devices
Example with Core
Examples with Incident server and Incident manager
Examples with Operator protocol and Event Viewer
Examples with Operator query panel and SIP-terminal
Examples with Audio
Example with Videogate
Examples with Detection
Example with User
Examples with Captions
Examples with System restart service and Failover service
Example with BacNet
Examples with Relay and Sensors
Examples with Message services and notification services
Appendix 1. Priorities of the start and stop recording commands
Appendix 2. Defining the param_id and param_value values for the SET_IPINT_PARAM reaction
5
Examples of scripts with detection tools
Examples of scripts with Macros
Example of script with Users
Examples of scripts with Incident server and Incident manager
Example of script with Failover service
Examples of scripts with BacNet
Example with Telegram bot
Examples of scripts with Event Viewer
Appendix 1. Description of the Editor-Debugger utility
The purpose of the Editor-Debugger utility
The interface of the Editor-Debugger utility
The Editor-Debugger interface
The Debug-edit script tab
The Script messages tab
Main menu
Description of the Filter dialog window
Description of the Highlight dialog window
Description of the toolbar of the Editor-Debugger utility
Appendix 2. Creating custom objects with ability to set events, reactions and states
Purpose of custom objects and their implementation in Axxon PSIM
How to create a custom object
DBI file preparation
DDI file preparation
XML file preparation
Creating and using a custom object in Axxon PSIM
7
Guide for creating scripts. Introduction
You can use programming with the help of scripts if Axxon PSIM interface settings of objects or Macros capabilities aren’t enough to
implement any operating scenario of Axxon PSIM. For more details about interactions between objects, see the table below.
1. In the embedded programming language. You can use the Program system object of the Programming tab—see The
Program object. Programming using the embedded language of Axxon PSIM.
2. In the JScript language. You can use the Script system object of the Programming tab—see The Script object.
Programming using the JScript language.
Both options work, but the Program object is deprecated and is no longer developed. We recommend using the Script object and the
JScript language to write scripts.
events, reactions and commands of Axxon PSIM objects. The main ones are described in Description of events and reactions of
system objects.
the Core, MsgObject, Event objects and their embedded methods described in Description of the object model in Axxon PSIM.
Setting Basic configuration of interaction Implemented using functionality of system objects—see Axxon Configuring video display
panels of between system objects PSIM configuration and setup from the Camera in the M
system onitor interface window
objects
Macro Configuration of simple Implemented using the Macro object—see Creating and using Enabling actuator (relay)
interactions between objects if macros when sensor is closed
basic object settings are
insufficient
Program Configuration of complex Implemented using the Program object as the code in the Return PTZ cameras to
interactions between objects if embedded programming language of Axxon PSIM—see The their original position and
functionality of the Macro object Program object. Programming using the embedded language of take a photo every 15
is insufficient Axxon PSIM minutes
8
The Program object. Programming using the
embedded language of Axxon PSIM
9
Programming tools in Axxon PSIM
10
The Program system object
The Program system object is used to initialize the program written in the Axxon PSIM programming language in Axxon PSIM and set
its parameters.
The Program system object is created on the basis of the Programs object on the Programming tab of the System settings dialog
window.
Attention!
Creation of more than 100 Program system objects can cause system instability.
See the settings panel of the Program system object in the figure below:
11
On the settings panel of the Program system object, specify the time schedule of program execution and computers (cores) on which
the program must be executed.
Note
To set all checkboxes next to all computers, select a cell in the column with checkboxes and press Ctrl+A. To clear all
checkboxes, select a cell and press Shift+A.
To pre-filter events processed by the program, set the value in the Filter field. The filter format is TYPE|ID|EVENT divided by
semicolon, for example CAM||MD_STOP;CAM||MD_START to filter Alarm and Alarm end events from all Camera objects.
There is the word processor on the settings panel of the Program system object. It is used for writing and editing the program code.
You can undo or redo some action using hotkeys in the word processor on the settings panel of the Program system object. To undo
some action, press Alt+Backspace, to redo, press Ctrl+Y.
12
Debug window
The Debug window is used to view data about all events logged in the system.
You can call the Debug window by using the Debug command in the Run menu on the Main control panel. The Debug window is
displayed at the bottom of the screen.
By default, the Debug window isn't available. You can enable the Debug window by using the [Link] utility (see The Debug
window section of The Script object. Programming using the JScript language).
13
Syntax analyser
Embedded syntax analyser enables spell check of basic registered words, such as OnEvent, DoReact, OnTime, Wait, Sleep, and so on.
These registered words are marked in black in the program text field. Note that the analyser doesn't check if command parameters are
written correctly, so you must be very attentive in these cases.
14
Recommended procedure of writing programs
On the page:
15
Note
If the syntax is correct, but the program still doesn't work or works with errors, we recommend rewriting the program as a
script in JScript (see The Script object. Programming using the JScript language).
16
Description of syntax
Script consists of the set of procedures.
If you want to write a comment, you need to put reserved characters // before the comment.
17
Description of variables
All variables in the system are string variables.
To compare string variables and values, use the bool strequal (string1,string2) function. The strequal function returns the nonzero
value if strings are equal (see Description of functions).
18
Description of procedures
19
Standard procedures
There are three standard procedures that can be performed when the corresponding event occurs:
1. OnInit()—used for initialization of variables (setting initial values) that will be used in scripts. It is executed before starting all
modules of the system. We recommend calling the procedure once for all scripts.
Example of use:
OnInit(){
flag=1;
num=8; //variables will be initialized at startup
}
OnTime(W,D,X,Y,H,C,S)
{
//W - DOW (0 - Monday, 6 - Sunday);
//D - date in the day-month-year format, 16 August 2001 is "16-08-01"
//X,Y - reserved
//H - hour
//C - minutes
//S - seconds
// COMPARING WITH PARAMETERS, THE ACTION IS SPECIFIED FURTHER
}
Examples of use:
OnTime(W,"16-08-01",X,Y,"11","11","30")
{
//the code will be executed on 16 August, 2001 at 11:11:30
}
OnTime(W,D,X,Y,"11","11","30")
{
//the code will be executed every day at 11:11:30
}
OnTime(W,"16-08-01",X,Y,H,C,S)
{
//the code will be executed on 16 August, 2001
//every second
}
OnTime(W,"16-08-01",X,Y,"11","11",S)
{
//the code will be executed on 16 August, 2001
//every second from 11:11 to 11:12
}
OnTime("0",D,X,Y,"21","0","0")
{
//the code will be executed every Monday
// at 21:00:00
}
3.
20
3. OnEvent(source type, number,event)—running if there is a specific event from the system object. This is the main procedure
when writing scripts.
Examples of use:
OnEvent("GRAY","1","ON")
{
//will be executed when closing sensor 1
}
OnEvent("CAM","12","MD_START")
{
//will be executed when motion detection tool of camera 12 triggers
}
Each procedure that has parameters can be seen in a code many times with various parameters. When an event occurs, the system
will execute those of them that have the same parameters as one that has occurred.
The procedure parameter can be defined or not. If it is defined, then its value is in quotes, otherwise the parameter is written in Latin
letters and the procedure will be executed for all events for which it can be defined.
Examples of use:
21
Creating custom procedures
All custom procedures described in the script must be in the same program body and before procedures in which they are called.
Attention!
Examples of use:
procedure ProcedureName(A,B)
{
n=A+" "+B;
//when running macro 1 n=«Macro 1», when running macro 16 n=«Macro 16»
}
OnEvent("MACRO",N,"RUN")
{
a1=N;
a2="Macro";
ProcedureName(a2,a1);
}
22
Description of operators
The list of operators used to describe actions:
OnEvent("GRAY","1","ON")
{
DoReact("GRELE","1","ON"); //close relay 1 when closing sensor 1
}
OnEvent("GRAY","1","ON")
{
DoCommand("[Link]"); //when sensor 1 is closed, run "Notepad"
}
OnEvent("GRAY","1","ON")
{
[
DoReact("GRELE","1","ON");
Wait(5);
DoReact("GRELE","1","OFF");
]
}
OnEvent("GRAY","1","ON")
{
if(CheckState("CAM","2","ALARMED"))
{
DoReact("GRELE","1","ON");
}
}
5. Conditional operator:
If (expression)
{
... // if the result is not equal to 0
}
else
{
... // if the result is equal to 0
}
23
OnEvent("MACRO","1","RUN"){
x=5;
if(x>10) {y=2;} // if "x" is greater than 10, then y=2
else {y=3;} //otherwise y=3
}
6. For operator:
Expression1 is executed at the beginning of the loop; loop body is executed if expression2 is true; expression3 is executed
after each execution of the loop body.
Example. When sensor1 is closed, relay1 is closed and opened every second and it will happen 10 times.
OnEvent
("GRAY","1","ON")
{
[
for(i=0;i<10;i=str(i+1))
{
DoReact("GRELE","1","ON");
Wait(1);
DoReact("GRELE","1","OFF");
Wait(1);
}
]
}
7. DoReactGlobal(object type, number, state)—function that creates reactions of system objects. Meanwhile, the created
reaction is sent to all cores connected over the network.
Example. When running macro 1, camera 1 is armed.
OnEvent("MACRO","1","RUN")
{
DoReactGlobal("CAM","1","ARM");
}
8. NotifyEventGlobal(object type, number, state)—function that creates system events. Meanwhile, the created events are sent
to all cores connected over the network.
Example. When running macro 1, create event “Recording” for camera 1. The command is sent to all cores as an event in order
to be logged.
OnEvent("MACRO","1","RUN")
{
NotifyEventGlobal("CAM","1","REC");
}
Note
If there is no need to send event to all system cores, then use the NotifyEvent function.
24
Operators and expressions
The table below lists and describes comparison, arithmetic and conditional operators.
Comparison operators
Arithmetic operators
OnEvent ("MACRO","1","RUN")
{
x=5;
y=10;
i=x+y; // add strings, i.e. 5+10=510
e=str(x+y); // add integers 5+10=15
}
OnEvent ("MACRO","1","RUN")
{
x=5;
y=10;
i=x-y; // subtract integers 5-10=-5
e=str(x-y); // subtract integers 5-10=-5
}
OnEvent ("MACRO","1","RUN")
{
x=5;
y=10;
i=x*y; // multiply integers 5*10=50
e=str(x*y); // multiply integers 5*10=50
}
OnEvent ("MACRO","1","RUN")
{
x=5;
y=10;
i=x/y; // divide integers 5/10=0.5
e=str(x/y); // divide integers 5/10=0.5
}
25
% Remainder after integer division. Example of use.
OnEvent ("MACRO","1","RUN")
{
a=1120.0;
b=100;
e=a%b; // remainder after integer division, i.e 1100 is divided by 100 and 20 is remainder.
// if there is division without remainder, then result is 0
}
OnEvent ("MACRO","1","RUN")
{
x=100/((5*8)/1.028);
}
Logical operators
OnEvent ("MACRO","1","RUN")
{
a=1;
b=2;
z=3;
if((a<b)&&(b<z))
{
y=1; //if false, then else
}
else
{
x=0;
}
}
OnEvent ("CAM",N,"MD_START")
{
if(!(strequal(N,"1",)))
{
DoReact("GRELE","1",""ON)
}
else
{
DoReact("GRELE","2",""ON)
}
}
26
Description of functions
General description and examples of use of math functions, conversion functions, as well as format functions and string functions are
represented in the table.
MATH
Example:
y=sin(1.6)
Event received:
Example:
y=cos(2.2)
Event received:
Example:
y=tan(1)
Event received:
Example:
y=asin(0.5)
Event received:
27
acos[1] Returns the arc cosine of the specified numeric expression.
Example:
y=acos(0.55)
Event received:
Example:
y=atan(1.2)
Event received:
sinh[1] The sinh function returns hyperbolic sine of the argument value.
Example:
y=sinh(0.8)
Event received:
cosh[1] The cosh function returns hyperbolic cosine of the argument value.
Example:
y=cosh(0.35)
Event received:
Example:
y=tanh(0.35)
Event received:
28
exp[1] Returns the value of the e^x function, where x—specified numeric expression.
Example:
y=exp(1.65)
Event received:
log[1] Returns the natural logarithm (base-e) of the specified numeric expression.
Example:
y=log(0.65)
Event received:
log10[1] Returns the common logarithm (base-10) of the specified numeric expression.
Example:
y=log10(0.05)
Event received:
Example:
y=sqrt(9)
Event received:
abs[1] The abs function returns the absolute value of the argument.
Example:
y= abs(-1)
Event received:
29
deg[1] Trigonometric function for an angle calculation. Returns the grade measure.
Example:
y=deg(3.14)
Event received:
Example:
y=rad(180)
Event received:
CONVERSION
Example:
x= floor(5.55)
Event received:
Example:
x= ceil(5.55)
Event received:
Example:
z=(9);
a=str(z);
b=sqrt(a);
Events received:
30
atof[1] String-to-integer conversion function.
Example:
x="0";
x=str(atof(x)+10);
Event received:
Example:
x="10";
x=str(val(x)+2);
Event received:
Example:
y=(2.33);
x=int(y);
Event received:
Example:
x=long2time(12345);
Event received:
31
time2long[1] Convert time into a number of seconds.
Example:
y=(0.15);
x=time2long(y);
Event received:
scalar2date[1] Convert a number of days into a date (number of days is calculated AD).
Example:
y=(731500);
x=scalar2date(y);
Event received:
Example:
x=scalar(“19.10.2004”)
Event received:
Example:
y=(24009921);
x=convert_num(y);
Event received:
32
convert_cur[1] Convert a number (sum of money) into the string and add dollars and cents.
Format: x=convert_cur(y); where x—string value of the sum of money, y—number (sum of
money)
Example:
y=(17999.98);
x=convert_cur(y);
Event received:
FORMATTING
Example:
y=(17999.09998);
x=number_frm(y,3);
Event received:
Example:
y=(17999.99);
x=int_frm(y,10);
Event received:
Format: x=currency_std(y); where x—function value with modified format, y—number (sum of
money)
Example:
x=currency_std(3.62);
Event received:
33
IsVarExist[1] The function that checks a specified parameter in the event.
Example:
p=IsVarExist(“param0”)
Event received:
The function that returns the first object ID found by a specified parameter.
GetObjectIdByParam [3] Id=GetObjectIdByParam ("x","y","z"); where id—returned value, x—object type, y—parameter,
z—parameter value
Example:
Id=GetObjectIdByParam("CAM","color","0");
Event received:
* Id=2 (see value<2>), if the function returns empty value (value< >), then check if the
function and its parameters are written correctly
STRING
Example:
z=str(1019);
y=str(1019);
x=strequal(z,y);
Event received:
34
strsub[2] Determining if there is a substring in the string.
Format: x=strsub(y,z); where x—value, y—string in which the search is performed, z—substring
Example 1:
z=str(888123);
y=str(123);
x=strsub(z,y);
Event received:
Example 2:
z="67hb8vc56";
y="vc";
x=strsub(z,y);
Event received:
* "value<4>" (see example 1)—index in the initial string. Starting from this index, the first
occurrence of the substring in the string is detected. If the search result is negative, the
function returns value<>
Example:
y=("");
x=strempty(y);
Event received:
35
straleft[2] Left alignment.
Example:
y=str(123456789);
x=straleft(y,5);
Event received:
Note. If z is larger than the number of characters in the string, then the function adds spaces
to the initial string on the right until its length becomes z
Example:
z=(7);//position
w=(9);//length
Event received:
Format: y=strleft(s,w); where y—string value, s—string, w—length (from string beginning)
Example:
w=(5);//length
y=strleft(s,w);
Event received:
36
strright[2] Get right side of string (1—string, 2—length).
Format: y=strleft(s,w); where y—string value, s—string, w—length (from string end)
Example:
w=(6);// length
y=strright(s,w);
Event received:
Format: y=strnleft(s,w); where y—string value, s—string, w—length of left side that will be cut
Example:
w=(6);//length
y=strnleft(s,w);
Event received:
Format: y=strnright(s,w); where y—string value, s—string, w—length of right side that will be
cut
Example:
w=(6);//length
y=strnright(s,w);
Event received:
37
get_substr[3] Get substring (1—string, 2—substring to start with, 3—substring to end with, "\r"—end of
string).
Example:
y=get_substr(s,w,x);
Event received:
Example:
y=get_substr(s,w,x);
Event received:
Example:
y=strltrim(w);
Event received:
38
strrtrim[1] Remove spaces on the right.
Example:
y=strrtrim(w);
Event received:
Example:
y=stratrim(w);
Event received:
Note
The date<DD-MM-YY> and time<HH:MM:SS> functions return the current date and time. The pi<3,
1415926535897932384626433832795> function returns the value of π.
39
Examples of scripts in the embedded language
40
Examples with Cameras and Video surveillance
monitors
GRABBER Video capture device
MACRO Macro
CAM Camera
MONITOR Monitor
OnEvent("GRABBER","_id_","_event_")
DoReact("GRABBER","_id_","_command_" [,"_parameters_"]);
OnEvent("CAM","_id_","_event_")
DoReact("CAM","_id_","_command_" [,"_parameters_"]);
CheckState("CAM","number","state")
OnEvent("MONITOR","_id_","_event_")
DoReact("MONITOR","_id_","_command_"[,"_parameters_"]);
Examples
Examples of using events and reactions of the Video capture device object:
1. It is required to set the first channel for the first video capture device, maximum speed of digitizing, resolution is half-frame
and PAL format when starting the first macro.
2.
41
2. Set disks D:\ and F:\ for recording video archive when starting the third macro.
3. It is required to display the first camera on the first analog output and disable the first analog outputs of the first and second
cards when there is an error of connection to the second video capture device.
Note
If analog outputs of two or more cards are connected in parallel and, for example, camera 1 belongs to the first
grabber and camera 2 belongs to the second grabber, then when running the «DoReact("CAM","1","MUX1");»
command, it is required to run the «DoReact("GRABBER","2","MUX1_OFF");» command first. And correspondingly
when running the «DoReact("CAM","2","MUX1");» command, it is required to run the «DoReact("GRABBER","1","
MUX1_OFF");» command first. Otherwise signal overlaying will happen.
4. It is required to disable the second analog output of the video capture device when restoring the mains supply.
1. Switch camera to the color mode and start recording from it when arming the first camera.
3. Use half of resources when recording from the first camera (it means, if four cameras are connected through the first video
capture device than the first camera will record with speed of 6 FPS, and other three cameras—with speed of 2-2.5 FPS) if it is
in the alarm state.
4.
42
4. Set maximum compression synchronously with the fourth microphone of audio card on the first camera when recording on disk
from the first camera.
5. Start recording from the first camera with minimum quality in black and white mode when it isn't alarmed.
6. Start recording from the first camera in the “rollback” mode when it is disarmed.
7. Set new parameters of video signal when connecting the first camera.
OnEvent ("MACRO","2","RUN")
{
DoReact("CAM","1","CRUISE_START","cruise_id<1>,action<CRUISE_START>,cam_id<1>");
}
9. There is a certain number of cameras (num). It is necessary to check the operation of motion detection on all cameras (can be
used to check the performance of security sensors).
To solve the problem, you can use the emulation of a linear character array (string), it means, the array of characters is filled
in (in the example, it is the "N" character). Then, when the camera’s motion detection is triggered, the corresponding (to the
camera ID) element of the array is changed (changed to "Y"). Thus, the output is a character array of "N" (the camera didn’t
trigger) and "Y" (the camera triggered). The number of detections is counted and a message with the total number of cameras
and the number of cameras that triggered is displayed. Start the check on Macro 1. Stop on Macro 2.
43
OnInit()
{
run=0;
}
OnEvent("MACRO","1","RUN")
{
run=1; flag=""; num=8;
for(i=1;i<str(num+1);i=str(i+1))
{
DoReact("CAM",i,"DISARM");
DoReact("CAM",i,"REC_STOP");
DoReact("CAM",i,"ARM");
flag=flag+"N";
if(i<num) {flag=flag+"|";}
}
}
OnEvent("CAM",N,"MD_START")
{
if(run)
{
nn=str((N*2)-1);
flag=strleft(flag,str(nn-1))+"Y"+strright(flag,str(((num*2)-1)-nn));
}
}
OnEvent("MACRO","2","RUN")
{
run=0; fin=0;
for(i=1;i<str(num+1);i=str(i+1))
{
tmp=extract_substr(flag,"|",str(i-1));
if(strequal(tmp,"Y")) {fin=str(fin+1);}
DoReact("CAM",i,"DISARM");
}
tmp=":"+str(num)+" :"+str(fin);
rez=MessageBox("",tmp,0);
}
10. When an alarm occurs on camera 1, captions must be overlaid on the video image from this camera. When the alarm ends,
captions about the end of the alarm must be overlaid on the video image.
OnEvent("CAM","1","MD_START")
{
DoReact("CAM","1","CLEAR_SUBTITLES","title_id<1>"); //delete all captions from video image
DoReact("CAM","1","ADD_SUBTITLES","command<Camera 1 Alarm " + time + "\r>,page<BEGIN>,title_id<1>");
//the time parameter allows you to include the time of event registration in captions
}
OnEvent("CAM","1","MD_STOP")
{
DoReact("CAM","1","ADD_SUBTITLES","command<Camera 1 End of alarm " + time + "\r>,page<END>,
title_id<1>");
}
Note
When you use the page<BEGIN> and page<END> parameters, the corresponding fields in the captions database will
be filled in, which will make it possible to search for data using the Captions search interface object.
1. Play record from camera 1 on the monitor 4 with the specified date and time when running the first macro.
44
1.
OnEvent("MACRO","1","RUN")
{
DoReact("MONITOR","4","ARCH_FRAME_TIME","cam<1>,date<"+date+">,time<11:00:00>");
DoReact("MONITOR","4","KEY_PRESSED","key<PLAY>");
}
2. Switch to the mode of video archive viewing on the first camera of monitor 4 when printing the frame from the first camera
and then go on 10 frames further starting from the specified date and time.
3. Zoom in the video image on the monitor screen if camera is in the alarm state and reset it when alarm is finished.
OnEvent("CAM","1","MD_START")
{
DoReact("MONITOR","1","KEY_PRESSED","key<ZOOM_IN>");
}
4. Display the layout number one on the monitor screen when running a macro.
OnEvent("MACRO","1","RUN")
{
DoReact("MONITOR","1","KEY_PRESSED","key<SELECT_LAYOUT>,number<1>");
}
5. Command of starting the video export from Camera 1 in the Monitor 1, starting from 24-10-14 17:10:38 and to 24-10-14 17:
10:80 to the c:\[Link] file.
Examples of export starting in three ways: using the IIDK (port 900 and 1030) and using script:
a. IIDK (port 900)
MONITOR|1|START_AVI_EXPORT|start<24-10-14 17:10:38>,finish<24-10-14 17:10:50>,avi_path<c:\[Link]>,
cam<1>
b. IIDK (port 1030)
CORE||DO_REACT|source_type<MONITOR>,source_id<1>,action<START_AVI_EXPORT>,params<4>,
param0_name<avi_path>,param0_val<c:\[Link]>,param1_name<cam>,param1_val<1>,param2_name<finish>,
param2_val<24-10-14 17:10:50>,param3_name<start>,param3_val<24-10-14 17:10:38>
c. Script (start on Macro 1)
OnEvent("MACRO","1","RUN")
{
DoReact("CORE","","DO_REACT","source_type<MONITOR>,source_id<1>,action<START_AVI_EXPORT>,
params<4>,param0_name<avi_path>,param0_val<c:\[Link]>,param1_name<cam>,param1_val<1>,
param2_name<finish>,param2_val<24-10-14
17:10:50>,param3_name<start>,param3_val<24-10-14 17:10:38");
}
6. When macro 1 is run, enable mouse PTZ control on Camera 4 at Monitor 10. Disable it on Macro 2.
45
6.
OnEvent("MACRO","1","RUN")
{
DoReact("MONITOR","10","CONTROL_TELEMETRY","cam<4>,on<1>");
}
OnEvent("MACRO","2","RUN")
{
DoReact("MONITOR","10","CONTROL_TELEMETRY","cam<4>,on<0>");
}
OnEvent ("MONITOR","1","ACTIVATE_CAM")
{
DoReact ("CAM",cam,"MUX1");
}
OnEvent ("CAM",N,"MD_START")
{
DoReact ("MONITOR","1","ACTIVATE_CAM","cam<"+N+">");
DoReact ("MONITOR","1","KEY_PRESSED","key<SCREEN.1>");
}
9. An alarm monitor that always displays a video from the last alarmed camera.
OnInit()
{
counter=0;
}
OnEvent("CAM",T,"MD_START")
{
if(strequal(counter,"0"))
{
DoReact("MONITOR","2","REMOVE_ALL");
DoReact("MONITOR","2","ADD_SHOW","cam<"+T+">");
}
counter=str(counter+1);
}
OnEvent("CAM",M,"MD_STOP")
{
counter=str(counter-1);
if(strequal(counter,"0"))
{
DoReact("MONITOR","2","ADD_SHOW","cam<"+M+">");
}
}
46
Examples with Computer and Display
SLAVE Computer
DISPLAY Display
Formats
Format of events procedure for the Computer object:
OnEvent("SLAVE","_id_","_event_")
DoReact("SLAVE","_id_","_command_" [,"_parameters_"]);
OnEvent("DISPLAY","_id_","_event_")
DoReact("DISPLAY","_id_","_command_" [,"_parameters_"]);
Examples
Examples of using events and reactions of the Computer object:
OnEvent("SLAVE","1"," NO_DISC")
{
DoReact("CAM","2"," REC_STOP");
}
OnEvent ("MACRO","1","RUN"){
DoReact ("SLAVE","WS3","GET_DEPTH","cam<1>");
}
As the result, the following string will be displayed in the debug window:
Event : SLAVE|WS3|ARCHIVE_DEPTH|cam<1>,core_global<1>,date<11-07-13>,depth<42>,destination_id<1>,
destination_source<PROGRAM>,fraction<970>,guid_pk<{003DFC83-0CEA-E211-A437-0017C401D5C2}>,owner<WS3>,
param0<01:18>,slave_id<WS3>,time<13:30:33>
Besides, the Archive depth event will be displayed in the Event Viewer and the archive depth in Days:Hours format will be
specified in the Additional information field. This information is also displayed in the debug window in the param0<> event
parameter.
1. Show first display on the CLIENT computer when activating the first time zone.
47
1.
OnEvent("TIME_ZONE","1","ACTIVATE")
{
DoReact("DISPLAY","1","ACTIVATE","macro_slave_id< CLIENT >");
}
2. There are two displays, the first one shows the virtual monitor with cameras, the second one shows the Map object with the FSA
sensors. When a camera alarm is triggered, Display 1 is shown, when a sensor alarm is triggered, Display 2 is shown, but only
on the CLIENT computer.
OnEvent("CAM",N,"MD_START")
{
DoReact("DISPLAY","2","DEACTIVATE","macro_slave_id<CLIENT>");
DoReact("DISPLAY","1","ACTIVATE","macro_slave_id<CLIENT>");
}
OnEvent("FSA_ZONE",M,"ALARM")
{
DoReact("DISPLAY","1","DEACTIVATE","macro_slave_id<CLIENT>");
DoReact("DISPLAY","2","ACTIVATE","macro_slave_id<CLIENT>");
}
48
Examples with Map
MAP Map
DoReact("MAP","_id_","_command_" [,"_parameters_"]);
OnEvent("MACRO","10","RUN")
{
DoReact("MAP","1","HIDE_OBJECT","objtype<CAM>,objid<10>,hide<1>");
}
49
Examples with Archive and Edge storage
ARCH Backup archive
Formats
Format of events procedure for the Backup archive object:
OnEvent("ARCH","_id_","_event_")
The operator format for describing the actions with the Edge storage:
DoReact("IPSTORAGE","_id_","_command_" [,"_parameters_"]);
Examples
Example for the Backup archive object. Send corresponding message to all cores of the system if archiving via the Backup archive 1
isn't performed.
OnEvent("ARCH","1","INACTIVE")
{
NotifyEventGlobal ("ARCH","1","INACTIVE");
}
Example for the Edge storage object. Import archive from the edge storage of camera 45 Edge for the period from 11-01-19 16:00:
55 to 11-01-19 17:00:55 on Macro 10.
OnEvent("MACRO","10","RUN")
{
DoReact("IPSTORAGE", "1", "IMPORT", "cam<45>,datetime_from<11-01-19 16:00:55>,datetime_to<11-01-19 17:00:
55>");
}
50
Examples with Macros and Time zones
MACRO Macro
OnEvent("MACRO","_id_","_event_")
DoReact("MACRO","_id_","_command_" [,"_parameters_"]);
CheckState ("MACRO","number","state")
OnEvent("TIME_ZONE","_id_","_event_")
DoReact("MACRO","_id_","_command_" [,"_parameters_"]);
CheckState ("TIME_ZONE","number","state")
Examples
Examples of using events and reaction of the Macro object:
OnEvent("MACRO","1","RUN")
{
DoReact("TELEMETRY","1","SET_PRESET","TEL_PRIOR<1>");
}
OnEvent("CAM","1","ARM")
{
DoReact("MACRO", "2", "RUN");
}
51
OnEvent("MACRO","1","RUN")
{
DoReact("TELEMETRY","1.1","PATROL_PLAY","tel_prior<1>");
}
OnEvent("MACRO","2","RUN")
{
DoReact("TELEMETRY","1.1","STOP","tel_prior<1>");
}
4. Example of an infinite loop and how to stop it. Start the cycle on macro 1, stop the cycle on macro 2.
1. Display video image from the camera 1 on the monitor when activating the first time zone.
OnEvent("TIME_ZONE","1","ACTIVATE")
{
DoReact ("CAM", "1", "ACTIVATE", "MONITOR<1>");
}
52
Examples with PTZ devices and Control devices
TELEMETRY PTZ device
TELEMETRY_EXT Keyboard
Formats
Format of events procedure for the PTZ device object:
OnEvent("TELEMETRY","_id_","_event_")
DoReact("TELEMETRY","_id_","_command_" [,"_parameters_"]);
OnEvent("TELEMETRY_EXT","_id_","_event_")
DoReact("TELEMETRY_EXT","_id_","_command_" [,"_parameters_"]);
OnEvent("JOYSTICK","_id_","_event_")
Examples
Examples of using reactions of the PTZ device object:
OnEvent("CAM","1","ARM")
{
DoReact("TELEMETRY","1", "AUTOFOCUS_ON");
}
2. Rotate camera to the position specified in the first preset with the relay enabled.
OnEvent("GRELE","1","ON")
{
telemetry_id= GetObjectParam("CAM","1","parent_id");
DoReact("TELEMETRY","telemetry_id","SETUP","GO_preset<1>");
}
3. Record the patrol route for Camera 1 corresponding to the PTZ device 1.1. The route consists of two points, such that to go
from point 1 to point 2, you need to rotate the camera to the left at speed of 6 for two seconds. Patrolling must be performed
at speed of 10. The time at each point of the route is 25 seconds. It is supposed that when the program is started, the camera
is set to the position corresponding to the first point of the route.
53
OnEvent("MACRO","1","RUN")
{
DoReact("TELEMETRY","1.1","PATROL_LEARN","cam<1>,preset<1>,tel_prior<1>,dwell<25>,speed<10>,
flush_tour<0>");
Wait(2);
DoReact("TELEMETRY","1.1","LEFT","speed<6>,tel_prior<1>");
Wait(2);
DoReact("TELEMETRY","1.1","STOP","speed<6>,tel_prior<1>");
Wait(2);
DoReact("TELEMETRY","1.1","PATROL_LEARN","cam<1>,preset<2>,tel_prior<1>,dwell<25>,speed<10>,
flush_tour<1>");
}
4. There are two cameras with PTZ devices. Every 15 minutes you need to rotate cameras to preset 1 and take a screenshot. File
name is current time.
54
OnTime(W,D,X,Y,H,M, "01")
{
if(strequal(M,"0"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1 "+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2 "+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
if(strequal(M,"15"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1 "+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2 "+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
if(strequal(M,"30"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1 "+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2 "+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
if(strequal(M,"45"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1 "+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2 "+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
}
5. Patrol multiple FOVs using the PTZ camera presets, with the possibility of activating the motion detection on certain areas.
Camera 1: five detection areas, five presets. These two parameters are set by the n variable. Macro 1 starts the algorithm.
Macro 2 stops the algorithm. Flag is an internal variable.
When the algorithm starts, the camera sets into preset 1 and arms detection area 1. There is a delay of 200 milliseconds
between these commands, so that the camera has time to set into the preset. Then after five seconds, area 1 is disarmed, and
the cycle starts again, but with area 2 and preset 2. And so on until all n areas and presets are run through. After that, the
algorithm starts again from 1. The algorithm stops if the flag variable is reset (using macro 2).
55
OnEvent("MACRO","1","RUN")
{
flag=1;
n=5;
[
for(i=1;flag;i=str(i+1))
{
DoReact("TELEMETRY","1.1","GO_PRESET","preset<"+i+">,tel_prior<3>");
Sleep(200);
DoReact("CAM_ZONE","1"+i,"ARM");
Wait(5);
DoReact("CAM_ZONE","1"+i,"DISARM");
if(strequal(i,n)) {i=0;}
}
]
}
OnEvent("MACRO","2","RUN")
{
flag=0;
}
Turn on the light and arm camera 2 after pressing the key 15 on the AXIS T8312 keyboard.
OnEvent ("TELEMETRY_EXT","1","KEY_PRESSED")
{
if (strequal(param0, "15")){
DoReact("TELEMETRY_EXT","1","RELE_ON","rele<15>");
DoReact("CAM","2","ARM");
}
}
56
Example with Core
CORE
Procedure is started when the corresponding event occurs. Format of events procedure for the Core object:
OnEvent("CORE","_id_","_event_")
Example. When a face appears in the frame, display the video image from the corresponding camera on Monitor 2. When the face
disappears, remove the video image from the corresponding camera from Monitor 2.
OnEvent("CORE",N,"DO_REACT")
{
if (strequal(action,"SET_MARKRECT"))
{
DoReact("MONITOR","2","ADD_SHOW","cam<"+param5_val+">");
}
if (strequal(action,"DEL_MARKRECT"))
{
[
Wait(2);
DoReact("MONITOR","2","REMOVE","cam<"+param0_val+">");
]
}
}
57
Examples with Incident server and Incident
manager
INC_MANAGER Incident manager
OnEvent("INC_MANAGER","_id_","_event_")
OnEvent("INC_SERVER","_id_","_event_")
The operator format for describing the actions with the Incident server object:
DoReact("INC_SERVER","_id_","_command_" [,"_parameters_"]);
58
Examples with Operator protocol and Event
Viewer
OPERATORPROTOCOL Operator protocol
Formats
Format of events procedure for the Operator protocol object:
OnEvent("OPERATORPROTOCOL","_id_","_event_")
Operator format for describing the actions with the Operator protocol:
DoReact("OPERATORPROTOCOL","_id_","_command_" [,"_parameters_"]);
OnEvent("EVENT_VIEWER","_id_","_event_")
Operator format for describing the actions with the Event Viewer:
DoReact("EVENT_VIEWER","_id_","_command_" [,"_parameters_"]);
Examples
Examples of using events and reactions of the Operator protocol object:
1. Delete the first alarm on Camera 3 from the Operator protocol 1 window on Macro 2.
OnEvent ("MACRO","2","RUN")
{
DoReact("OPERATORPROTOCOL","1","DEL_ALARM","objtype<CAM>,objid<3>,options<first>");
}
2. Hide the Alarm situation, Suspicious situation and False alarm buttons for the Disarm event from Camera 12 in the Operator
protocol 1 window on Macro 2.
OnEvent ("MACRO","2","RUN")
{
DoReact("OPERATORPROTOCOL","1","HIDE_BUTTON","button<alarm,suspicious,false>,hide<1>,objtype<CAM>,
objaction<DISARM>,objid<12>");
}
Set general background color to black and general text color to white for Event Viewer 1 on Macro 1.
OnEvent ("MACRO","1","RUN")
{
DoReactStr("EVENT_VIEWER","1","UPDATE_VIEW","bk_color<#000000>, defclr<#FFFFFF>");
}
59
Examples with Operator query panel and SIP-
terminal
DIALOG Operator query panel
SIP_TERMINAL SIP-terminal
Formats
Operator format to describe actions with the Operator query panel:
DoReact("DIALOG","_id_","_command_" [,"_parameters_"]);
OnEvent("SIP_TERMINAL","_id_","_event_")
DoReact("SIP_TERMINAL","_id_","_command_" [,"_parameters_"]);
Examples
Examples of using reactions of the Operator query panel object:
1. Using macro 1, set coordinates of the left top corner of the operator query panel (PANASONIC-850 PTZ camera) in the center
of the screen, prohibit its moving and display it on the screen.
OnEvent("MACRO","1","RUN")
{
DoReact("DIALOG","PANASONIC-850","SETUP","x<50>,y<50>,allow_move<0>");
DoReact("DIALOG","PANASONIC-850","RUN");
}
OnEvent("MACRO","2","RUN")
{
DoReact("DIALOG","PANASONIC-850","CLOSE");
}
60
Examples with Audio
PLAYER Audio player
OLXA_LINE Microphone
Formats
Operator format to describe actions with the Audio player:
DoReact("PLAYER","_id_","_command_" [,"_parameters_"]);
CheckState("OLXA_LINE","number","state")
Examples
Examples of using events and reactions of the Audio player object:
OnEvent("CAM",N,"REC_STOP")
{
DoReact("PLAYER","1","PLAY_WAV","file<C:\Program Files (x86)\Axxon PSIM\Wav\cam_alarm_"+N+".wav>,
from_macro<1>");
}
2. Stop playing back the audio file when the camera starts recording:
OnEvent("CAM",N,"REC")
{
DoReact("PLAYER","1","STOP_WAV");
}
3. Playback the audio file from the occurrence of an event to the occurrence of another event (in this example, it is the start of
macros).
Audio file must last no longer than the number of seconds specified in the Wait statement.
61
OnEvent("MACRO","1","RUN")
{
flag=1;
[
for(i=1;flag;i=1)
{
DoReact("PLAYER","1","PLAY_WAV","file<C:\Program Files\Axxon PSIM\Wav\cam_alarm_1.wav>");
Wait(3);
}
]
}
OnEvent("MACRO","8","RUN")
{
flag=0;
}
1. Turn on the first microphone when the sound activated recording is enabled.
3. The audio from the microphone (OLXA_LINE) isn’t recorded synchronously with the camera. By default, the microphone isn’t
armed. It is necessary to record audio both on sound activation and on camera detection. When sound activated recording
(ACCU_START) and motion detection start, forced audio recording is enabled, and the flag variable is incremented by one. At
the end of sound activated recording and motion detection, the flag variable is decremented by one, and audio recording stops
only if it is equal to zero, it means, there is neither sound activation nor motion.
62
OnInit()
{
flag=0;
}
OnEvent("CAM","3","MD_START")
{
flag=str(flag+1);
DoReact("OLXA_LINE","1","RECORD_START");
}
OnEvent("OLXA_LINE","1","ACCU_START")
{
flag=str(flag+1);
DoReact("OLXA_LINE","1","RECORD_START");
}
OnEvent("OLXA_LINE","1","ACCU_STOP")
{
flag=str(flag-1);
if (!(flag))
{
DoReact("OLXA_LINE","1","RECORD_STOP");
}
}
OnEvent("CAM","3","MD_STOP")
{
flag=str(flag-1);
if (!(flag))
{
DoReact("OLXA_LINE","1","RECORD_STOP");
}
}
63
Example with Videogate
GATE Videogate
OnEvent("GATE ","id","event")
DoReact("GATE","id","command"[,"parameters"]);
Example. Send corresponding messages to all system cores when the input speed on the gate 1 is reduced.
64
Examples with Detection
CAM_VMDA_DETECTOR VMDA detection
Formats
Format of events procedure for the VMDA Detection:
OnEvent("CAM_VMDA_DETECTOR ","_id_","_event_")
DoReact("CAM_VMDA_DETECTOR","_id_","_command_");
OnEvent("CAM_FACECAPTURE","_id_","_event_")
DoReact("CAM_FACECAPTURE","_id_","_command_" [,"_parameters_"]);
OnEvent("CAM_IP_DETECTOR","_id_","_event_")
Example
Example of using events and reactions of the VMDA Detection object:
OnEvent ("MACRO","1","RUN")
{
DoReact("CAM_VMDA_DETECTOR","2","ARM");
}
65
Example with User
PERSON User
OnEvent("PERSON","_id_","_event_")
66
Examples with Captions
TITLEVIEWER Captions search
CAM_TITLE Captioner
Formats
Format of events procedure for the Captions search object:
OnEvent("TITLEVIEWER","_id_","_event_")
DoReact("CAM_TITLE","_id_","_command_");
Examples
Example for the Captions search object:
When double-clicking the search result line in the Captions search window, display the video archive corresponding to this result on the
monitor 4.
OnEvent("TITLEVIEWER","1","GO_VIDEO")
{
DoReact("MONITOR","4","ARCH_FRAME_TIME","cam<"+cam+">,date<"+date+">,time<"+time+">");
DoReact("MONITOR","4","KEY_PRESSED","key<PLAY>");
}
OnEvent("MACRO","1","RUN")
{
DoReact("CAM_TITLE", "2", "REINDEX");
}
67
Examples with System restart service and
Failover service
SSS_WATCHDOG System restart service
Formats
Format of events procedure for the System restart service object:
OnEvent("SSS_WATCHDOG","_id_","_event_")
DoReact("SSS_WATCHDOG","_id_","_command_" [,"_parameters_"]);
OnEvent("FAILOVER","_id_","_event_")
DoReact("FAILOVER","_id_","_command_" [,"_parameters_"]);
Example
Examples of using events and reactions of the System restart service object:
OnEvent("SSS_WATCHDOG","1"," RESTART_PROCESS")
{
DoReact("MONITOR", "5", " ACTIVATE_CAM", "CAM<3>")
}
68
Example with BacNet
BACNET BacNet
OnEvent("BACNET","_id_","_event_")
DoReact("BACNET","_id_","_command_" [,"_parameters_"]);
69
Examples with Relay and Sensors
GRELE Relay
GRAY Sensor
OnEvent("GRELE", "_id_","_event_")
DoReact("GRELE","_id_","_command_");
CheckState("GRELE","number","state")
OnEvent("GRAY","_id_","_event_")
DoReact("GRAY","_id_","_command_");
CheckState ("GRAY","number","state")
Examples
Example of using events and reactions of the Relay object:
OnEvent("GRELE","1","SIGNAL_LOST")
{
DoReact("GRELE", "2", "ON");
}
1. It is required to switch the second sensor over to the second input if connection with the first sensor is lost.
2. Open the second sensor and enable the rollback record of the first camera when the first sensor is closed.
70
2.
71
Examples with Message services and notification
services
MMS Mail Message Service
Formats
Format of events procedure for the Mail Message Service:
OnEvent("MMS","_id_","_event_")
DoReact("MMS","_id_","_command_" [,"_parameters_"]);
OnEvent("MAIL_MESSAGE","_id_","_event_")
DoReact("MAIL_MESSAGE","_id_","_command_" [,"_parameters_"]);
DoReact("VMS","_id_","_command_" [,"_parameters_"]);
DoReact("VNS","_id_","_command_" [,"_parameters_"]);
OnEvent("SMS","_id_","_event_")
DoReact("SMS","_id_","_command_" [,"_parameters_"]);
OnEvent("TELEGRAM","_id_","_event_")
72
DoReact("TELEGRAM","_id_","_command_" [,"_parameters_"]);
Examples
Example of using reactions of the Mail Message Service object.
OnEvent("MACRO","1","RUN")
{
DoReact("MMS", "1", "SETUP", "port<25>");
}
Send message with image from camera when it switches to an alarm state when motion detection triggers.
OnInit(){
i=0; //counter is used to avoid overwriting of images from one camera
}
{
filename = "c:\" + N + "_msg_"+str(i)+".jpg";
i=i+1;
DoReact("MONITOR","1","EXPORT_FRAME","cam<"+ N + ">,file<" + filename+ ">");
DoReact("MAIL_MESSAGE", "1", "SETUP", "body<camera is triggered"+ N + ">, subject<alarm on camera>,
from<[Link]@[Link]>, to<[Link]@[Link]>,attachments<" + filename + ">");
DoReact("MAIL_MESSAGE","1","SEND");
}
It is required to send message on macro 1 if modem is connected to COM2 port, type of dialing is pulse, don't wait for tonal signal.
OnEvent("MACRO","1","RUN")
{
DoReact("VMS","1","SEND","modem<2>,pulse<1>,waitfordialtone<0>");
}
Examples of using events and reactions of the Voice Notification Service object:
OnEvent("CAM",N,"REC_STOP")
{
DoReact("VNS","1","PLAY","file<C:\Program Files (x86)\Axxon PSIM\Wav\cam_alarm_"+N+".wav>");
}
OnEvent("CAM",N,"REC")
{
DoReact("VNS","1","STOP");
}
3. When a predetermined time zone starts, change the volume control value to a lower one, and then after the time zone ends,
set the average volume control value:
73
3.
OnEvent("TIME_ZONE","1","ACTIVATE")
{
DoReact("VNS","1","SETUP","level<2>");
}
OnEvent("TIME_ZONE","1","DEACTIVATE")
{
DoReact("VNS","1","SETUP","level<8>");
}
Examples of using events and reactions of the Short Message service object:
1. It is required to send a short message to the “89179190909” number when the first camera is alarmed.
OnEvent("CAM","1","MD_START")
{
DoReact("SMS","1","SETUP","phone<+79179190909>,message<camera 1, alarm>");
}
2. Install a short message device and send a message to the “89179190909” number when the first sensor is alarmed.
3. Play the c:\Windows\Media\[Link] audio file when receiving an sms using the Mail Message Service 2.
OnEvent("SMS","2","RECEIVE")
{
DoReact("PLAYER","3","PLAY_WAV","file<c:\Windows\Media\[Link]>");
}
Examples of calling the command for sending a message to Telegram using a macro:
74
Appendix 1. Priorities of the start and stop
recording commands
Start and stop recording commands can have different priorities in Axxon PSIM. The priority of start/stop recording commands is set
by the priority<> parameter of the REC and REC_STOP reactions, respectively. If you try to stop recording using the command with
the priority that is lower than one of the command that initiated recording, then this command will be ignored.
When recording is started/stopped manually or by macro or by the detection tool triggering, the priority is not set. The table shows the
behavior of Axxon PSIM when various ways to start/stop recording are in use.
Start/stop recording is initiated Start recording at The start/stop recording commands 1 and 2 are equal*
by the operator using the CAM|1|REC| reaction, stop
camera context menu (start recording at
/stop recording) or by macro CAM|1|REC_STOP| reaction
Start/stop recording is initiated Start recording at The stop recording command 1 stops recording started using
by the operator using the CAM|1|REC|priority<0> command 2
camera context menu (start reaction, stop recording at
/stop recording) or by macro CAM|1|REC_STOP|priority<0
> reaction
Start/stop recording is initiated Start recording at The stop recording command 1 stops recording started using
by the operator using the CAM|1|REC|priority<1> command 2
camera context menu (start reaction, stop recording at
/stop recording) or by macro CAM|1|REC_STOP|priority<1
> reaction
Start/stop recording is initiated Start recording at The start/stop recording commands 1 and 2 are equal*
by the operator using the CAM|1|REC|priority<2>
camera context menu (start reaction, stop recording at
/stop recording) or by macro CAM|1|REC_STOP|priority<2
> reaction
Start/stop recording is initiated Start/stop recording is The stop recording command 1 stops recording started using
by the operator using the initiated by the detection tool command 2
camera context menu (start (for example, the main
/stop recording) or by macro motion detection tool)
Start recording at Start/stop recording is The stop recording command 2 stops recording started using
CAM|1|REC|priority<0> initiated by the detection tool command 1
reaction, stop recording at (for example, the main
CAM|1|REC_STOP|priority<0> motion detection tool)
reaction
75
Start recording at Start/stop recording is The stop recording command 1 stops recording started using
CAM|1|REC|priority<2> initiated by the detection tool command 2
reaction, stop recording at (for example, the main
CAM|1|REC_STOP|priority<2> motion detection tool)
reaction
* Equivalence of ways means that recording can be stopped using way 1 if it was started using way 2 and vice versa if the
recording is started using way 1, then it is possible to stop recording using way 2.
76
Appendix 2. Defining the param_id and
param_value values for the SET_IPINT_PARAM
reaction
The values of the param_id and param_value parameters, required for the SET_IPINT_PARAM reaction, can be individual both for
each of integrated IP cameras and for their firmwares.
1. Open the directory with installed DriverPack, by default, C:\Program Files\Common Files\AxxonSoft\Ipint.
DriverPack\3.0.0\.
2. Using any word processor, open a file in this directory with the Ipint.<Name of camera driver>.rep name, for example,
[Link].
Note
In most cases, the name of the driver is the same as the name of the manufacturer of the IP device. Contact
AxxonSoft support to check the name of the driver for the required manufacturer.
3. In the file, find the name of the required model, for example, SNC-DH120T.
77
4. There is the <videoSourceRef> tag within the <device> tag that contains the description of the required model like in the
<model> tag. You must find one more occurrence of the id value of this parameter in the file (in this example this is
video_source_dh160 value) in the videoSource tag.
5. The parameters of IP device and their possible values are described in the <property> tags. The description of possible values
depends on their type.
In this example the param_id="daynight" parameter can be used to switch the Day/Night mode on the camera. In this case the
possible values of the param_value parameter are: auto, on, off, timer or sensor.
Example
As a result of reactions execution the value of the “daynight” parameter is “on” for Camera 1.
To enable the SET_IPINT_PARAM reaction, the multistream mode must be enabled in Axxon PSIM (see Configuration of multistream
video). Keep in mind that if only one stream is integrated for the camera, then there will be no video in the multistream mode.
You can find out the number of integrated streams in the list of IP devices integrated with Axxon PSIM (see Documentation Drivers
Pack).
If this way can’t be used for any reason, then find out the number of integrated streams as follows:
1.
78
1. Repeat steps 1–3 of the previous algorithm.
2. The required model is described within the <device> tag, integrated video streams are described in the <videoStreamingRef
> tags. There must be more than one stream.
79
The Script object. Programming using the JScript
language
Purpose and features of the JScript language
Programming in JScript
The Script system object
The Editor-Debugger utility
The Debug window
Enabling the Debug window
Working with Debug window
Copying information on event or reaction to the clipboard
Highlighting messages
Events and reactions filter
Searching for events and reactions
Clearing the Debug window
Getting the list of system names of objects, reactions and events in Axxon PSIM
Script debugging
Script debugging features
Creating and using test events
Working with the debugging windows of the Editor-Debugger utility
Viewing the script messages
Displaying messages about starting, verifying, changing and executing scripts in the debugging windows
Using third-party debugger programs
80
Description of the toolbar of the Editor-Debugger utility
Appendix 2. Creating custom objects with ability to set events, reactions and states
Purpose of custom objects and their implementation in Axxon PSIM
How to create a custom object
DBI file preparation
DDI file preparation
XML file preparation
Creating and using a custom object in Axxon PSIM
Export to PDF
81
Purpose and features of the JScript language
The JScript programming language is used in Axxon PSIM to implement additional user functions not included in the basic Axxon PSIM f
unctionality.
The JScript programming language is a standard feature for developing user scripts. Axxon PSIM supports the version of the JScript
language implemented in the ActiveX technology by Microsoft. The general description of the JScript object model, used in Axxon PSIM,
is given in the Microsoft documentation (for example, MSDN).
The JScript scripts in Axxon PSIM are executed using the standard ActiveX software components included in the Windows OS. So,
when you develop scripts, you can use any components of the JScript object model implemented in the ActiveX technology.
Axxon PSIM additionally provides a specialized object model for script development in the JScript language that allows you to work
with system objects of Axxon PSIM, receive and send system events and reactions.
82
Programming in JScript
83
The Script system object
The Script system object is used to initialize a script developed in the JScript language in Axxon PSIM and to set the parameters for its
execution..
The settings panel of the Script system object is shown in the figure below:
Attention!
Creating of large number of the Script objects (more than 100) can cause system instability.
The settings panel of the Script system object allows choosing the time schedules and the computers (kernels) for executing the script.
Note
To set all checkboxes next to all computers, select a cell in the column with checkboxes and press Ctrl+A. To clear all
checkboxes, select a cell and press Shift+A.
The settings panel of the Script system object has the button for starting the Editor-Debugger utility and the text window for viewing
the script text created using this utility. You can edit the script in the Editor-Debugger utility or directly on the settings panel for the Sc
ript object.
Moreover, you can configure the events filter—the list of events that the Script system object will process. Including the event to the
filter equals to the if operator in the text of script, it means, when the event is in the table, the operator can be omitted.
Attention!
You must configure the events filter when you create a script in large distributed configurations. Otherwise, the module will
process all incoming events and it will lead to module malfunctioning.
84
Example.
If the Object’s type column has the Macro value, the Identifier column has the 1 value and the Event column has the Exe
cuted value, then instead of the script below
The detailed information on the elements of the settings panel for the Script object is given in Administrator's guide.
85
Example.
Recording on Camera 1 must be started when controlling the PTZ camera in the Video surveillance monitor.
1. Select the required time schedule when the script must be executed.
2. Enter the script text:
if ([Link]("source_type") == "TELEMETRY") {
DoReactStr ("CAM","1","REC","");
}
The filter can be set by the UPDATE_OBJECT event of the CORE object. Example of the command to add the Camera object with
identifier 1 to the filter of the Script object with identifier 2:
NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<SCRIPT>,objid<2>,[Link].0<1>,[Link].1<10>,EVENT.
[Link]<2>,flags<>,[Link].0<>,[Link].1<>,[Link].0<CAM>,[Link]<2>,EVENT.
objtype.1<CAM>,[Link]<2>");
86
The Editor-Debugger utility
The Editor-Debugger utility is used to create, debug and edit scripts in Axxon PSIM.
The Editor-Debugger utility contains the embedded text editor and the debugging window.
To help with writing correct scripts, the text editor automatically highlights objects, methods and properties that are a part of the
object model of the JScript language. In addition, the code blocks can be collapsed or expanded with - or + buttons to the left of the Sc
ript text field.
Note
When switching between scripts, script messages or other objects in the Editor-Debugger utility tree, the collapsing settings
are reset, it means, all blocks in the script become expanded.
The position of the cursor in each script is stored within one Axxon PSIM session (the cursor position is reset at restart). For example,
if you place the cursor at the end of //Line 2 in Script 1, then switch to Script 2 and perform any action in it, the cursor will be still
at the end of //Line 2 when you return to Script 1.
87
The debugging window of the Editor-Debugger utility allows viewing the information about all events registered by the system. You can
filter the events that are displayed in the debugging window. A separate debugging window is created for each Script system object,
which allows you to debug each script individually using the filters.
To debug the script, it is possible to test run using a user-defined test event generated by the utility and not registered in the system.
To display or edit this event, select Debug and edit Summary Information, and then go to the Trial event tab on the panel that
opens at the bottom of the window. For details, see Creating and using test events.
You can save the created script in the Script system object or in a text file on the hard drive.
88
The Debug window
Axxon PSIM allows viewing all events and reactions happening in the system in real time. Events and reactions with object properties
are displayed in the Debug window. You can copy them to the Windows clipboard and then use in programs.
89
Enabling the Debug window
Starting with weekly build [Link], the Debug 4 mode is enabled by default. In previous versions, the Debug window is disabled
by default. To enable the Debug window, do the following:
Note
You can enable the Debug window without using the [Link] utility. For this, set values 1, 2, 3, or 4 for the Debug
string parameter in the HKEY_LOCAL_MACHINE\SOFTWARE\AxxonSoft\PSIM section of the Windows registry
(HKEY_LOCAL_MACHINE \Software\Wow6432Node\AxxonSoft\PSIM for 64-bit system).
3. Select Axxon PSIM section in the tree on the left side of the utility dialog box.
4. Change the value of the Debug mode parameter from Disabled to Debug 1, Debug 2, Debug 3, or Debug 4. Any of these
modes will enable the Debug window, the difference between them is in the amount of information written to the log files
(see The Settings panel of the Axxon PSIM section).
5. Click the OK button.
6. Start Axxon PSIM.
7. A new Debug window item will appear on the Main control panel of Axxon PSIM.
Note
This menu is also available in the Windows notification area (system tray)—left click the button or short click the
F8 hot key.
8. Select the Debug window item on the Main control panel in order to display the Debug window on the screen. The selected De
bug window item is marked with a flag.
90
To hide the Debug window, re-select the Debug window item on the Main control panel.
Note
To disable the Debug window, select the Disable value for the Debug mode in the [Link] utility or set value 0 for the
Debug string parameter in the HKEY_LOCAL_MACHINE\SOFTWARE\AxxonSoft\PSIM section of the Windows registry
(HKEY_LOCAL_MACHINE \Software\Wow6432Node\AxxonSoft\PSIM for 64-bit system). These actions are performed when
you exited Axxon PSIM.
91
Working with Debug window
The appearance of the Debug window is shown in the figure. The Debug window displays the sequence of events and reactions in the
system.
You can use regular expressions to highlight and filter messages in the Debug window.
92
Copying information on event or reaction to the
clipboard
To read and/or copy information on an event or a reaction to the Windows clipboard, do the following:
Note
Use the context menu for operations with text in the Information window (right-click the selected text).
93
Highlighting messages
To configure message highlighting in the Debug window, do the following:
2. In the Highlight window, specify the line that must be highlighted every time it appears in the message (1).
Note
As a result, messages with the enterd line will be highlighted in the specified color in the Debug window.
94
The messages are now highlighted.
95
Events and reactions filter
Events and reactions filter allows displaying only required messages in the Debug window.
2. In the Filter window, specify the lines that must be in the message for it to be displayed in the Debug window (1). You can
use regular expressions. In this case, set the Use regex checkbox at step 5.
3. Specify the lines that must be in the message for it not to be displayed in the Debug window (2). You can use regular
expressions. In this case, set the Use regex checkbox at step 5.
Note
96
As a result, only messages that meet the filter conditions will be displayed in the Debug window.
97
Searching for events and reactions
To search for events and reactions, do the following:
1. Click the Search button (1). The Find window will open.
Note
98
Clearing the Debug window
To delete all messages from the Debug window, click the Clear button.
99
Getting the list of system names of objects,
reactions and events in Axxon PSIM
You can get the list of system names of objects, reactions and events used when programming with the help of the [Link]
configuration setting utility. See the description of the main system objects reactions in Description of events and reactions of system
objects.
Note
The [Link] utility is available in the Start menu with the following types of Axxon PSIM installation: Server,
Administrator’s workstation and Workstation for monitoring.
To view the list of system names of objects, events and reactions, do the following:
3. In the DDI tab, select the object which events and reactions you want to view (2).
4. To view the name of the selected object, go to the Names tab (3).
5. To view the list of events for the selected object, go to the Events tab.
100
6.
7. To view the list of reactions for the selected object, go to the Reactions tab.
101
See the detailed information on working with the [Link] utility in Editing [Link] and [Link] database templates using the ddi.
exe utility.
Note
If the Sensor is armed, then when the Sensor is closed/opened, the Alarm event occurs depending on the alarm mode
setting (see the Creating and configuring the Sensor system object section of the Installing and configuring security system
components guide). If the Sensor is disarmed, the Closed/Opened events occur correspondingly.
102
Creating your first script
As an example of using JScript in Axxon PSIM, try to create a script containing an error and then correct it. The script performs the
following actions: when Macro 1 starts, set the value 10 to the "Hot record" time parameter for cameras 1–4 and output the "Hello
world" message to the debugging window of the Editor-Debugger utility.
1. In the Hardware tab of the System Settings dialog window, create four Camera objects with identification numbers 1, 2, 3
and 4, if they have not been created before.
2. In the Programming tab, create a Macro object with identification number 1. Don't fill in the Events table for the correct
execution of the following actions and successful run of the script.
3. In the Programming tab, create a Script system object. Give the object the identification number 1 and the name "Script 1".
4. On the settings panel of the Script 1 object, select Always from the Time schedule drop-down list.
5. Click the Editor-Debugger button at the bottom of the settings panel of the Script 1 system object. The Editor-Debugger
utility window will open.
6. In the Editor-Debugger utility window, open the Debug-edit script list and select the Script 2 object.
Attention!
The script contains an error. See below the recommendations on how to fix it.
103
9. Create a test event to run the script in debug mode—MACRO|1|RUN|. To achieve this, in the Debug and edit menu, select Edi
t test event. The Test message window will open. Fill in the fields in the Test message window as shown in figure.
10. To run the script with the test event, select Test run in the Debug and edit menu.
11. Open the Script Messages list and select Script 1. The debugging window will open on the right side.
12. In the debugging window, find the “Process Event:MACRO|1|RUN|” line and the following error message: “Src identifier
missing: Microsoft JScript compilation error Line:2 Char:6 Error:0 Scode:800a03f2”.
The error message says that there is no identifier in the second line of variable declaration operator (var). This means that no
variable has been declared. This is a critical error in JScript, thus the script has not been executed.
13. Correct the text of the script (see the “var i;” line).
104
}
DebugLogString ("Hello world");
}
14. In the File menu, select Save to database to save the script.
15. Repeat steps 10 and 11.
16. In the debugging window, find the “Process Event:MACRO|1|RUN|” line and the “DebugLogString:Hello world” and “Script first
run OK” messages. The “Script first run OK” means that the script runs correctly in the debug mode.
21.
105
21. Check the accuracy of the script result. The "Hot record" time field in the Camera 1 to Camera 4 objects settings panels
must have the 10 value.
Note
The "Hot record" time field in the Camera settings panel is blank by default.
106
Working with script
107
Creating a script
On the page:
To create and run scripts in JScript, create the Script system object. Then, in the Editor-Debugger utility, enter the script, check it and
debug it.
You can create JScript scripts in Axxon PSIM using the built-in Editor-Debugger utility.
To start the Editor-Debugger utility, click the Editor-Debugger button on the settings panel of the Script system object.
1. In the Programming tab (1) of the System settings dialog window, create the Script object (2).
2. Enter the identification number and the name for the Script object (3).
3. Click the Apply button (4).
To configure the Script object, set the values of the following parameters:
1. In the Time schedule field (1), specify the time schedule of the script execution: Always, Never or one of the schedules
created earlier (1, see Creating and configuring Time schedules). The default value is Never.
2. In the Computers field (2), select the computers (kernels) on which the script must run.
108
2.
Note
By default, the script will run on all computers (kernels). The list displays only the computers registered in the Hardw
are tab of the System settings dialog window.
1. Click the Editor-Debugger button (3) at the bottom of the Script system object panel to open the Editor-Debugger utility.
Note
Use the Editor-Debugger utility to create, edit and save scripts in JScript. The settings panel of the Script system
object displays the text of the saved script that can also be edited.
2. In the Editor-Debugger utility window, open the Debug-edit script list and select the Script object you want to edit (for
example, the Script 1 object, as in the figure below).
3. In the Script field, enter the text of the script in JScript programming language (see Examples of scripts in the JScript language)
.
109
4. Run the script using a test event. To create a test event, select Debug and edit Edit test event.
The Test message window will open containing the fields for setting the event parameters.
To run the script using the test event, select Debug and Edit Test run.
Note
You can also run the script using the test event using the Ctrl+T key combination.
Note
For your convenience, when editing the script, the cursor position is saved when saving the script or when switching between
the scripts in the Editor-Debugger utility window during a session, it means, until Axxon PSIM is restarted.
Note
When you go to the Script messages list when editing a script, and then go back to the corresponding script in the Debug-
edit script list, you cannot undo or return the last action.
Debugging a script
You can check if the script syntax is correct using the interpreter which is built-in into the Editor-Debugger utility. The result of the
check with the information about the content and location of the error is displayed in the Debugger window corresponding to the
script in the Script messages list. If there are errors, you need to edit the script syntax and check it again.
Note
See the detailed information about using test events for script debugging in Script debugging.
After debugging the script using the Editor-Debugger utility, run it with a real system event. Check the result of the script execution. If
the result is incorrect, make the necessary changes and run the script again.
110
Saving a script
The Editor-Debugger utility provides two options for saving scripts: in the Script system object, or in a text file on the hard drive.
To save the script in the Script system object, in the File menu, select Save in the database. When you select this menu item, the
script will be updated on every Server that you selected on settings panel of the Script object (see The Script system object).
Note
You can also save the script in the database using the Ctrl+S key combination.
Note
The script is automatically saved in the corresponding Script system object upon closing the Editor-Debugger utility.
To save the script in the file, in the File menu, select Save on disk. To open a script saved in a file in the Editor-Debugger utility, in
the File menu, select Open from disk.
111
Deleting a script
To delete a script created in Axxon PSIM, delete the corresponding Script system object in the Programming tab.
112
Searching text in script
The Editor-Debugger utility allows searching text in script using a dialog box.
Press Ctrl+F to open the search dialog box. The Find dialog box will open.
1. In the Find what field (1), enter the text that you want to find.
2. Set the Match whole word only checkbox (2) if you want to search for the whole entered text.
3. Set the Match case checkbox (3) if you want the search to be case-sensitive.
4. Select the direction of the search through the script relative to the current cursor position: Up (4) or Down (5).
5. Click the Find Next button (6) to start the search and go to the next match.
6. Click the Cancel button (7) to cancel the search.
113
Replacing text in script
The Editor-Debugger utility allows replacing text in script using a dialog box.
1. In the Find what field (1), enter the text that you want to find in the script.
2. In the Replace with field (2), enter the text with which you want to replace the found text in the script.
3. Set the Match whole word only checkbox (3) if you want to search for the whole entered text.
4. Set the Match case checkbox (4) if you want the search to be case-sensitive.
5. Click the Find Next button (5) to start the search and go to the next match.
Note
6. Click the Replace button (6) to replace the current found match.
7. Click the Replace All button (7) to replace all matches automatically.
8. Click the Cancel button (8) to close the replace dialog box.
1. Before replacement:
114
2. After replacement:
115
Script debugging
116
Script debugging features
The Editor-Debugger utility allows debugging scripts using the built-in tools for checking script syntax, script interpreting and script
execution with test events generated by the utility. The messages about the debugging results are displayed in the corresponding
debugging windows.
1. A separate debugging window is assigned to each Script object, in which the test and system events, error messages, success
messages and user information messages are displayed. The messages in the debugging windows can be filtered.
2. Special Information window debugging windows are available that display the messages related to the script being
debugged.
3. Test events generated by the Editor-Debugger utility, which are not registered in the system, are used to check script accuracy.
4. Third-party debugging programs can be used for step-by-step script execution, viewing script variables during execution, and
so on.
117
Creating and using test events
On the page:
No more than one test event can be created for each script.
1. In the Debug and edit menu, select Edit test event, or click the button in the toolbar.
2. The Test message window will open. This window is used for entering the parameters of a test event.
3. Enter the following information in the fields of the Test message window:
a. SourceType—system object type;
b. SourceId—system object identification number;
c. SourceAction—event generated by the specified system object;
d. param—additional event parameters;
e. value—values of the additional parameters.
118
Note
The main system objects, their events and parameters are described in Description of events and reactions of
system objects. You can also get them using the [Link] utility (see Getting the list of system names of
objects, reactions and events in Axxon PSIM).
4. When you filled in the fields of the Test message window, click the OK button.
The created test event will be displayed in the Event field in a special string format.
The figure below shows the test event Arm Camera 111.
When you select the Test run in third-party debugger option, the third-party debugger starts to run the test (see Using third-party
debugger programs).
The results of the verification and execution of the script are displayed in the corresponding debugging window of the Editor-Debugger
utility.
119
Working with the debugging windows of the
Editor-Debugger utility
120
Viewing the script messages
Debugging windows display messages about logging system and test events, errors and successful script execution, as well as user
information messages.
There are two types of debugging windows: All script messages and Last run script messages.
The debugging windows of the All script messages type are displayed in the Script messages list. The names of the debugging
windows match the names of the corresponding Script objects. These windows display all system messages related to the
corresponding script. The example of the debugging window of the All script messages type:
In addition, the information on the last script run is displayed on the Script messages tab at the bottom of the Editor-Debugger utility
window. If this panel is not displayed, select Debug and edit Summary Information, or click the button on the toolbar.
121
Both types of debugging windows are used in the same way.
122
Displaying messages about starting, verifying,
changing and executing scripts in the debugging
windows
The messages in the debugging window track the stages of starting, verification and execution of scripts.
When the event that triggers the script occurs, the following message is displayed in the debugging window: “Process Event: <script
triggering event>”. For example, if the script starts on Macro 1, the line reads “Process Event:MACRO|1|RUN|”. At the moment of
changing the script in the Editor-Debugger utility or in Axxon PSIM, the debugging window displays the message «Process Event:
SCRIPT|script’s number|SETUP|» (for example, when changing the script with number 1, the debugging window displays «Process
Event: SCRIPT|1|SETUP|»).
Script syntax is checked before execution. If there are syntax errors, related error messages will be displayed in the debugging
window. The figure below shows an example of a syntax error message.
Right-click the message to view its complete text. The Information window will open containing the full text of the error message.
1.
123
1. error description;
2. error type (for example, Src: Microsoft Jscript compilation error);
3. error location in the script text (line number and character number in the "Char" line);
4. error code (Scode).
If there are no syntax errors in a script, the following message will be displayed in the debugging window: Script first run OK. Then,
the script will run.
In case of successful execution of the script, the following message will be displayed: “End ProcessScript, begin-end delay: <script
execution time>; for example, “End ProcessScript, begin-end delay: 13 [msec]”.
124
Using third-party debugger programs
Axxon PSIM officially supports Microsoft Visual Studio 2005 debugger.
Axxon PSIM allows using third-party debuggers for processing JScript scripts. These programs may have the functionality that is not
included in the Editor-Debugger utility, for example, step-by-step script execution, watching script variables during script execution,
and so on.
Note
You must use third-party debuggers with caution, as they don't provide full compatibility with Axxon PSIM. The use of third-
party debuggers may lead to failure of Axxon PSIM.
We strongly recommend introducing the breakpoint in the script when using third-party debuggers. To insert the breakpoint, add the
debugger; command to the script. The script execution will pause at the place specified by the debugger; command, and the debugger
will start automatically.
Note
In programming, a breakpoint is a deliberate interruption of program execution at which a debugger call is made.
When you use a third-party debugger, scripts can be started with test events only.
125
Examples of scripts in the JScript language
To illustrate the available fields of application of scripts in JScript, see the following examples, which can be used to create additional
functions in the system on the basis of the Script object.
126
Examples of scripts with Video surveillance
monitor and Cameras
MONITOR Monitor
CAM Camera
Example 1. Visualisation of operating the Queue length detection in the Video surveillance monitor
For the script to work correctly, you must first create and configure the Queue length detection object (part of the Detector Pack
package), Camera and Captioner objects (below, instead of the N, M, L characters, set the corresponding numbers of the Queue
length detection, Camera and Captioner objects) in Axxon PSIM.
As a result, when the corresponding camera is displayed in the Monitor, a text message about the current queue length will be
superimposed on the video image.
You can configure the font, color and position of text on the settings panel of the Captioner object.
Note
When you use the page<BEGIN> and page<END> parameters, the corresponding fields of the captions database are filled in.
This enables data search using the Captions search interface object.
Example 2. Visualisation of operating the People counter detection in the Video surveillance monitor
For the script to work correctly, you must first create and configure the People counter detection object (part of the Detector Pack
package), Camera, Captioner and Macro objects (below, instead of the N, M, L, P characters, set the corresponding numbers of the
People counter detection, Camera, Captioner and Macro objects) in Axxon PSIM.
127
//Event reading and counting of entered people
if ([Link] == "PEOPLE_COUNTER" && [Link] == "N" && [Link] == "IN") //N - Number of
People counter detection
{
i = Itv_var("counter_i");
k = Itv_var("counter_k");
i++;
Itv_var("counter_i")=i;
//Displaying the number of people by the Captioner in the Monitor
}
//Event reading and counting of exitng people
if ([Link] == "PEOPLE_COUNTER" && [Link] == "N" && [Link] == "OUT") //N - Number of
People Counter detection
{
i = Itv_var("counter_i");
k = Itv_var("counter_k");
k++;
Itv_var("counter_k")=k;
//Displaying the number of people by the Captioner in the Monitor
As a result, when the corresponding camera is displayed in the Monitor, a text message about the number of entered and exited
people will be superimposed on the video image.
Note
When you use the page<BEGIN> and page<END> parameters, the corresponding fields of the captions database are filled in.
This enables data search using the Captions search interface object.
You can configure the font, color and position of text on the settings panel of the Captioner object (see Configuring captions display
on a video image).
To null people counter, you must first create the Macro object on the Programming tab. You can change the name of the Macro
object, for example "Null people counter".
You can run the macro to null people counter either manually from the main menu of Axxon PSIM or automatically at any specified
time (for this, use the Events table on the settings panel of the Macro object on which you must specify the previously configured Tim
e schedule object). For more information about the use of the Macro and Time schedule objects, see Administrator's Guide.
Example 3. Displaying camera on the monitor by clicking the button on the control panel
The following example is valid only for cameras in configuration of which there is a PTZ control panel. When configuring Video
surveillance monitor, select the Go to preset action with 1,2,3...,0 parameters for ten joystick buttons (see Assigning commands to
joystick buttons using the Monitor section of Installing and configuring security system components guide).
128
Example. When the button is clicked on the control panel, display the corresponding camera in the active Monitor. The script must be
triggered by a timer with ID=1.
Note
You must create and configure the Timer object beforehand and set the current year. For detailed information on configuring
the Timer object, see Creating and configuring the Timer object.
After each button click on the control panel wait for two seconds until clicking another button. If there is no button click, then the
camera with dialed number must be displayed.
"NNN
129
Titles"
(with line break) over the video image of camera 1 using captioner 1. On Macro 2, disable the display of this text.
130
Examples of scripts with Map
MAP Map
Example. The Text type of display on the map is selected for the Camera 1. It's required to display the value of the MyVar variable,
read from the C:\[Link] file, on the map and debug window on Macro 1.
131
Examples of scripts with detection tools
CAM_VMDA_DETECTOR VMDA detection
If you use the object tracking on a video image (see Creating and configuring the Tracker object), then when you view archive, the
detected abandoned objects will be selected with a framed in video. To select the abandoned objects with a frame in a live video, use
the script to select an abandoned object with a frame when receiving an alarm from VMDA detection tool:
if ([Link]=="CAM_VMDA_DETECTOR")
{
cam=GetObjectParentId("CAM_VMDA_DETECTOR",[Link],"CAM");
if ([Link]=="ALARM")
{
var x1,x2,y1,y2;
x1=[Link]("x");
x2=[Link]("w");
y1=[Link]("y");
y2=[Link]("h");
x2=parseInt(x1)+parseInt(x2);
y2=parseInt(y1)+parseInt(y2);
DoReactStr("MONITOR","","SET_MARKRECT","cam<"+cam+">,color<255>,id<"+cam+">,x1<"+x1+">,x2<"+x2+">,y1<"+y1+">,
y2<"+y2+">");
DebugLogString("x1:"+x1+" x2:"+x2+" y1:"+y1+" y2:"+y2);
}
else
{
DoReactStr("MONITOR","","DEL_MARKRECT","cam<"+cam+">,id<"+cam+">");
}
}
Example 2. Using the embedded People counter detection on Bosch FLEXIDOME IP dynamic 7000 VR
IP camera
When the number of people reaches 20 on the embedded people counter detection of the Bosch FLEXIDOME IP dynamic 7000 VR IP
camera (with ID 1), call macro 1.
n=20;
if([Link] == "CAM_IP_DETECTOR" && [Link]=="1" && [Link] == "DETECTED")
{
v=[Link]("param0").split(";")[1];
if (parseInt([Link](":")[1])==n)
{
DoReactStr("MACRO","1","RUN","");
}
}
132
Examples of scripts with Macros
MACRO Macro
[Link]/httpapi/SendPTZ?action=sendptz&PTZ_PRESETSET=85
[Link]/httpapi/SendPTZ?action=sendptz&PTZ_PRESETSET=86
function DoPreset(preset)
{
xmlhttp=new ActiveXObject("[Link]");
if(xmlhttp == null)
{
return;
}
[Link]("GET", "[Link] false,"
admin","1234");
[Link]();
DebugLogString([Link]);
}
if ([Link] == "MACRO" && [Link] == "6" && [Link] == "RUN")
{
DoPreset("85");
}
Face detected
133
if([Link] == "MACRO" && [Link]=="1" &&[Link]=="RUN")
{
var file1 = "[Link]";
var file2 = "[Link]";
var file_folder = "C:\\Pictures\\";
test_event.SetParam("body","<html><body>\r\n<h3>Face found</h3>\r\n<table><tr>\r\n<td>Detected</td><td>Found in
DB</td>\r\n</tr><tr>\r\n<td><img width='200' alt='image1' src='cid:"
+
file1
+
"'/></td>\r\n<td><img width='200' alt='image2' src='cid:"
+
file2
+
"'/></td>\r\n</tr><tr>\r\n<td>E-mail sent from Axxon PSIM</td>\r\n</tr></table>\r\n</body></html>");
test_event.SetParam("attachments",file_folder+file1+";" + file_folder+file2);
test_event.SetParam("is_body_html", 1);
DoReact(test_event);
}
134
Example of script with Users
PERSON User
CORE
MACRO Macro
Note
For more information on access levels and access cards, see the ACFA PSIM documentation in the AxxonSoft documentation
repository.
If an ACS integration is configured in Axxon PSIM, which supports dynamic user recording, then the created user will be
automatically written to the ACS controller when the CORE||UPDATE_OBJECT|objtype<PERSON> event is sent. If dynamics is
not supported, then recording users to the controller will need to be initiated manually.
135
dep=10; // department ID
start=100;// first user ID
last=150; // last user ID
acc_lev=1; // access level ID
dep_count=30; // max number of users in the department
if (kol==dep_count)
{
NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,
parent_id<"+dep+">, level_id<"+acc_lev+">, facility_code<0>, card<"+card+">");
kol=0;
dep++;
NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
}
else
{
NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,
parent_id<"+dep+">,level_id<"+acc_lev+">, facility_code<0>,card<"+card+">");
}
Sleep(10);
}
}
function decToHex(n)
{
return Number(n).toString(16);
}
136
Examples of scripts with Incident server and
Incident manager
INC_SERVER Incident server
Example 1. On macro 1, change the status of the Alarm event on camera 1 to Completed.
OnEvent("MACRO","1","RUN")
{
DoReactStr("INC_SERVER","1","UPDATE_STATUS","status<3>,objtypes<CAM>,objids<1>,actions<MD_START>");
}
Example 2. On macro 2, on Incident server 1, change the status of the event escalation of camera 1 to Waiting for processing (not
escalated).
Example. On macro 3, change the status of the Alarm event on camera 1 or 2 to Completed.
137
Example of script with Failover service
FAILOVER Failover service
Example 1. Using the START and STOP events for the Failover service
Objects from more than one main Server must not be moved to the Backup Server. For this, when moving objects from some main
Server to the Backup Server, all other Failover service objects must be disabled on this Backup Server.
if ([Link] == "FAILOVER" )
{
if ([Link] == "START") {action="DISABLE";}
if ([Link] == "STOP") {action="ENABLE";}
id=[Link];
msg=CreateMsg();
[Link](GetObjectIds("FAILOVER"));
var
objCount=[Link]("[Link]");
for (i=0;i<objCount;i++)
{
pid=[Link]("id."+i);
if (!(id==pid)) {
DoReactStr("FAILOVER",pid,action,"");
}
}
}
138
Examples of scripts with BacNet
BACNET BacNet
//bacnet_application_tag
var BACNET_APPLICATION_TAG_NULL = 0;
var BACNET_APPLICATION_TAG_BOOLEAN = 1;
var BACNET_APPLICATION_TAG_UNSIGNED_INT = 2;
var BACNET_APPLICATION_TAG_SIGNED_INT = 3;
var BACNET_APPLICATION_TAG_REAL = 4;
var BACNET_APPLICATION_TAG_DOUBLE = 5;
var BACNET_APPLICATION_TAG_OCTET_STRING = 6;
var BACNET_APPLICATION_TAG_CHARACTER_STRING = 7;
var BACNET_APPLICATION_TAG_BIT_STRING = 8;
//bacnet_objtype
var OBJECT_ANALOG_INPUT = 0;
var OBJECT_ANALOG_OUTPUT = 1;
var OBJECT_ANALOG_VALUE = 2;
var OBJECT_BINARY_INPUT = 3;
var OBJECT_BINARY_OUTPUT = 4;
var OBJECT_BINARY_VALUE = 5;
//bacnet_property_id
var PROP_PRESENT_VALUE = 85;
[Link]("BACNETINT|1|WRITE");
[Link]("bacnet_application_tag", BACNET_APPLICATION_TAG_UNSIGNED_INT);
[Link]("bacnet_value",30);
[Link]("bacnet_objtype",OBJECT_ANALOG_VALUE);
[Link]("bacnet_instance",0);
[Link]("bacnet_property_id",PROP_PRESENT_VALUE);
[Link]("bacnet_device_id",12345);
DoReact(msg);
If the script is successfully executed, an event will appear in the Debug window:
Event:
BACNETINT|1|WRITE_OCCURES|sender<Udp:47808>,slave_id<ASUS>,fraction<186>,invoke_id<43>,owner<ASUS>,
module<[Link]>,date<27-11-18>,
value<PROP_PRESENT_VALUE>,guid_pk<{E23BD6CB-19F2-E811-8B83-C860008A29F9}>,object_id<OBJECT_ANALOG_VALUE:0>,
core_global<1>,adr<[Link]:56747>,time<10:55:33>,source_guid<557367ce-19f2-e811-8b83-c860008a29f9>
DebugLogString("Script2");
var msg = CreateMsg();
[Link]("BACNETINT|1|EVENT");
[Link]("event_type", "0");
[Link]("from_state", "1");
[Link]("to_state", "0");
[Link]("message_text", "test_text1!");
DoReact(msg);
139
If the module receives an event, the following event will appear in the Debug window:
Event:
BACNETINT|1|EVENT_OCCURES|sender<Udp:47808>,slave_id<ASUS>,fraction<683>,owner<ASUS>,
event_type<EVENT_CHANGE_OF_BITSTRING>,module<[Link]>,
message_text<test_text1!>,date<27-11-18>,guid_pk<{6D34BA08-1CF2-E811-8B83-C860008A29F9}>,
from_state<EVENT_STATE_FAULT>,
core_global<1>,adr<[Link]:57878>,to_state<EVENT_STATE_NORMAL>,time<11:11:34>,source_guid<bd51a40d-1cf2-
e811-8b83-c860008a29f9>
//bacnet_application_tag
var BACNET_APPLICATION_TAG_NULL = 0;
var BACNET_APPLICATION_TAG_BOOLEAN = 1;
var BACNET_APPLICATION_TAG_UNSIGNED_INT = 2;
var BACNET_APPLICATION_TAG_SIGNED_INT = 3;
var BACNET_APPLICATION_TAG_REAL = 4;
var BACNET_APPLICATION_TAG_DOUBLE = 5;
var BACNET_APPLICATION_TAG_OCTET_STRING = 6;
var BACNET_APPLICATION_TAG_CHARACTER_STRING = 7;
var BACNET_APPLICATION_TAG_BIT_STRING = 8;
//bacnet_objtype
var OBJECT_ANALOG_INPUT = 0;
var OBJECT_ANALOG_OUTPUT = 1;
var OBJECT_ANALOG_VALUE = 2;
var OBJECT_BINARY_INPUT = 3;
var OBJECT_BINARY_OUTPUT = 4;
var OBJECT_BINARY_VALUE = 5;
var OBJECT_CHARACTERSTRING_VALUE = 40;
//bacnet_property_id
var PROP_PRESENT_VALUE = 85;
[Link]("BACNETINT|1|READ");
[Link]("bacnet_objtype",OBJECT_ANALOG_INPUT);
[Link]("bacnet_instance",0);
[Link]("bacnet_property_id",PROP_PRESENT_VALUE);
[Link]("bacnet_device_id",123456);
DoReact(msg);
Event:
BACNETINT|1|READ_RESULT|slave_id<example>,fraction<387>,owner<example>,module<[Link]>,date<10-11-21>,
guid_pk<{622928D6-3349-EC11-96F2-309C23D50163}>,core_global<1>,bacnet_value<20,8>,
time<15:26:03>,param0<ok>,source_guid<e8f7ded1-3349-ec11-96f2-309c23d50163>
140
Example with Telegram bot
TELEGRAM Telegram bot
DoReactStr("TELEGRAM",1,"SEND","text<Hello world>,chat_id<828752651>,bot_id<809045046:
AAGtKxtDWu5teRGKW_Li8wFBQuJ-l4A9h38>",longtitude<37.3428359>,latitude<55.6841654>,address<Office>);
141
Examples of scripts with Event Viewer
EVENT_VIEWER Event Viewer
142
Appendix 1. Description of the Editor-Debugger
utility
143
The purpose of the Editor-Debugger utility
The Editor-Debugger utility is used to create, debug and edit scripts in Axxon PSIM.
144
The interface of the Editor-Debugger utility
145
The Editor-Debugger interface
The user interface of the Editor-Debugger utility contains the main menu and the toolbar (1), the objects list (2) and the viewing
/editing panel (3).
146
The Debug-edit script tab
On the page:
The figure below shows the interface of the Debug-edit scrip tab:
Number in the Parameter name Method of setting the parameter Parameter description
image value
1 Settings message Automatically Information about initialization of the Script objects in the
system
147
The Script object in the Debug-edit scrip tab is used to creat and edit scripts and test events.
Number in Parameter Method of setting the Parameter Characters used Default Value range
the image name parameter value description value
1 Script Enter the value into the field Contains the text of Latin, Cyrillic and Blank line Unlimited number of
the script service characters characters
2 Event Enter the value into the field Contains the text of Latin, Cyrillic and Blank line Unlimited number of
the test event service characters characters
148
The Script messages tab
On the page:
The figure below shows the interface of the Script messages tab:
Number in the Parameter name Method of setting the parameter Parameter description
image value
1 Settings message Automatically Information about initialization of the Script objects in the
system
149
The figure below shows the interface of the Script object:
1 Descri Automatically Displays information Latin, Cyrillic Unde By default 200 lines are displayed in the list. You can
ption about events occurring and service fined change the value using the DebugMaxLines registry key (see
in the system characters Registry keys reference guide)
150
151
Main menu
152
Description of the main menu interface
The main menu of the Editor-Debugger utility is used to call the commands executed by the utility. The commands are divided into
groups by functional attributes and are located in the following menu items: File, View, Debug and edit, List of events and Help.
1 File Select the command from the Contains a list of commands for saving and opening scripts, closing the utility
drop-down list
2 View Contains a list of commands for displaying the toolbar and status bar in the utility window
4 List of events Contains a list of commands changing the parameters of message display in the debugging
windows
5 Help Contains the About command. This command displays the window with general information
about the Editor-Debugger utility
153
Description of the File item of the main menu
The File item of the main menu is used to open and save scripts and to close the utility.
2 Save to disk Saves the script to a text file on the hard disk
3 Open from disk Opens the script from the selected text file into the utility editor
4 Exit The command shuts down the utility and closes its dialog window
154
Description of the View item of the main menu
The View item of the main menu is used to call the commands that enable and disable the display of the toolbar and status bar in the
utility window.
1 Toolbar Set the checkbox Enables or disables the display of the toolbar in the utility window Checkbox is
set
2 Status bar Set the checkbox Enables or disables the display of the status bar at the bottom of the Checkbox is
utility window set
155
Description of the Debug and edit item of the
main menu
The Debug and edit item of the main menu is used to call the commands for debugging scripts.
Description of the elements of the Debug and edit item of the main menu:
2 Test run in third-party d Runs the script on a test event using the third-party debugger
ebugger
3 Edit test event Opens the dialog window for editing a test event
4 Summary information Opens the Thread Information window, which displays the system, test and user messages related
to the script being debugged
5 Go to line Opens the dialog window for specifying the number of the character and line in the script text to
which you want to go
156
Description of the List of events item of the main
menu
The List of events item of the main menu is used to change the parameters of the message display in the debugging window.
Descriptions of the elements of the List of events item of the main menu:
2 Highlight Opens the window used to specify words (or other character sequences) in strings containing them, which you
want to highlight in the Description field of the debugging window
3 Search Searches for a word (or other character sequences) in the Description field of the debugging window
4 Set filter Opens the window used to enable and configure a filter. The strings that contain (don't contain) the specified
words must be included in the debugging window (or excluded from it)
157
Description of the Filter dialog window
The Filter dialog window is used to enable and configure message filters displayed in the Description field of the debugging window.
1 Include Enter the value The strings containing the words (or other character Latin, Cyrillic Blank Unlimited
into the text field sequences) specified in this field will be displayed in the and service string number of
debugging window characters characters
2 Exclude Enter the value The strings containing the words (or other character Latin, Cyrillic Blank Unlimited
into the text field sequences) specified in this field will be excluded from the and service string number of
debugging window characters characters
158
Description of the Highlight dialog window
The Highlight dialog window is used to set the color highlighting of the lines containing specified words in the debugging window.
159
Number Parame Method of setting Parameter description Units Defau Value range
in the ter na the parameter lt val
image me value ue
1 String Enter the value into Sets the words (or other character sequences) to Latin, Blank Unlimited
the text field highlight the strings containing them in the debugging Cyrillic and string number of
window service characters
characters
2 Color Select the value Sets the color to highlight strings in the debugging RGB format Gray RGB colors
from the drop- window
down list
160
Description of the toolbar of the Editor-Debugger
utility
The toolbar of the Editor-Debugger utility is used to call the frequently used functions of the utility.
The toolbar operates in two modes: when the script control buttons are active, or when the debugging window control buttons are
active. The mode depends on the currently active tab of the Editor-Debugger utility: either the Debug-edit script tab for editing
scripts, or the Script messages tab for viewing messages in the debugging window.
Interface of the toolbar of the Editor-Debugger utility in the script editing mode:
Description of the interface of the toolbar of the Editor-Debugger utility in the script editing mode:
2 Test run in third- Runs the script on a test event using the third-party debugger
party debugger
4 Edit test event Opens the dialog window for editing test events
5 Summary information Opens the Thread Information window, which displays the system, test and
user messages related to the script being debugged
Interface of the toolbar of the Editor-Debugger utility when working with the debugging window:
Description of the interface of the toolbar of the Editor-Debugger utility when working with the debugging window:
2 Highlight Opens the window used to specify words (or other character sequences) in strings containing them,
which you want to highlight in the Description field of the debugging window
3 Search Searches for a word (or other character sequences) in the Description field of the debugging window
4 Set filter Opens the window used to enable and configure a filter. The strings that contain (don't contain) the
specified words must be included in the debugging window (or excluded from it)
161
Appendix 2. Creating custom objects with ability
to set events, reactions and states
162
Purpose of custom objects and their
implementation in Axxon PSIM
Custom objects represent software emulation of new Axxon PSIM objects and allow for configuring their states, reactions, and events.
You can work with custom objects using scripts, macros and macroevents.
You can create custom objects using the [Link] and [Link] utilities in the <Axxon PSIM installation folder>\Tools.
In the How to create a custom object section, you can find an example of creating two types of custom objects that can be used to
show the state of the abandoned objects detection tool on the map or to show any other user states. The states of objects are changed
using macros, scripts, or via IIDK.
163
How to create a custom object
Here you can find out how to create the following custom objects:
The CUSTOM_CHILD type of the object is created to demonstrate tree structure and has no user parameters, events, reactions or
states.
164
DBI file preparation
A DBI file is prepared using the [Link] utility. Details on how to handle it can be found in The [Link] utility for editing database
templates and external settings files.
A DBI file for the objects of the CUSTOM and CUSTOM_CHILD type is created as follows:
1. Run the [Link] utility (see The [Link] utility for editing database templates and external settings files).
2. Go to the DBI tab.
3. Create two objects—OBJ_CUSTOM and OBJ_CUSTOM_CHILD as shown in the figure below.
Attention!
4. Set the parameters for each object. The id, name, parent_id, flags, guid parameters are mandatory for all objects. Custom
_param1, custom_param2 in the example in the figure are custom parameters. You can also set other parameters used in Ax
xon PSIM. For example, adding the region_id parameter will allow you to set areas and regions for an object (see Subdivision
of the protected facility into areas and regions).
5. Save the changes using the Save command in the File menu. The saved file must have the dbi extension and must be located
in Axxon PSIM installation directory, for example, C:\Program Files (x86)\Axxon PSIM\[Link].
165
DDI file preparation
A DDI file is prepared using the [Link] utility. Details on how to handle it can be found in The [Link] utility for editing database
templates and external settings files.
A DDI file for CUSTOM and CUSTOM_CHILD object types is created as follows:
1. Run the [Link] utility (see The [Link] utility for editing database templates and external settings files).
2. Create CUSTOM and CUSTOM_CHILD objects in the DDI tab, as shown below.
3. Go to the Events tab and configure events that must be supported by the object (see the figure).
4. Go to the Reactions tab and configure reactions that must be supported by the object (see the figure).
Note
Reactions of custom objects are automatically converted into events. In other words, a custom object automatically
generates an event when there is a reaction.
166
5. Go to the States tab and describe the states that the object can take. Here there are two states—ON and OFF.
Note
The postfix of file name is specified in the Image column—the image that is stored in <Axxon PSIM installation
directory>\Bmp. For instance, these will be custom_off.bmp and custom_on.bmp files (corresponding to ON and OFF
states) for CUSTOM object. These files will be used by the map module.
167
6. Go to the Transition rules tab and set the object state change logic.
Transition rules is a simple state machine—an event is an input action and a state is a result.
An unconditional transition is used in this case: if CUSTOM||ON event is received, then there is transition to the ON state, if
CUSTOM||OFF event is received, then there is transition to the OFF state.
7. To save changes use the Save command in the File menu. The saved file must have the ddi extension and be stored in the
folder corresponding to the required language, for example, C:\Program Files (x86)\Axxon PSIM\Languages\en\[Link].
ddi.
168
XML file preparation
An XML file is prepared using the [Link] utility that can be found in <Axxon PSIM installation directory>\Tools. The
general view of the utility window is shown in the figure below.
1. In the object_type field (1), enter the name of the object type.
2. In the parent_type field (2), enter the name of the parent type.
3. If the object type has child types, then set the has_child checkbox (3).
4. Repeat steps 1-3 for all object types.
5. Save the file with any name and .xml extension in the Axxon PSIM installation directory using the File Save command. For
example, the "[Link]" file name is recommended for the object shown on the picture above.
The XML file is now created. The file contents look like this:
<objects>
<object>
<object_type>CUSTOM</object_type>
<parent_type>SLAVE</parent_type>
<has_child>1</has_child>
</object>
<object>
<object_type>CUSTOM_CHILD</object_type>
<parent_type>CUSTOM</parent_type>
</object>
</objects>
In particular, the <include_parent_id>1</include_parent_id> parameter can be added to an XML file. When setting this parameter to
1, the IDs of the child custom objects will include the ID of the parent object. For example, if a CUSTOM object has a child
CUSTOM_CHILD, and the CUSTOM has ID = 3, then CUSTOM_CHILD objects will be created with identifiers 3.1, 3.2, and so on.
169
Creating and using a custom object in Axxon PSIM
On the page:
Attention!
After preparing the required files and before creating custom objects in Axxon PSIM, it is necessary to update the main
database using The [Link] utility for converting databases, selecting database templates and making backup copies of
databases.
When the DBI, DDI and XML files are ready, the objects of a new type along with the standard objects can be created in Axxon PSIM
hardware tree.
Custom parameters are displayed on the settings panel of the created custom object—custom_param1 and custom_param2 in this
example. Their values can be set in the table.
170
Displaying on the map
When an object is created in the hardware tree it can be placed on the map and set reactions can be executed in the object context
menu (see Configuring the interactive map for object state indication and controlling the objects).
Using in macros
When a custom object is created in the hardware tree it can be used in macros.
171
Note
Reactions of custom objects are automatically converted into events. Thus, in the example, when the ON reaction is
executed, the object state changes due to set state transition rules (see DDI file preparation) and the icon corresponding to
the state will be displayed on the map.
Solution. As state transition rules are set, when the ON event is sent from the custom object, the state will be automatically changed
to ON and the icon specified in ddi file (see DDI file preparation) to this state will be displayed on the map. A script for sending the ON
event looks like this:
[Link] = "CUSTOM";
[Link] = "1";
[Link] = "ON";
NotifyEvent(msgevent);
172
Description of events and reactions of system
objects
All reactions for the main objects of the system are specified in this section.
Note
You can view events for system objects in one of the following ways:
1. Viewing the Axxon [Link] file using the [Link] utility (see Getting the list of system names of objects, reactions
and events in Axxon PSIM).
2. Viewing events for the selected system object using the settings panel of the Macro system object (see Creating and
configuring Macro events).
173
GRABBER Video capture device
The Grabber object corresponds to the Video capture device system object.
The Grabber object sends events presented in the table. Procedure is started when the corresponding event occurs.
Events Description
UPS_SHUTTING Shutdown
CONNECT_OK Connected
List of commands and parameters for the Grabber object is presented in the following table:
"SETUP"—sets parameters of video capture device cha Number of PCI slot (0,1,2,…,32).
n<>
174
for Format of video signal (PAL, NTSC)
mat
<>
na Name of object
me
<>
flag Flags
s
<>
ip_ IP port
por
t<>
pas Password
swo
rd<>
use Login
rna
me
<>
"SET_DRIVES"—sets disks for video archive record driv Disks for video archive record
es<>
"SET_IPINT_PARAM"—sets (changes) parameters of an IP device. par Name of parameter. Set of parameters for each
Reaction allows changing of IP device settings wothout doing into its am camera is individual—see Appendix 2. Defining the
web interface. _id param_id and param_value values for the
<> SET_IPINT_PARAM reaction
Note. For the reaction to operate you must enable the multistream
video—Configuration of multistream video, and Appendix 2. Defining par Value of parameter. Set of parameters for each
the param_id and param_value values for the SET_IPINT_PARAM am camera is individual—see Appendix 2. Defining the
reaction _va param_id and param_value values for the
lue SET_IPINT_PARAM reaction
<>
175
"START"—start playing video file in a virtual video capture device - -
"ENABLE"—enable object (clear the Disable checkbox in the object rec Possible parameter values:
settings panel) ursi
ve<> 0—enable only Video capture device
"DISABLE"—disable object (clear the Disable checkbox in the object rec Possible parameter values:
settings panel) ursi
ve<> 0—disable only Video capture device
ID<> Object ID
176
CAM Camera
The CAM object corresponds to the Camera system object.
The CAM object sends the events given in the table. Procedure is started when the corresponding event occurs.
Ev Description Comment
ents
ARM Camera is If arming was performed by the Operator from the Map or Video surveillance monitor, the user_id<>
armed parameter contains the identifier of the user who performed this action
ATT Connecting
ACH
BLI Camera is
NDI sealed
NG
DE Break Event is generated when the input signal from the camera on the video capture device is lost
TA
CH
DIS Camera is If disarming was performed by the Operator from the Map or Video surveillance monitor, the user_id<>
ARM disarmed parameter contains the identifier of the user who performed this action
FIL Error of Event is generated when an error occurs when writing the video archive to disk
E_R recording on
EC_ disk
ER
ROR
MD Alarm
_ST
ART
MD End of alarm
_ST
OP
REC Recording on If recording was initiated by the Operator from the Map or Video surveillance monitor, the user_id<>
disk parameter contains the identifier of the user who performed this action
RE Stop If recording was stopped by the Operator from the Map or Video surveillance monitor, the user_id<>
C_ recording on parameter contains the identifier of the user who performed this action
ST disk
OP
UN Camera is
BLI opened
NDI
NG
RE Record is
CO enabled
RD
ER_
ON
RE Record is
CO disabled
RD
ER_
OFF
177
DIS Disk is
C_ mounted
MO
UNT
DIS Disk is
C_ unmounted
UN
MO
UNT
FIN Video export If the video export fails, the event has the non-null error_result parameter.
ISH is completed
ED In the param<0> parameter there is additional information displayed in the corresponding column of the Eve
_A nt Viewer, in the following format: "ComputerName;ExportPeriod;UserName;UserID", for example,
VI_ param0<LOCALHOST;04-06-18 16:50:55_04-06-18 16:55:55;Smith;1>
EXP
ORT
MD Object count The event is generated when the number of objects detected by the tracker in the frame is exceeded (see Cre
_LI in a frame ating and configuring the Tracker object section of the Administrator's Guide for details on how to set this
MIT exceeded parameter). An event is generated whenever the number of objects is changed (up or down), until it is less
than the threshold.
The object_count<> parameter is the number of objects in the frame that the tracker detected, exceeds the
specified limit, and differs from the previous value.
AR Record Deletion of the record from the camera archive from the Video surveillance monitor
CH deletion
_D
ELE
TE
OP File opening Opening a file for playback by a virtual video capture device. Indicates that playback of the next file from the
EN selected folder starts.
_FI
LE Among others, the event contains the following parameters:
CL File closing Finishing a file playback in a virtual video capture device. Indicates that playback of a file is ended.
OS
E_F Among others, the event contains the following parameters:
ILE
name<> is the name of the file that finished being played back
tss<> is the time in UTC format in milliseconds from 1/1/1970
AR File protected The event is displayed when a user protects the file from being overwritten.
CH from rewriting
_PR The param<0> parameter contains additional information about the computer name, fragment, user name
OT and user id, which is displayed in the Add. Info column in the Event Viewer in the following format:
ECT
ED "ComputerName;ProtectionPeriod;UserName;UserID", for example, param0<LOCALHOST;04-06-18 16:50:
55.612_04-06-18 16:55:55.612;Smith;1>
AR Rewrite The event is displayed when a user removes protection of the file from being overwritten.
CH protection
_U removed from The param<0> parameter contains additional information about the computer name, fragment, user name
NP file and user id, which is displayed in the Add. Info column in the Event Viewer in the following format:
RO
TEC "ComputerName;ProtectionPeriod;UserName;UserID", for example, param0<LOCALHOST;04-06-18 16:50:
TED 55.612_04-06-18 16:55:55.612;Smith;1>
178
FRA Frames The FRAME_SKIPPED event occurs in Axxon PSIM if there are frames skipped when recording to the archive.
ME skipped By default, the event is generated if there were more than 50 frame skips during the testing period. When
_S frame skipping stops, the FRAME_SKIPPED_STOP event is generated. The description of this event contains
KIP information about the number of skipped frames and the time period in which there were skips. By default,
PED both events are generated no more than once every 30 seconds.
FRA End of frames The events are controlled by the following registry keys (see Registry keys reference guide):
ME skipping
_S the FRAME_SKIPPED event can be disabled using the [Link] registry key;
KIP the delay time between the state changes in seconds is specified in the FileSystem.
PE RecordingStateChangeDelay key.
D_ The minimum value is 30 seconds. If you specify a smaller value, the minimum value of 30 seconds will
ST still be used (the key in the registry will be overwritten);
OP the number of skipped frames for the period, during which the FRAME_SKIPPED event will be generated,
is specified in the [Link] key
TE Temperature The param0<> parameter contains the temperature value received from the thermal camera
MP threshold
ER
AT
UR
E_A
LARM
IGN Ignoring The event is generated when a video fragment is deleted from the archive before expiration of the time
OR "Keep no less period set by the Keep no less than parameter. See also Configuring video camera archive depth
E_K than"
EEP
_N
O_L
ESS
AV Availability of The event occurs in response to the GET_AVAILABILITY command and contains information about the
AIL the key number of objects added to the license key for the given position. Parameters:
ABI position in the
LITY license file qty_localpriority<> is the number of allowed objects of the specified type on this computer (local key)
and the qty<> is the total number of allowed objects of the specified type in the license (generic key)
number of pos<> is the position number in the license key
objects
If there is no position in the key, the event will have a zero value
WR Writing error
ITI
NG
_FA
ILED
FIL File system Contains mandatory parameter error_msg<>—error text; can also contain parameters cam<>—camera ID
ESY error and error_code<>—error code. Example:
STE
M_ CAM|-1|FILESYSTEM_FAILED|error_msg<Failed to delete index file: D:\\VIDEO\\INDEX\\[Link], error
FAI code: 5.>,error_code<5>
LED
179
The list of commands and parameters for the CAM object is given in the following table:
SETUP—sets (changes) the parameters of a camera rec_p Record priority (from 0 to 3, 0—standard, 3—all resources)
riority
<>
activit -
y<>
180
blindi Camera is sealed
ng<>
config -
_id<>
decod -
er<>
flags<> Flags
DELETE—disables camera - -
START_VIDEO—enables video stream for the current slave Name of the computer to which the camera is connected
camera _id<>
regist -
er_onl
y<>
STOP_VIDEO—disables video stream for the current slave Name of computer to which camera is connected
camera _id<>
181
ARM—arm camera - -
DISARM—disarm camera - -
REC—start recording from a camera time<> Time of record in seconds, if null than only one frame is recorded
Note. If the specified stream isn't used for any purpose other than
record by command (and custom on clients), make sure that the L
ock disabling streams not in use checkbox is set for it—see Th
e Settings panel of the Camera object
REC_STOP—stop recording from a camera priorit Sets priority of a command to stop recording. See Appendix 1.
y<> Priorities of the start and stop recording commands
SIP_CONNECT—Sip connected - -
SIP_DISCONNECT—Sip disconnected - -
SET_IPINT_PARAM—set (change) the parameters of an para Name of a parameter. Set of parameters for each camera is
IP device. Reaction allows changing the IP device m_id individual—see Appendix 2. Defining the param_id and
settings without going into its web-interface. <> param_value values for the SET_IPINT_PARAM reaction
Note. For reaction operation it is required to enable the para Value of a parameter. Set of parameters for each camera is
mode of multi-flow video signal—see Configuration of m_val individual—see Appendix 2. Defining the param_id and
multistream video and Appendix 2. Defining the ue<> param_value values for the SET_IPINT_PARAM reaction
param_id and param_value values for the
SET_IPINT_PARAM reaction vstrea Number of a video stream (optional parameter). It is given by
m_id “Number of camera”.”Number of a stream”, for example 1.1, 1.2
<>
GET_FRAME—get frame from a camera even if it is not path<> Path to save a frame. If there is no parameter, the FRAME_SENT
displayed in the Video surveillance monitor event with the data parameter will be formed in the system.
Processing of this event is described in The SaveToFile method of
the The Script object. Programming using the JScript language
182
strea Optional parameter. Sets Axxon PSIM stream to get a frame
m<> from. The stream can be specified by a number or purpose.
Possible purposes:
ARCH_DEL_RECORD—delete archive recordings over fromT Mandatory parameter. Time in the YYYY-MM-DDTHH: MM: SS.
the specified period. ime<> NNN format, where NNN—milliseconds. The recordings will be
deleted (starting with the first one containing the specified time
and ending with the last one containing the toTime time). If no
time is specified in the toTime parameter, then only one recording
will be deleted
REC_RESTART—restart recording - -
ARCH_BOOKMARK_RECORD—create a bookmark time1 The date of the archive period beginning included in the
<> bookmark in the DD-MM-YY HH: MM: [Link] format, where NNN
- milliseconds
time2 The date of the archive period ending included in the bookmark in
<> the DD-MM-YY HH: MM: [Link] format, where NNN—
milliseconds
slave Computer and Video surveillance monitor IDs using which the
_id<> bookmark will be created. Parameter format: <computer id>.
<monitor id>.
cam_i Camera ID
d<>
183
GET_DEPTH—get the archive depth. The ARCHIVE_DEP drive Disk or network path to request the archive depth.
TH event from the SLAVE object (see SLAVE Computer) <>
is created in the system as the response to this The disk name is set in the "<disk letter>:\\" format, for example
reaction. If one or both parameters are absent it drive<D:\\>
means that there is the archive depth request for all
possible parameters Note. The "\" character is an escape character.
Example.
DoReactStr("CAM","2","GET_DEPTH","drive<D:\\>,cam<2>,
arch");
Example.
DoReactStr("CAM","1","GET_DEPTH","drive<V:\\>,gate");
CLEAR_SUBTITLES—remove all titles from the video title_i The ID of the Captioner object
image d<>
GET_AVAILABILITY—check the availability of the key pos<> The position number in the license key
position
ID<> Object ID
REGION_ID<> Region ID
184
MONITOR Monitor
The MONITOR object corresponds to the Monitor system object.
The MONITOR object sends events presented in the table. Procedure is started when the corresponding event occurs.
List of commands and parameters for the MONITOR object is presented in the following table:
STARTE Video export started Among others, the event has the following parameters:
D_AVI_E
XPORT slave_id<>—operator who started the export
param1<>—number of camera on which the export is performed, date and time of export
period beginning. The parameter value is like "<RecNo.> Camera <id> (dd-mm-yy hh:mm:
ss)", for example param1<01 Camera 1 (05-10-17 10:23:21)>
time<>—time when export started
FINISHE Video export finished Among others, the event has the following parameters:
D_AVI_E
XPORT slave_id<>—operator who started the export
param1<>—number of camera on which the export is performed, date and time of export
period ending. The parameter value is like "<RecNo.> Camera <id> (dd-mm-yy hh:mm:
ss)", for example param1<01 Camera 1 (05-10-17 10:23:21)>
time<>—time when export ended
param<0>—additional information displayed in the corresponding column of the Event
Viewer, in the following format: "ComputerName;ExportPeriod;UserName;UserID", for
example, param0<LOCALHOST;04-06-18 16:50:55_04-06-18 16:55:55;Smith;1>
AVI_EXP Video export result The event has the same parameters as START_AVI_EXPORT with additional error_result<>
ORT_RE having one of the following values:
SULT
0—export successful
1—unknown
2—busy
3—not ready
4—invalid interval
5—file error
INTERFA Visualization change param<0>—additional information displayed in the corresponding column of the Event Viewer, co
CE_MANI ntains the identifier of the camera that was moved around the layout
PULATION
LAYOUT_ Deleting layout param<0>—additional information displayed in the corresponding column of the Event Viewer, co
DEL ntains the name of the deleted layout
LAYOUT_ Adding layout param<0>—additional information displayed in the corresponding column of the Event Viewer, co
ADD ntains the name of the added layout
LAYOUT_ Changing active param<0>—additional information displayed in the corresponding column of the Event Viewer, co
ACTIVATE layout ntains the name of the activated layout
REPLACE Changing the camera param<0>—additional information displayed in the corresponding column of the Event Viewer,
_CAM position in the following format:
ACTIVAT Camera activated auto_switch<>—indicates whether slide show (auto paging, auto scrolling) was enabled at the
E_CAM time of camera activation. This parameter can be used to turn off slide show when activating a
Video surveillance window
185
CAM_EX The Video The event is generated if the following registry keys are set (see Registry keys reference guide):
PAND Surveillance Window
expanded to the MaximizeCameraOnDblClk=1
entire Monitor MinimizeCameraOnDblClk=1
Event parameters:
param0<>—camera ID
user_id<>—the ID of the user who performed the action
CAM_CO The Video The event is generated if the following registry keys are set (see Registry keys reference guide):
LLAPSE Surveillance Window
collapsed back MaximizeCameraOnDblClk=1
MinimizeCameraOnDblClk=1
Event parameters:
param0<>—camera ID
user_id<>—the ID of the user who performed the action
List of commands and parameters for the MONITOR object is presented in the table:
"REMOVE"—removes camera from monitor cam ID of camera in the settings tree which must be removed from
<> monitor
"STOP_VIDEO"—stops video stream of camera cam ID of a camera in the settings tree, the video stream from which
<> must be stopped
"REPLACE"—removes all cameras from monitor and slav Name of a computer to which monitor belongs, it is possible to place
triggers the specified camera e_id owner in script
<>
audi -
o_ty
pe<>
audi -
o_id
<>
arch -
_id
<>
"ADD_SHOW"—adds cameras on the monitor cam ID of a camera in the settings tree which must be displayed in the
<> monitor
186
Note. See also PLACE_CAM_IN_LAYOUT_CELL
nam Object name which will be displayed in the bottom-left corner
e<>
arch -
_id
<>
gate ID of the videogate through which you want to receive video. The
_id corresponding camera must be added and configured in this videogate—
<> see Selecting and configuring the cameras for the Videogate module
"ACTIVATE_CAM"—activates camera cam ID of a camera in the settings tree which must be activated
<>
date -
<>
time -
<>
com -
pres
s<>
187
pan -
el_t
ype
<>
s<> -
layo -
ut<>
gate -
<>
map -
_id
<>
ena -
ble<>
arch Archive ID
_id
<>
flag Flags
s<>
gstr If the value is not set, the function for stream auto select is disabled
eam
_ver If the value is minBPS, then the stream for displaying is selected
sion automatically as described in Configuring an auto select of video
<> stream for displaying
pan -
el_a
ctiv
e<>
file -
188
"KEY_PRESSED"—controls buttons of video num -
surveillance monitor and video records archive ber
<>
cam The ID of the camera to the Video surveillance window of which the
_id command must be applied. If the identifier is not specified, the
<> command is applied to the active Video surveillance window (see Activ
e Surveillance window)
"ARCH_EDIT_BACK";
"ARCH_EDIT_REPLACE";
"ZOOM_IN"—image incoming;
"ZOOM_OUT"—image removal;
"MASK_SHOW"—show mask;
"MASK_HIDE"—remove mask;
"ARM"—arm camera;
"DISARM"—disarm camera;
"REW"—rewind;
"PLAY"—play;
"PLAY_NONSTOP"—non-stop playback;
"FF"—fast forward;
"RECORD"—record;
"STOP"—stop;
"REC_STOP"—stop record;
189
"PAUSE"—pause;
"MIC_ON"—microphone On;
"MIC_OFF"—microphone Off;
190
"START_AVI_EXPORT"—starts video export start Start time
<>
Note. See the examples in Examples with Cameras
and Video surveillance monitors finis End time
h<>
cam Camera ID
<>
"CONTROL_TELEMETRY"—Telemetry control. cam ID of a camera on which you want to enable or disable the mouse
<> PTZ control
See Mouse PTZ control
on<> 0—disable mouse PTZ control
"RESET_ARCH_ENTER_PAUSE"—disable playback - -
pause when entering the archive.
191
"GO_ARCH"—switch all cameras on the monitor to arch Optional parameter. Sets the time position in the archive in the DD-
archive mode _tim MM-YY HH:MM:SS format. By default, the archive is positioned on the
e<> last record
PLACE_CAM_IN_LAYOUT_CELL—add camera to the cam ID of a camera in the objects tree which must be displayed in the
specific cell on the specific layout on the Monitor <> monitor. If the parameter value is incorrect, for example, 0 or -1,
then the corresponding cell will be hidden
cell The number of the cell on the layout to which the camera must be
<> added. Cells are numbered from top to bottom left to right, starting
from the top-left corner of the layout.
If some other camera has already been added to the specified cell, it
will be replaced
SET_TITLES—shows captions over a video image in cam The ID of a camera to the Video surveillance window of which the
any display mode. Such captions are not archived <> command must be applied
and are displayed until CLEAR_TITLES command is
applied or Monitor is reset title The caption text that must be displayed. Use '\r' to break the line
s<>
title Captioner ID
_id
<>
CLEAR_TITLES—disable the captions created with the cam The ID of a camera to the Video surveillance window of which the
help of the SET_TITLES command <> command must be applied
title Captioner ID
_id
<>
ID<> Object ID
192
MACRO Macro
The MACRO object corresponds to the Macro system object.
The MACRO object sends events presented in the table. Procedure is started when the corresponding event occurs.
R Action src_ The name of the computer on which the macro was executed.
UN is send
perfor er<> Note. The value of this parameter is displayed in the Add. info column of the Event Viewer in real time. When Axxon PSIM is
med restarted and event log records are loaded from the database, this information is not displayed in the interface, but remains in
the database
List of commands and parameters for the MACRO object is presented in the following table:
"RUN"—performs an action - -
flags<> Flags
ID<> Object ID
"NORM" Normal
193
SLAVE Computer
The SLAVE object corresponds to the Computer system object.
The SLAVE object sends events presented in the table. Procedure is started when the corresponding event occurs.
DISCO Disconnecti Event is generated when a Client is disconnected from the Server
NNECT ng
ED
KEY_I Key Event is generated if codes of cards (or HID) in the key mismatch to current codes of computer
GNORE ignored
D_HW (mismatch
of card
codes)
KEY_I Key Event is generated if there software limitations. For example, if key is accepted but number of created
GNORE ignored objects in the objects tree is more than specified in the key
D_SW (limitation
exceeded)
KEY_U Key
PDATED updated
PROTO Protocol
COL_R received
CVD
REBUI Start of
LD_IN archive re-
_START indexing
REBUI End of
LD_IN archive re-
_STOP indexing
REGIS Attempt of
TER_A unauthorize
TTEMPT d access
REGIS Limit of Event is generated when user failed to enter the system a lot of times. Some timeout is started after the
TER_E access event when user can’t try to enter the system. Number of attempts and timeout can be changed using
RROR attempts is registry
exceeded
REGIS User This event is generated when user tries to enter the system (when entering login and password)
TER_U registration
SER
NO_DI There is no
SC disk for
archive
record
KEY_I Key ignored Event is generated in case of key file is not recorded on the disc
GNORE
D_FR
SHUTD Shutdown
OWN
194
DISC_ Disc
MOUNT connected
(mounted)
DISC_ Disc
UNMO disconnecte
UNT d
(unmounted)
ARCHI Archive Event is generated at midnight and contains information about archive depth on all disks in hours (the
VE_DE depth depth<> parameter). To call the event manually, use the GET_DEPTH reaction.
PTH
Archive depth in the Days:Hours format is specified in the Additional information field of the Event Viewer
when displaying an event. Also this information contains in parameter of the param0<> event.
Archive depth is counted as discrepancy between date of creation the oldest archive file and date of creation
the newest archive file (on disk or by camera)
FORCE Forced The event is generated before the forced unload of Axxon PSIM, for example, if the Guardant security key is
D_OFF offload removed. Unload is performed after the action caused it (for example, removing the Guardant key) after the
time specified by the UnloadDelay registry key—see Registry keys reference guide
DEACT Hide all The event is generated when Hide all command is executed on a computer set in slave<> parameter. If
IVATE displays except<> parameter is present, all displays except the one specified in this parameter are hidden
_ALL_
DISP
LIC_EX License Not generated by default. Set NotifyExpireLic = 1 to enable (see Registry keys reference guide).
PIRATI expires in
ON The days<> parameter shows the number of days left till license expiration (can be non-integer). The event
is generated at Axxon PSIM start-up and when the day changes
DATAB Database The event is generated when the connection to SQL Server is lost the first time it is accessed after the
ASE_E connection disconnection
RROR lost
SCRIP Script By default, the event is not generated, since it is not added to the [Link] external settings file. In order for
T_ERR execution the SCRIPT_ERROR event to be generated and added to the PROTOCOL table, it must be added to the psim.
OR failed ddi table (see Editing the external setting file (Axxon [Link]) using the [Link] utility)
List of commands and parameters for the SLAVE object is presented in the following table:
fla Flags
gs
<>
195
con Connection
nec
tio
n<>
is_ Backup
bac
ku
p<>
is_l Loaded
oad
<>
mo Modem connection
de
m<>
na Object name
me
<>
pas Password
sw
ord
<>
"BACKUP"—backup database - -
196
"SYNC_TIME"—synchronize time. To perform this reaction it is required to create - -
SyncTime parameter with value 1 on the system to which reaction was addressed in
the HKEY_LOCAL_MACHINE\SOFTWARE\AxxonSoft\PSIM
(HKEY_LOCAL_MACHINE\Software\Wow6432Node\AxxonSoft\PSIM registry section
for 64-bits system)
to<> Recipient
"GET_DEPTH"—get archive depth. The ARCHIVE_DEPTH event (see table below) is ca Camera ID for which archive depth is
formed in response to reaction in system. Absence of one or both parameters m<> required
concedes request of depth by records for all values of parameter
dri Disk or network path on which archive
ve depth is required.
<>
Name of disk is specified in the
following format: "<letter of disk>:\\",
for example drive<D:\\>
"ACTIVATE_DISPLAY"—change the display. The command allows showing the Display dis The identifier of the corresponding Dis
with the given identifier on the monitor (monitors) of the computer pla play object. If an empty value is
y_i passed to the parameter, then all
d<> displays are hidden when running this
command
ID<> Object ID
USER_ID<> User ID
197
DISPLAY Display
The DISPLAY object corresponds to the Display system object.
The events presented in the table come from the DISPLAY object. Procedures are run when the corresponding event occurs.
Event Description
ACTIVATED Display is activated on the remote computer. The computer name is transferred in the param0 <> parameter
List of commands and parameters for the DISAPLY object is presented in the following table:
Note
If the "macro_slave_id" parameter is not set, the command will be performed for all computers in the system.
flags Flags
id Object ID
198
PLAYER Audio player
The PLAYER object corresponds to the Audio player system object.
List of commands and parameters for the PLAYER object is presented in the table.
"PLAY_WAV"—plays file<> Full path to the audio file in the .wav format (with the name of the file being played back. For
back the audio file example: C:\Program Files (x86)\Axxon PSIM\Wav\cam_alarm_1.wav)
from_m Response flag of the audio file being played back. The response is sent from the macro
acro<ID> (specifying the ID of the existing macro, ID > 0).
Note. The parameter isn't mandatory if the voice notification channel is configured in the Audio
player object interface (see Setting up the voice notification using Audio player object)
"STOP_WAV"—stops - -
audio file playback
ID<> Object ID
199
CORE
The CORE object is the core of the system, a global static object that implements methods used to control the state and manage
system objects of Axxon PSIM. The extended possibilities for working with the CORE object are given when using scripts in the JScript
programming language—see The Script object. Programming using the JScript language.
Eve Description
nt
DO_ Event triggers the reaction of some object in the system. The action parameter of this event contains a description of the
REA action that must be performed. Examples of values of the action parameter:
CT
SET_MARKRECT—sent when a face is recognized on the video image;
Other event parameters may also be present that can be monitored using the Debug window (see The Debug window). If the
value of the is SET_MARKRECT, then the param5_val parameter contains the number of the camera on which the face was
detected in the video image. This is indicated by the name of the parameter forwarded in the param5_name parameter.
For the DEL_MARKRECT value, the number of the camera is forwarding in the param0_val parameter
SLA Event is generated when Failover service becomes active. It consists of the following parameters:
VE_
CHA old_slave_id—ID of the Computer object from which cameras are transferred
NGED new_slave_id—ID of the Computer object to which cameras are are transferred
CAM<n1, n2, ... >—where n1, n2, and so on are IDs of cameras transferred to another Computer parent object. For
example, CAM<4,6,7>—transfer cameras with IDs 4, 6, 7
200
MAP Map
The MAP object corresponds to the Map system object.
The MAP object sends the events presented in the table. The procedure is started when the corresponding event occurs.
Event Description
LAYER_ACTIVA Layer activation. This event is received when a layer is selected on the Map. The obj_id<> parameter has the ID
TED of the activated layer
ACTIVATE_OBJ Object activation. The event is received when an object is selected (activated by mouse click) on the Map.
ECT
Parameters:
OBJDBLCLK The event is received when you double click an object on the Map. Contains the same parameters as ACTIVATE_OB
JECT
The list of commands and parameters for the MAP object is presented in the table.
SET_TOPMOST—Se - -
t topmost
SET_NOTOPMOST - -
—Cancel topmost
HIDE_OBJECT—Hid objty Object type. Can be left blank. If the object type is not set, then objects of all types are hidden/shown
e/show object icon pe<>
on the map
objid Object ID. Can be left blank. If the object ID is not set, then all objects of the specified type are
<> hidden/shown
x<> New coordinate of the top left corner of the object icon on the map layer along the X axis in pixels
y<> New coordinate of the top left corner of the object icon on the map layer along the Y axis in pixels
201
exclu By default, when using the SET_OBJECT_GEOMETRY reaction, when moving the object icons, the
de_c names of these objects (child objects) also move. If you pass the exclude_children <1> parameter in
hildre the reaction, then the object is moved separately from the children, that is, without their names
n<>
INSCRIBE—Inscrib - -
e to window
SHOW_MINIMAP x<> The coordinate of the top left corner of the minimap along the X axis in pixels
—Show a minimap
y<> The coordinate of the top left corner of the minimap along the Y axis in pixels
moni Monitor ID
tor<>
layer Map layer ID. If the parameter is set, the script will work on the specified layer. If the parameter is
<> not set, the scrip will work on the current layer
DRAW_ARROW— first_ Type of the object from which a track will be made
Draw a track of obj_t
movement between ype<>
objects
first_ ID of the object from which a track will be made
obj_i
d<>
title_ Text that will be displayed next to the track. \n is used for line break.
text<>
Additional optional parameters:
title_text_align—shift of the text. 0—text is displayed in the center, 1—at the beginning of the
track, 2—at the end of the track
title_text_size—size of the text
title_shift_by_y—shift down of the text (may be needed when using title_text_size). Default is 40
pixels
title_text_color—color of the text in Decimal format
title_text_font—font of the text
Example:
202
ERASE_ARROW— obj_id ID of the track that must be erased. If you don't specify the parameter, all tracks will be erased
Erase a track of <>
movement between
objects
1. When executing the command, a track will be displayed on each layer of the Map as arrows between the objects.
2. If the objects are located on the same layer, the arrow is drawn directly between the specified objects. If the objects are
located on different layers, the arrow is drawn by the shortest path.
3. You can limit the depth of searching for connections between layers to make a track with the DrowArrowSearchDepth key, see
Registry keys reference guide.
4. If
a. it isn't possible to make a track,
b. one of the objects doesn't exist,
c. it is possible to make a track, but the arrows cannot be displayed,
then the icon will be displayed on the first object, and the icon will be displayed on the second object.
203
OLXA_LINE Microphone
The OLXA_LINE object corresponds to the Microphone system object.
The OLXA_LINE object sends events presented in the table. Procedure is started when the corresponding event occurs.
Event Description
ARM Recording is on
List of commands and parameters for the OLXA_LINE object is presented in the following table:
"ARM"—microphone is recording - -
amp<> Amplification
flags<> Flags
ID<> Object ID
204
"GREEN" No signal from microphone
205
TELEMETRY PTZ device
The TELEMETRY object corresponds to the PTZ device system object.
The TELEMETRY object sends events presented in the table. The procedure is started when the corresponding event occurs.
LOCKED Locked Event is received after the LOCK command (see the table below)
UNLOCKED Unlocked Event is received after the UNLOCK command (see the table below)
List of commands and parameters for the TELEMETRY object is presented in the following table:
pre Preset
set
<>
D2OFF—disable the additional dynamic settings tel Priority (1—low, 2—medium, 3—high)
for Panasonic PTZ video cameras used to _pr
increase the quality of analog video signal ior
<>
D2ON—enable the additional dynamic settings tel Priority (1—low, 2—medium, 3—high)
for Panasonic PTZ video cameras used to _pr
increase the quality of analog video signal ior
<>
DOWN—rotate video camera lens down tel Priority (1—low, 2—medium, 3—high)
_pr
ior
<>
206
FOCUS_IN—zoom in tel Priority (1—low, 2—medium, 3—high)
_pr
ior
<>
GO_PRESET—rotate video camera to the position tel Priority (1—low, 2—medium, 3—high)
specified on the preset _pr
ior
<>
pre Preset
set
<>
HOME—rotate video camera to the initial (home) tel Priority (1—low, 2—medium, 3—high)
position _pr
ior
<>
LEFT—rotate video camera lens to the left tel Priority (1—low, 2—medium, 3—high)
_pr
ior
<>
LEFT_DOWN—rotate video camera lens to the tel Priority (1—low, 2—medium, 3—high)
left and down _pr
ior
<>
LEFT_UP—rotate video camera lens to the left tel Priority (1—low, 2—medium, 3—high)
and up _pr
ior
<>
207
PATROL_STOP—stop patrolling tel Priority (1—low, 2—medium, 3—high)
_pr
ior
<>
RIGHT—rotate video camera lens to the right tel Priority (1—low, 2—medium, 3—high)
_pr
ior
<>
RIGHT_DOWN—rotate video camera lens to the tel Priority (1—low, 2—medium, 3—high)
right and down _pr
ior
<>
RIGHT_UP—rotate video camera lens to the right tel Priority (1—low, 2—medium, 3—high)
and up _pr
ior
<>
pre Preset
set
<>
STOP—stop video camera lens rotation tel Priority (1—low, 2—medium, 3—high)
_pr
ior
<>
ca Camera ID to control
m<>
spe Speed
ed
<>
tel Priority (1—low, 2—medium, 3—high). The value of the parameter must
_pr be greater than 0
ior
<>
208
LOCK—lock. Switch the telemetry over to the tel Priority (1—low, 2—medium, 3—high). The value of the parameter must
LOCKED state for a specified time _pr be greater than 0. It is forbidden to perform control commands with a
ior lower priority than the specified during the lock time
<>
dur Lock duration. If the parameter is not specified, the lock is valid until the
atio UNLOCK command is executed
n<>
LOCKED—locked Control of telemetry is locked with some priority. It is forbidden to control telemetry with a priority lower
than the specified when locking (see the table above)
209
TELEMETRY_EXT Keyboard
The TELEMETRY_EXT object corresponds to the Keyboard system object.
The TELEMETRY_EXT object sends events presented in the table. Procedure is started when the corresponding event occurs.
KEY_PR Key is param Code of pressed key See Installing and configuring security system components guide
ESSED pressed 0<>
KEY_REL Key is param Code of released key 0..21 for AXIS T8312.
EASED released 0<>
For BOSCH KBD-Digital, BOSCH KBD-Universal and Panasonic WV-CU950 see Installi
ng and configuring security system components guide
MOVED Position is param Bias value For wheel of JogDial rotary switch -1.. 1; for wheel of frame-by-frame scrolling
changed 0<> Shuttle -7..7
List of commands and parameters for the TELEMETRY_EXT object is presented in the following table:
y1<> Start coordinate on Y axis (from 0 to 239 for main display, from 0 to 31 for
status display)
x2<> End coordinate on X axis (from 0 to 127 for main display, from 0 to 121 for
status display)
y2<> End coordinate on Y axis (from 0 to 239 for main display, from 0 to 31 for
status display)
y<> Coordinate on Y axis (from 0 to 239 for main display, from 0 to 31 for
status display)
210
chars Coding:
et<>
0—Latin
1—Cyrillic
2—Central European
style Style:
<>
0—Normal
1—Semi-bold
"PRINT_TEXT"—print text on display of Panaso y<> 0—display text on the first line
nic WV-CU950 telemetry panel
1—display text on the second line
0—flashing disabled
"RELE_ON"—turn on the light on the AXIS rele<> Code of key with the light, 12..16 for AXIS T8312.
T8312 keyboard or Panasonic WV-CU950
panel For Panasonic WV-CU950 see Installing and configuring security system
components guide, section Features of Panasonic WV-CU950 control panel
configuration and operation
211
"RELE_OFF"—turn off the light on the AXIS rele<> Code of key with the light, 12..16
T8312 keyboard or Panasonic WV-CU950
panel
4—reset after 1 s
F—alarm signal
212
JOYSTICK Control device
The JOYSTICK object corresponds to the Control device object.
The JOYSTICK object sends the events presented in the table. The procedure is started when the corresponding event occurs.
cam<> Camera ID
213
TIME_ZONE Time zone
The TIME_ZONE object corresponds to the Time zone system object.
The TIME_ZONE object sends events presented in the table. Procedure is started when the corresponding event occurs.
Event Descriptio
n
ACTIVATE Start
DEACTIVATE End
List of commands and parameters for the TIME_ZONE object is presented in the following table:
flags<> Flags
ID<> Object ID
"ACTIVATE" Active
"INACTIVE" Inactive
214
ARCH Backup archive
The ARCH object corresponds to the Backup archive system object.
The ARCH object sends events presented in the table. Procedure is started when the corresponding event occurs.
ACTIVE Backup archive is active Event is generated when a list of cameras, the video from which is archived, corresponds to
the list of Backup archive configuration
INACTIVE Backup archive is Event is generated when archiving via Backup archive is not performed.
inactive
ACTIVE_ Partial operation of Back Event is generated when archiving is enabled not for all cameras specified in the list of Backup
PART up archive archive.
215
FAILOVER Failover service
The FAILOVER object corresponds to the Failover service object.
Events from the FAILOVER object are given in the table. Procedure is started when the corresponding event occurs.
Event Description
The list of commands and parameters for the FAILOVER object is presented in the table below:
FORCED_START—forced transfer of the main The reverse configuration transfer is performed using the FORCED_STOP
Server configuration to the backup Server command or upon restarting/reconnecting the main Server
216
OPERATORPROTOCOL Operator protocol
The OPERATORPROTOCOL object corresponds to the Operator protocol system object.
Find events from the OPERATORPROTOCOL object in the table. Procedures are started when the corresponding event occurs.
CREATE Operator clicked the Create button on the Crea The user_id<> parameter contains the user ID. The initial_date<> and
_REPORT te report tab final_date<> parameters specify the initial and final dates selected in
the interface
The list of commands and parameters for the OPERATORPROTOCOL object is given in the table.
DEL_ALARM—delete an alarm objtype<> Object type (for example, CAM, GRELE, and so
on)
objid<> Object ID
HIDE_BUTTON – hide the buttons used to assign status to an button<> Names of the buttons separated by comma:
event
alarm—Alarm situation
suspicious—Suspicious situation
false—False alarm
button<alarm,suspicious,false>
217
objid<> Object ID
218
EVENT_VIEWER Event Viewer
The EVENT_VIEWER object corresponds to the Event Viewer system object.
The EVENT_VIEWER object sends events given in the table. Procedure is started when the corresponding event occurs.
Events Description
CREATE_ Generated if the GenerateEventInsteadOfReport registry key is set to 1 and the operator selected the "Show report"
REPORT command. The report does not open. See also Registry keys reference guide
List of commands and parameters for the Event Viewer object is presented in the following table:
"SET_FILTERS"—activate the filter0<>, The name of the filter created in the Event Viewer. If you need to specify several filters,
Event Viewer filter filter1<>, then the parameter numeration (0, 1, 2, etc.) must go in order starting with filter0<>.
filter2<>, Note that the numbers should not be skipped. See Examples of scripts with Event
etc. Viewer
219
GATE Videogate
The GATE object corresponds to the Videogate system object.
The GATE object sends events presented in the table. Procedure is started when the corresponding event occurs.
ACTIVE Gate is active Event is generated when the list of working cameras corresponds to the list of the
Videogate configuration
INACTIVE Gate is inactive Event is generated when there are no requests for video streams through the
Videogate
ACTIVE_PART Partial operation of gate Event is generated when the number of working cameras is less than in the Videogate
list
The list of commands and parameters for the GATE object is presented in the table.
START_VIDEO—enable camera cam<> Identifier of the camera by The commands work even if the Monitor doesn't display the
video stream and start writing to which it is necessary to start selected camera.
the archive or stop recording
The commands work if constant recording and active camera
STOP_VIDEO—stop camera recording is enabled in the Videogate—see Configuring the
video stream and stop writing to recording to the Videogate archive
the archive
220
CAM_VMDA_DETECTOR VMDA detection
The CAM_VMDA_DETECTOR object corresponds to the VMDA detection system object.
The CAM_VMDA_DETECTOR object sends events presented in the table. Procedure is started when the corresponding event occurs.
ALARM Alarm native_t To enable this parameter, set the following registry keys: [Link], VMDA.
ype<> determineGivenTaken, [Link] (see Registry keys reference guide).
Available values:
0—other
1—human or group of people (depending on the native_value<> parameter: if 1, human; if >1, group of
people)
2—car
3—noise
native_v To enable this parameter, set the following registry keys: [Link], VMDA.
alue<> determineGivenTaken, [Link] (see Registry keys reference guide).
People counter for the "human" object type. Allows determining the quantity of people in the group. For
other object types it is equal to -1
param0<> String value containing the event parameters from the VMDA detection
List of commands and parameters for the CAM_VMDA_DETECTOR object is presented in the following table:
ARM—arm detection - -
DISARM—disarm detection - -
Note
If cameras are connected using ONVIF Server, the events from the VMDA detection and other smart detection tools will be
transferred as events from embedded detection tools—see CAM_IP_DETECTOR Embedded detection.
221
TITLEVIEWER Captions search
The TITLEVIEWER object corresponds to the Captions search system object.
The events given in the table come from the TITLEVIEWER object. Procedures are started when the corresponding event occurs.
GO_VID Video request <cam> The ID of the camera where the captions The event is generated when left double-clicking the
EO were found search result line
<date> Date
<time> Time
222
PERSON User
The PERSON object corresponds to the User system object.
The events presented in the table come from the PERSON object. Procedures are started when the corresponding event occurs.
Event Description
223
CAM_FACECAPTURE Face Detection
The CAM_FACECAPTURE object corresponds to the Face Detection system object.
The CAM_FACECAPTURE object sends the events presented in the table below. The procedure is started when the corresponding
event occurs.
The list of parameters for the CAM_FACECAPTURE object is presented in the table:
owner The name of the server where the face was captured/lost
param0 Same as the guid parameter. Used to display the information in the "Add. info" column of the Event Viewer
224
IPSTORAGE Edge storage
The IPSTORAGE object corresponds to the Edge storage system object.
The list of parameters and commands for the IPSTORAGE object is presented in the table:
IMPORT—import of the missing part of the cam Camera ID The command is used if automatic import for the Edge storage
archive for the specified period <> was not successful.
datet Date and time to start import Note. If import is performed at the time of sending the
ime_ from in the following format: reaction, the command will not be executed. To abort the
from <DD-MM-YY HH:MM:SS> current import task, first send the UPDATE_TIME command
<>
UPDATE_TIME—stop synchronization and cam Camera ID The command is used to stop the current import task and
set the time of the last import from the <> execute the IMPORT command to synchronize the specified
edge storage in the [Link] file archive period
datet Date and time of the last
ime<> synchronization to be set in
the [Link] file
225
CAM_TITLE Captioner
The CAM_TITLE object corresponds to the Captioner system object.
The list of commands and parameters for the CAM_TITLE object is given in the table:
"REINDEX"—run the captions database Captions database re-indexation is run at any value of the _id_ parameter in the DoReact(
update ) command
226
TELEGRAM Telegram bot
The TELEGRAM object corresponds to the Telegram bot system object.
The TELEGRAM object sends events presented in the table. The procedure is started when the corresponding event occurs.
ERROR Message sending error The error<> parameter contains a test description of the error
The list of commands and parameters for the TELEGRAM object is given in the table:
227
CAM_IP_DETECTOR Embedded detection
The CAM_IP_DETECTOR object corresponds to the Embedded detection system object.
The CAM_IP_DETECTOR object sends events given in the table. Procedure is started when the corresponding event occurs.
Ev Event Comment
en s
ts descr
iption
DE Event The event occurs when metadata is received from embedded detection tools. For example, this event occurs when
TE receiving the data on body temperature from a thermal camera, and so on.
CT
ED The event also occurs if the data from detection tools is transferred using Onvif.
The param0<> parameter has a string value containing the event parameters. The transferred parameters depend on
the embedded detection tool. If you use Onvif, you can configure the contents of the parameter on the Event settings
tab of the ONVIF-Server object (see Filtering the ONVIF-Server events)
Example 1
Example 2
228
SIP_TERMINAL SIP-terminal
The SIP_TERMINAL object corresponds to the SIP-terminal system object.
The SIP_TERMINAL object sends events given in the table. Procedure is started when the corresponding event occurs.
Event Description Contents of the param0<> parameter displayed in the Add. info field in the Event Viewer
CALL_END Operator call Numbers of the subscribers and call duration. For example, if the parameter takes the "903 to 906 (01:
_OPERAT end 04)" value, it means that the subscriber 903 called the subscriber 906, and the call lasted 1 minute and
OR 4 seconds
CALL_END Special
_VIRTUAL number call
end
CALL_BEG Call start Numbers of the subscribers: the subscriber who is calling and the subscriber who is being called
IN
CALL_BEG Start of
IN_VIRTU special
AL number call
CALL_TRY Special
ING_VIRT number call
UAL attempt
229
INC_MANAGER Incident manager
The INC_MANAGER object corresponds to the Incident manager system object.
The INC_MANAGER object sends events given in the table. Procedures are started when the corresponding event occurs.
CLOSE_C Click the Close button in the The event is generated when an incident is closed
LICK interface without being processed by the operator in the Incident
manager interface
CLOSE_A Click the Close all button in The event is generated when all incidents are closed
LL_CLICK the interface without being processed by the operator in the Incident
manager interface
SELECT Click an incident in the The event is generated if the operator left-clicks or right-
interface clicks the incident in the Incident manager interface
ACTIVATE The operator selected the alarm_time<> Time when the event
_EVENT event (click the event with the occurred
mouse)
event_guid<> Event ID (generated
randomly for each event)
230
INC_SERVER Incident server
The INC_SERVER object corresponds to the Incident server system object.
The INC_SERVER object sends events presented in the table. The procedure is started when the corresponding event occurs.
The list of commands and parameters for the INC_SERVER object is presented in the table.
UPDATE_STATUS—change the status of the event pks<> Array of event identifiers Parameters are filters and the presence of at
(incident) in the Incident manager least one parameter is mandatory.
objtypes<> Objects types
Parameter values can be specified with a
objids<> Objects identifiers
delimiter. This means that one OR the other
actions<> Actions value will be selected.
0—Waiting to be
processed
1—Processing
2—Suspended
3—Completed
1—Escalated
231
DIALOG Operator query panel
The DIALOG object corresponds to the Operator query panel system object:
List of commands and parameters for the DIALOG object is presented in the table:
"SETUP"—set up the operator query panel x<> Coordinate of left top corner (0–100)
232
MMS Mail Message Service
The MMS object corresponds to the Mail Message Service system object.
The MMS object sends events presented in the table. Procedure is started when the corresponding event occurs.
Event Description
List of commands and parameters for the MMS object is given in the table:
"SETUP"—settings for the mail message service smtp<> Address of the SMTP server
smtp_username<> Username
smtp_password<> Password
flags<> Flags
ID<> Object ID
233
MAIL_MESSAGE Mail message
The MAIL_MESSAGE object corresponds to the Mail message system object.
The MAIL_MESSAGE object sends events presented in the table. Procedure is started when the corresponding event occurs.
Event Description
List of commands and parameters for the MAIL_MESSAGE object is given in the table:
cc<> Copies
attachments<> Attachments. If several files are attached, their addresses are separated with a
semicolon
flags<> Flags
is_body_html<> Specifies if HTML markup must be applied when sending. Possible values: 1 or 0
inline<> Specifies if attachments are only shown in the message text (value of 1) or both in
the text and in the "Attachments" section (value of 0)
"SEND"—send mail - -
message
"SEND_RAW"—send same as for the see Examples of scripts in the JScript language
email with parameters SETUP command
ID<> Object ID
234
VMS Voice Message Service
The VMS object corresponds to the Voice Message Service system object.
List of commands and parameters for the VMS object is presented in the table:
flags<> Flags
ID<> Object ID
235
GRELE Relay
The GRELE object corresponds to the Relay system object.
The GRELE object sends events presented in the table. Procedure is started when the corresponding event occurs.
Event Description
ON Relay is on
List of commands and parameters for the GRELE object is presented in the table:
"ON"—enable relay - -
"OFF"—disable relay - -
flags<> Flags
ID<> Object ID
REGION_ID<> Region ID
"ON" Relay is on
236
GRAY Sensor
The GRAY object corresponds to the Sensor system object.
The GRAY object sends events presented in the table. Procedure is started when the corresponding event occurs.
ALARM Alarm. This event is received when the sensor is opened or closed (it depends on object settings) if sensor is armed. If
sensor is disarmed, then Sensor opened and Sensor closed events are received respectively
OFF Sensor is opened. This event is received when the sensor is opened if the sensor is disarmed
ON Sensor is closed. This event is received when the sensor is closed if the sensor is disarmed
List of commands and parameters for the GRAY object is presented in the table:
“CONFIRM”—confirm an alarm - -
flags<> Flags
ID<> Object ID
REGION_ID<> Region ID
"ALARMED" Alarm
237
“OFF” Normal
238
VNS Voice notification service
The VNS object corresponds to the Voice notification service system object.
List of commands and parameters for the VNS object is presented in the table:
Command— P Description
command ar
description a
m
et
ers
ch Set of sound channels. Possible values of the parameter: 0—no sound channel; 1—left playback channel; 2—right
a playback channel; 3—left and right playback channels (both channels)
n
n
el
<>
fl Flags
a
gs
<>
n Object name
a
m
e
<>
p Password
as
s
<>
us Username
er
<>
"PLAY"—play fil Full path to the audio file in .wav format (indicating the name of the file being played. For example: C:\Program
audio file e Files (x86)\Axxon PSIM\Wav\cam_alarm_1.wav).
<>
Note. If only file name is specified, the default path to the file will be taken from the InstallPath registry key in
the HKEY_LOCAL_MACHINE\SOFTWARE\AxxonSoft\PSIM section (HKEY_LOCAL_MACHINE
\Software\Wow6432Node\AxxonSoft\PSIM for 64-bits system), in value of the InstallPath parameter. In this
parameter, it is possible to play several audio files using the "+" operation
"STOP"—stop - -
playing
audio file
ID<> Object ID
239
PARENT_ID<> Parent object ID
240
SMS Short Message Service
The SMS object corresponds to the Short Message Service system object.
The SMS object sends events presented in the table. Procedure is started when the corresponding event occurs.
RECE Message is If the event doesn't occur when a message is received on the modem, you must use the ProcessFromSim
IVE received registry key (see Registry keys reference guide).
The message<> message parameter contains the text of the sent message.
The parameter phone<> contains the phone number from which the message was sent, in the
+7XXXXXXXXXX format
List of commands and parameters for the SMS object is presented in the table:
flags<> Flags
ID<> Object ID
241
SSS_WATCHDOG System restart service
The SSS_WATCHDOG object corresponds to the System restart service system object.
The SSS_WATCHDOG object sends events presented in the table. Procedure is started when the corresponding event occurs.
Event Description
List of commands and parameters for the SSS_WATCHDOG object is presented in the table:
"SETUP"—set parameters for the system restart service name<> Object name
flags<> Flags
ID<> Object ID
242
BACNET BacNet
The BACNET object corresponds to the BacNet system object.
The BACNET object sends events presented in the table. Procedures are started when the corresponding event occurs.
The list of commands and parameters for the BACNET object is presented in the table:
WRITE—send a value to the BACnet device bacnet_application_tag<> Data type. Possible values:
NULL = 0
BOOLEAN = 1
UNSIGNED INT = 2
SIGNED INT = 3
REAL = 4
DOUBLE = 5
OCTET STRING = 6
CHARACTER STRING = 7
BIT STRING = 8
ANALOG INPUT = 0
ANALOG OUTPUT = 1
ANALOG VALUE = 2
BINARY INPUT = 3
BINARY OUTPUT = 4
BINARY VALUE = 5
bacnet_property_id<> Property ID
243
Description of the object model in Axxon PSIM
244
The Core object and its built-in methods
245
The Core object
The Core object is a core of the system, a global static object that implements the methods used to control the state and monitor the
system objects of Axxon PSIM. The methods of the Core object allow you to receive information about the registered system objects,
generate reactions for them and change their states. The Core object implements additional methods used to pause script execution,
debug scripts, create and call global variables.
The Core object is not a prototype, thus you cannot create other objects on its basis (it cannot be used as a template). All methods of
the Core object are static. Thus, you can call the methods of the Core object directly from the script without referring to the Core obje
ct itself.
246
The SetObjectParam method
The SetObjectParam method is used to set the values to system object parameters.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object which parameter values you want to set. Possible
values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, the range is limited by the identification numbers of objects of the specified type registered
in the system.
3. param is a required argument. It corresponds to the parameter of the system object. Possible values: String type, range is
limited by the parameters available for the given object.
4. value is a required argument. It corresponds to the value set to the param parameter of the system object. Possible values:
String type, range depends on the set parameter.
Example. On Macro 1, check if cameras 1 to 4 are set to transmit color video. If a camera is set for black-and-white video
transmission, switch it to the color mode (set the true ("1") value to the Color (“color”) parameter).
Note
If the object is active when the script is started (that is the settings panel of this object is open), then object parameters can
not be changed by the SetObjectParam method. For example, if the settings panel for the Camera 1 object is open and the
script above is started, the operation mode of Camera 1 will not be changed for the color one.
247
The SetObjectState method
The SetObjectState method changes the state of objects.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object, the state of which you want to change. Possible
values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, the range is limited by the identification numbers of objects of the specified type registered
in the system.
3. state is a required argument. It corresponds to the state to which you want to switch the object. Possible values: String type,
range is limited by the states available for this object.
Example. Check if camera 1 is armed every hour. If camera 1 is disarmed, arm it.
Note
You must create the Timer object with identification number 1 beforehand. Set the Minutes parameter of the Timer object
to 30. The timer will go off every hour, for example, 09:30, 10:30, 11:30, and so on.
248
The DebugLogString method
The DebugLogString method outputs the user messages into the debug windows of the Editor-Debugger utility.
Method arguments:
1. output is a required argument. It specifies the message string that you want to output in the debug window of the Editor-
Debugger utility. Possible values: String type.
Example. When any event from any of the microphones is registered in the system, output it in the debug window.
if ([Link] == "OLXA_LINE")
{
var msgstr = [Link]();
DebugLogString("Event from the microphone " + msgstr);
}
249
The Base64Decode method
The Base64Decode method is used to decode strings that are encoded by the Base64 scheme.
Method arguments:
1. data_in is a required argument. It specifies the Base64 string that you want to decode;
2. WideChar is a required argument. It specifies the encoding type. Possible values: 0 or 1. If the encoding type is Unicode, the
argument value is 1, otherwise 0.
Example. On macro 1, decode the string specified in Base64. Output the decoding result in the debug window of the Editor-Debugger
utility (the result is the "Axxon PSIM JScript" string).
250
The Sleep method
The Sleep method pauses the execution of the script for a specified period of time.
Method arguments:
1. milliseconds is a required argument. It specifies the time for which you want to pause the execution of a scrip. It is set in
milliseconds. Possible values: int type.
Example 1. On macro 1, playback the following audio files one by one with audio player 1: cam_alarm_1.wav, cam_alarm_2.wav,
cam_alarm_3.wav from the …\Axxon PSIM\Wav\ folder. The delay between the playback of each audio file must be five seconds (5000
milliseconds).
Example 2. On macro 2, start the timer 1 that triggers every 10 seconds for a minute from the start of macro 2.
Note
To start this script, you must create the Timer object with ID 1 beforehand. Leave the default object parameters (Any). The
Timer 1 object can be disabled.
251
The Itv_var method
The Itv_var method sets and returns the values of global variables.
1. Globalvar is a required argument. It specifies the name of the global variable. Possible values: String type that meets the
requirements for valid names of String parameters of the Windows registry.
Note
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\VMSScript\VMSSCRIPT and
HKEY_CURRENT_USER\Software\VMSScript\VMSSCRIPT. To access a global variable directly from the registry, search the
registry for it by its name.
Example. On macro 1, save the value of the bright parameter of camera 10 to the cam10bright global variable. On macro 2, set the
bright parameter of the cameras 1 to 4 to the value of the cam10bright global variable.
252
The Int_var method
The Int_var method sets and returns values of global variables of integer type.
Attention!
The Int_var method uses the same storage as the Itv_var method, but modifies the type of variable to the integer type.
1. Globalvar is a required argument. It specifies the name of the global variable. Possible values: String type that meets the
requirements for valid names of String parameters of the Windows registry.
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\VMSScript\VMSSCRIPT and
HKEY_CURRENT_USER\Software\VMSScript\VMSSCRIPT. To access a global variable directly from the registry, search the
registry for it by its name.
Example. In the test example below, to check the method operation, the global variable named 2 is assigned a value of 1 that is then
increases by 1 and is displayed in the debug window of the script.
if([Link] =="RUN")
{
Int_var(2) = 1;
Int_var("2")++;
DebugLogString(Int_var("2").toString());
}
253
The GetObjectParentType method
The GetObjectParentType method returns the type of the parent object for the specified object according to the system object
hierarchy.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object for which you want to return the type of the
parent object. Possible values: String type, range is limited by object types allowed in the system.
Note
In the hierarchy of system objects, the Main object is the highest level object. This object is the parent object for all objects
of the Computer type, Screen type and others.
Example. On macro 1, display in the debug window the names of four objects, starting from the detection zone, in the order of the
hierarchy provided by Axxon PSIM.
254
The GetIPAddress method
The GetIPAddress method returns the IP address of the Axxon PSIM kernel according to the existing architecture of the distributed
video surveillance system.
Method arguments:
1. dst is a required argument. It specifies the name of the remote computer on which the Axxon PSIM kernel is installed. The
value of the dst argument must match one of the computer names registered when configuring the architecture of the
distributed video surveillance system. Possible values: String type that meets the requirements for network computer names;
the range is limited to the computer names registered in the system.
2. src is a required argument. It specifies the name of the local computer (the computer from which you run the script). The
value of the src argument must match the name of the local computer as it is registered in Axxon PSIM. Possible values:
String type that meets the requirements for network computer names.
Note
The information about all connections of the local computer (kernel) to other remote computers (kernels) registered during
the configuration of the distributed architecture is displayed in the Architecture tab of the System settings window.
Example. On a camera alarm, determine the name of the computer to which this camera is connected, and output in the debug
window the IP address of the connection between this computer and the local computer on which the script is executed.
Note
Instead of "WS1" in the example, you must enter the name of the computer on which the script is run and Axxon PSIM kernel
is installed.
255
The GetObjectName method
The GetObjectName method returns the name of the object that it was given during registration in the program.
Method arguments:
1. objtype is a required argument. It specifies the system type of the object which name you want to get. Possible values: String
type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, the range is limited by the identification numbers of objects of the specified type registered
in the system.
Example. On alarm in any sensor, open the information window with the following text: "Alarm in the <alarmed sensor name>.
Sensor connected to the Server <name of the section to which the sensor is connected>”.
Note
You must create the information dialog window beforehand using the [Link] utility and save it in the [Link] file in the <
Axxon PSIM installation directory>\Program folder.
256
The GetObjectState method
The GetObjectState method returns the state of the object at the moment of method invocation.
Method arguments:
1. objtype is a required argument. It specifies the type of the system object which state you want to get. Possible values: String
type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, the range is limited by the identification numbers of objects of the specified type registered
in the system.
Example. When relay 1 is enabled (for example, on pressing the button connected to the relay 1), arm sensor 1. The next time the
relay 1 is enabled, disarm sensor 1.
Note
Some object types can have several states at the same time. For example: ATTACHED|DISARMED or
ATTACHED|DISARMED|RECORDER_ON|RECORDING.
257
The GetObjectParam method
The GetObjectParam method returns the value of the specified parameter of the system object at the moment of method invocation.
Method arguments:
1. objtype is a required argument. It specifies the type of system object for which you want to return the value of the specified
parameter. Possible values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, the range is limited by the identification numbers of objects of the specified type registered
in the system.
3. param is a required argument. It corresponds to the name of the parameter the value of which you want to return. Possible
values: String type, range is limited by the parameters available for the given object.
258
The GetObjectParentId method
The GetObjectParentId method returns the identification (registration) number of the parent object of the specified object.
Method arguments:
1. objtype is a required argument. It specifies the type of the system object, for which you want to return the type of parent
object. Possible values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
3. parent is a required argument. It specifies the type of the system object that is the parent object (main object in the system
hierarchy of objects) of the object specified by the objtype argument. Possible values: String type, range is limited by object
types registered in the system.
Example. If a camera turns off or stops transmitting a video signal, send an email message registered in Axxon PSIM under number 1.
The message must include the subject: "Warning! Camera turned off" and, in the message body, the number of the camera and of the
server it is connected to.
Note
259
The DoReactStr method
The DoReactStr method generates the reactions of the system objects. The method sends the reaction to the specified object. The
reaction is transferred directly to the kernel on which the object is registered, and not to the entire system. In the DoReactStr method,
the reaction is specified by a group of String arguments.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object for which you want to generate a reaction.
Possible values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
3. action is a required argument. It specifies the reaction that you want to generate. Possible values: String type, range is
limited by the reactions available for the object of the specified type.
4. param<value> is a required argument. You can specify several arguments of this type. It corresponds to the parameter(s) of
the system object reaction.
"param<value>", where
"param1<value1>,param2<value2>…"
Elements of the list are separated by commas without spaces. If no parameter needs to be specified, an empty string is used:
DoReactStr("CAM","1","REC","");
Possible values of the param argument: String type, range is limited by the available parameters of the specified reaction. Possible
values of the value argument: String type, range depends on the parameter that you want to set.
For all reactions you can specify delay of reaction execution using the delay<> parameter. Delay is specified in seconds.
Note
Two types of system messages are available in Axxon PSIM: events and reactions. The events usually contain some
information and are used as notifications sent to all Axxon PSIM kernels connected to each other during the architecture
configuration. The reactions are commands sent to specific objects. A reaction is transmitted only to the kernel on which the
required object is registered, and not to the entire system. The DoReactStr and DoReact methods are used to generate
reactions. The NotifyEventStr and NotifyEvent methods are used to generate events.
Example 1. When an alarm is received from a camera, switch Monitor 1 to single Surveillance window mode (one-fold) and show the
video from the alarmed camera in this window.
Example 2. When alarm from a camera is completed, the recording must continue for five second and after this time the recording
must stop (analogue of Post-record mode).
260
if ([Link] == "CAM" && [Link] == "MD_STOP")
{
var camid = [Link];
DoReactStr("CAM",camid,"REC_STOP","delay<5>");
}
Example 3. On macros 1, enable telemetry control using mouse on the camera 4 displayed in the monitor 10. On macros 2, disable it.
261
The DoReact method
The DoReact method generates the reactions of the system objects. The method sends the reaction to the specified object. The
reaction is transferred directly to the kernel on which the object is registered, and not to the entire system. In the DoReact method,
the reaction is specified by the MsgObject object.
Method arguments:
1. msgevent is a required argument. It specifies the reaction sent to the specified object. Possible values: the MsgObject
objects created earlier in the script.
Note
Two types of system messages are available Axxon PSIM: events and reactions. The events usually contain some information
and are used as notifications sent to all Axxon PSIM kernels connected to each other during the architecture configuration.
The reactions are commands sent to specific objects. A reaction is transmitted only to the kernel on which the required object
is registered, and not to the entire system. The DoReactStr and DoReact methods are used to generate reactions. The NotifyE
ventStr and NotifyEvent methods are used to generate events.
Example. When relay 1 closes, close relays 2 and 3. When relay 1 opens, open relay 2.
262
The DoReactSetupCore method
The DoReactSetupCore method is used to change the parameters of the system object. The method changes only the specified
parameters of the object, leaving other parameters unchanged.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object which parameter values you want to set. Possible
values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
3. param<value> is a required argument. You can specify several arguments of this type. It corresponds to the parameter(s) of
the system object reaction.
“param<value>”, where
“param1<value1>,param2<value2>…”.
Possible values of the param argument: String type, range is limited by the available parameters of the specified reaction. Possible
values of the value argument: String type, range depends on the parameter that you want to set.
Example. On macro 1, set the values of the following parameters of cameras 1-4: PTZ device number (telemetry_id) and number of
the microphone for synchronous recording (audio_id). The values must be equal to the camera numbers plus 1.
263
The DoReactSetup method
The DoReactSetup method is used to temporary change the parameters of the system object. The method changes only the specified
parameters of the object, leaving other parameters unchanged.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object which parameter values you want to set. Possible
values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
3. param<value> is a required argument. You can specify several arguments of this type. It corresponds to the parameter(s) of
the system object reaction.
“param<value>”, where
“param1<value1>,param2<value2>…”.
Possible values of the param argument: String type, range is limited by the available parameters of the specified reaction. Possible
values of the value argument: String type, range depends on the parameter that you want to set.
Example. On macro 1 starts, temporary remove all cameras from the first monitor.
264
The DoReactGlobal method
The DoReactGlobal method is used to generate reactions of system objects. The DoReactGlobal method sends a reaction to the
required object. The reaction is sent not only to the kernel on which the object is registered, but to the entire system. In the
DoReactGlobal method, the reaction is specified by the MsgObject object.
Method arguments:
1. msgevent is a required argument. It specifies the reaction sent to the specified object. Possible values: the MsgObject objects
created earlier in the script.
Example. On macro 2, arm sensor 2. The command must be sent to all system kernels as a reaction to be registered in the Event
Viewer.
265
The NotifyEventStr method
The NotifyEventStr method generates system events. The generated event is sent to all system kernels connected to the local kernel.
In the NotifyEventStr method, an event is specified by a group of String arguments.
Method arguments:
1. objtype is a required argument. It corresponds to the type of system object for which you want to generate an event. Possible
values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
3. event is a required argument. It specifies the event that you want to generate. Possible values: String type, range is limited
by events available for the object of the specified type.
4. param<value> is a required argument. You can specify several arguments of this type. It corresponds to the parameter(s) of
the system event.
"param<value>", where
"param1<value1>,param2<value2>…".
Elements of the list are separated by commas without spaces. If no parameter needs to be specified, an empty string is used:
DoReactStr("CAM","1","MD_START","");
Possible values of the param argument: String type, range is limited by the available parameters of the specified event. Possible
values of the value argument: String type, range depends on the parameter that you want to set.
Note
Two types of system messages are available in Axxon PSIM: events and reactions. The events usually contain some
information and are used as notifications sent to all Axxon PSIM kernels connected to each other during the architecture
configuration. The reactions are commands sent to specific objects. A reaction is transmitted only to the kernel on which the
required object is registered, and not to the entire system. The DoReactStr and DoReact methods are used to generate
reactions. The NotifyEventStr and NotifyEvent methods are used to generate events.
Example. When an alarm is received, send the “panic lock” event for the corresponding region of the camera. For camera
identification numbers are from 1 to 4, use region 1. For camera numbers from 5 to 10, use region 2.
266
The NotifyEvent method
The NotifyEvent method generates system events. The generated event is sent to all system kernels connected to the local kernel. In
the NotifyEvent method, the event is specified by the MsgObject object (see The MsgObject and Event objects and their built-in
methods and properties).
Method arguments:
1. msgevent is a required argument. It specifies the event sent to the system. Possible values: the MsgObject objects created
earlier in the script.
Note
Two types of system messages are available in Axxon PSIM: events and reactions. The events usually contain some
information and are used as notifications sent to all Axxon PSIM kernels connected to each other during the architecture confi
guration. The reactions are commands sent to specific objects. The reactions are transmitted only to the kernel on which the
object is registered, and not to the entire system. The DoReactStr and DoReact methods are used to generate reactions. The
NotifyEventStr and NotifyEvent methods are used to generate events.
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 Event Viewer.
Note
When running this script, the analog output 1 of the Video Capture Device 2 is not disabled.
267
The NotifyEventGlobal method
The NotifyEventGlobal method is used to generate system events. The generated event is transmitted to all system kernels connected
via the network. In the NotifyEventGlobal method, the event is specified by the MsgObject object (see The MsgObject and Event
objects and their built-in methods and properties)
Method arguments:
1. msgevent is a required argument. It specifies the event sent to the system. Possible values: the MsgObject objects created
earlier in the script.
Example. On macro 1, the first camera is set to record. The command must be sent to all system kernels as the event to be
registered in the Event Viewer.
Note
268
The CreateMsg method
The CreateMsg method creates objects based on the MsgObject prototype (see The MsgObject and Event objects).
Example 1. When an alarm is received, send the “panic lock” event for the corresponding region of the camera. If the identification
number of the alarm camera is from 1 to 4, use region 1. If the identification number of the alarm camera is from 5 to 10, use region
2.
Note
To start this script, you must create the Timer object with the identification number 1 beforehand. Set value 1 to the Second
parameter of the Timer object, leave other parameters unchanged (Any by default).
269
The Lock and Unlock methods
The Lock and Unlock methods are used to create a global critical section when synchronization of scripts started in different streams is
required. The Lock method opens a critical section and the Unlock method closes it.
Attention!
If you invoke the Lock method, you must also invoke the Unlock method. Otherwise, the system can freeze.
function Lock()
function Unlock()
Example. On macro 1, calculate the total amount of alarmed relays and sensors. Objects of each type must be calculated at the same
time (in an individual script). The result must be written to the counter global variable.
Script 1:
Script 2:
270
Note
If the Lock() and Unlock() methods are not used in this example, then collisions can occur and the calculated value will be
less than the actual value.
271
The IsAvailableObject method
The IsAvailableObject method is used to determine the current access permissions to an object.
function IsAvailableObject(compname: String, objtype: String, id: String, param : String) : String
The method returns 0 if the current user has not been assigned permissions of the param type to access the object. The method
returns 1 if permissions have been assigned.
Method arguments:
1. compname is a required argument. It corresponds to the name of the Computer object on the basis of which the object was
created in the hardware tree.
2. objtype is a required argument. It corresponds to the type of the system object access permissions to which you want to find
out. Possible values: String type, range is limited by object types registered in the system.
3. id is a required argument. It corresponds to the identification (registration) number of the object specified by the objtype argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
4. param is a required argument. It corresponds to the number of the type of permissions that you want to find out if they exist.
A description of permissions is given in Limiting access to the system objects administration, control and viewing functions.
Possible values:
a. 0—rightsNoView access permissions. The method will return 1 if there are no administrative, control, or monitoring
permissions to the object (red "x").
b. 1—rightsNoControl access permissions. The method will return 1 if there are only monitoring permissions (letter M).
c. 2—rightsViewAndControl access permissions. The method will return 1 if there are control and monitoring permissions
to the object (green checkbox).
d. 3—rightsViewOrControl access permissions. The method will return 1 if there is either monitoring or control
permissions to the object.
e. 4—rightsNot access permissions.
f. 5—rightsConfigure access permissions. The method will return 1 if there are administrative, control, and monitoring
permissions to the object (grey checkbox).
Example. A Camera object with the identifier 1 has been created in the hardware tree on the basis of the Computer object with the
"Comp" name. Find out the current access permissions to the object.
var i = 0;
for(i = 0; i <= 5; i++)
{
var result =
IsAvailableObject('Comp','CAM','1', i);
DebugLogString("right "+i+" = "+result);
}
272
The GetUserId method
The GetUserId method returns the identifier of the current Axxon PSIM user.
Method arguments:
1. cmp is a required argument. It specifies the name of the computer on which Axxon PSIM is installed. Possible values: String
type that meets requirements for network computer names, range is limited by computer names registered in the system.
Example. Display in the debug window the identifier of the current user of Axxon PSIM installed on a computer named 'WS3':
DebugLogString(GetUserId("WS3"));
273
The GetEventDescription method
The GetEventDescription method is used to get a description of an event in natural language.
Method arguments:
1. obj_type is a required argument. It specifies the type of system object, the description of which you want to get.
2. event is a required argument. It specifies the name of the event, the name of which you want to get.
Example. When receiving events from camera 1, display messages about them in natural language in the debug window.
274
The GetObjectIdByParam method
The GetObjectIdByParam method allows you to get the ID of an object, some parameter of which is equal to the specified value. If
there are several such objects, the ID of the first found object is returned. If no such objects are found, 0 is returned.
Method arguments:
1. obj_type is a required argument. It specifies the type of system object, the ID of which you want to get.
2. obj_param is a required argument. It specifies the name of the parameter in the database, by the value of which you want to
search for the object.
3. param_value is a required argument. It specifies the required value of the object parameter.
Example. Find cameras with a black-and-white video image and set the Color parameter to 1 for them.
{
var id = GetObjectIdByParam("CAM","color","0"); //get the first object ID
while (id){ //while exist the Camera objects from which black-and-white image is received
SetObjectParam ("CAM", id, "color", "1"); //change the Color parameter for found object
id = GetObjectIdByParam("CAM","color","0"); //get the next object ID
}
}
275
The SaveToFile method
The SaveToFile method is used to save to a file the frame from the camera that is received in the data parameter of the FRAME_SENT
event.
You can also save the frame using the GET_FRAME reaction of the CAM object. To do this, you must specify the path for saving the file
with the frame in the path parameter of this reaction. The FRAME_SENT event is created in the system if the GET_FRAME reaction
doesn't have the path parameter. In the data parameter of the FRAME_SENT event, the frame that must be saved using the
SaveToFile method is stored.
The reaction allows you to export a frame even if the camera is not displaying in the Video surveillance monitor.
Method argument:
1. path is a required argument. It specifies the full path to save the file with a frame.
2. data is a required argument. It specifies data to save to a file.
3. param is a required argument. It determines whether to transcode from base64 format before saving. Possible parameter
values:
a. true—transcode from base64 before saving;
b. false—save the string without transcoding.
Time of frame saving depends on the reference frame rate. The higher the reference frame rate, the shorter the time.
Example. When a frame is received from Camera 1, save it to the [Link] file on disk D:
276
The GetLinkedObjects method
The GetLinkedObjects method is used to get the list of objects linked to the specified camera using the Objects link object (see Conne
ction of objects with cameras).
Method argument:
1. type1 is the type of object for which you want to return the linked objects.
2. id is the identification number of an object for which you want to return the linked objects.
3. type2 is the type of linked objects which you want to return. If empty string is sent, linked objects of all types will be returned.
Example.
if ([Link] == "MACRO")
{
varmsgstr = GetLinkedObjects("CAM","1","MACRO")
As a result, the "Linked objects MACRO:1" message will be displayed in the script debug window.
277
The WriteIni method
The WriteIni method is used to write the string variable to the ini file.
Method argument:
1. varName is a required argument. It specifies the name of the variable for storing in the file.
2. varValue is a required argument. It specifies the value of the variable.
3. path is a required argument. It specifies the full path to the ini file in which the variable must be stored. Storage of variables
can be placed on the network resource. To do this, enter the network path in the argument.
Example. Write the MyVar variable to the \\fileserver\temp\[Link] file and set the "Hello world!" value to it. Then read the written
value and display it in the script debug window.
278
The ReadIni method
The ReadIni method is used to read values of the string variable in the ini file.
Method arguments:
1. varName is a required argument. It specifies the name of the variable stored in the file.
2. path is a required argument. It specifies the full path to the ini file in which the variable is stored.
279
The AddIni method
The AddIni method is used to write, change and read integer variable from the ini file. The method returns the value of the variable
after its changing.
1. varName is a required argument. It specifies the name of the variable in the file.
2. varValue is a required argument. It specifies the value of the variable or the value which must be added to the existing value
of the variable:
a. If a variable with the varName name and a string value is stored in the file, the varValue value will be assigned to the
variable.
b. If there is no variable with the varName name in the file, such a variable will be created and the varValue value will be
assigned to it.
c. If there is a variable with the varName name in the file and it has an integer value or its value can be brought to the
integer type, the value will be brought to the integer type and the varValue value will be added to it.
3. path is a required argument. It specifies the full path to the ini file in which the variable must be stored. Storage of variables
can be placed on the network resource. To do this, enter the network path in the argument.
Example. There is no the MyVar variable in the C:\\[Link] file. Write to this file such a variable with the -1 value, then add 1 to it and
display the result value in the script debug window.
DebugLogString(result);
280
The SetTimer method
The SetTimer method is used to start the timer.
Method arguments:
1. id is a required argument. It specifies the timer ID. Possible values are int or string type.
2. milliseconds is a required argument. It specifies the period with which the timer will trigger if it is not stopped by the
KillTimer method. It is specified in milliseconds. Possible values: int type.
Example. Two seconds after the macro 1 is executed, start recording on camera 1.
281
The KillTimer method
The KillTimer method is used to stop the timer. It returns 1 if the timer was stopped as a result of the function execution.
Method arguments:
1. id is a required argument. It specifies the timer ID. Possible values: int or string type.
282
The GetObjectChildIds method
The GetObjectChildIds method returns the identification (registration) numbers of the objects of the specified type that are below the
specified object in the object hierarchy.
Method arguments:
1. parent is a required argument. It specifies the type of the system object which child objects you want to find out. Possible
values: String type, range is limited by object types registered in the system.
2. id is a required argument. It corresponds to the identification (registration) number of the object specified by the parent argu
ment. Possible values: String type, range is limited by the identification numbers of objects of the specified type registered in
the system.
3. objtype is a required argument. It specifies the type of the system object which is a child of the type specified by the parent
argument. Possible values: String type, range is limited by object types registered in the system.
283
The Base64EncodeFile method
The Base64EncodeFile method is used to encode files using the Base64 scheme. The method returns a string.
Method arguments:
1. data_in is a required argument. It specifies the path to the file that you want to encode.
Example. On macro 1, encode the [Link] file to Base64 and write it to the [Link] file.
284
The Base64EncodeW method
The Base64EncodeW method is used to encode a Unicode string using the Base64 scheme. The method returns a string.
Method arguments:
1. data_in is a required argument. It specifies the string that you want to encode.
Example. Decode a string from Unicode to Base64, encode it back and display it in the debug string.
If the Base64Decode method received the true parameter, the script will have the following output:
03-07-2019 15:39:40:
test 1
03-07-2019 15:42:21:
test 2
285
The run_cmd and run_cmd_timeout methods
The run_cmd method is used to execute commands on the command line from a script.
The run_cmd_timeout method is used to execute commands on the command line with the specified process termination timeout.
When invoking commands, the command line window does not open, the commands are executed in hidden mode.
Method arguments:
Example 1. Run the curl utility and send a POST request with the text "Hello" to the test URL [Link]
286
The WriteIniAny method
The WriteIniAny method is used to write a string variable to an ini file. Unlike the WriteIni method, in the WriteIniAny method you can
specify the required file section for writing.
Method arguments:
1. varName is a required argument. It specifies the name of the variable for storing in the file.
2. varValue is a required argument. It specifies the value of the variable.
3. path is a required argument. It specifies the full path to the ini file in which the variable must be stored. Storage of variables
can be placed on the network resource. To do this, enter the network path in the argument..
4. section is a required argument. It specifies the name of the section of the ini file in which you want to write the variable.
Example. Write the MyVar variable to the "config" section of the C:\\Backup\\[Link] file, and set the "Hello world!" value to it. Then
read the written value and display it in the debug window of the script.
287
The ReadIniAny method
The ReadIniAny method is used to read the values of a string variable in the ini file. Unlike the ReadIni method, in the ReadIniAny
method you can specify the required file section from which you want to read the variable.
Method arguments:
1. varName is a required argument. It specifies the name of the variable stored in the file.
2. path is a required argument. It specifies the full path to the ini file in which the variable is stored.
3. section is a required argument. It specifies the name of the section of the ini file from which you want to read the variable.
288
The AddIniAny method
The AddIniAny method is used to write, change and read integer variable from the ini file. Unlike the AddIni method, in the AddIniAny
method you can specify the section of the file that contains the integer variable. The method returns the value of the variable after its
changing.
function AddIniAny(varName: String, varValue: int, path: String, section: String): int
1. varName is a required argument. It specifies the name of the variable in the file.
2. varValue is a required argument. It specifies the value of the variable or a value which must be added to the existing value of
variable:
a. The varValue value will be assigned to the variable if there is a variable with the varName name and a string value in
the file.
b. If there is no variable with the varName name in the file, such a variable will be created and the varValue value will be
assigned to it.
c. If there is a variable with the varName name in the file and it has an integer value or its value can be brought to the
integer type, the value will be brought to the integer type and the varValue value will be added to it..
3. path is a required argument. It specifies the full path to the ini file in which the variable must be stored. Storage of variables
can be placed on the network resource. To do this, enter the network path in the argument.
4. section is a required argument. It specifies the name of the section of the ini file in which the variable is stored.
Example. There is no MyVar variable in the config section of the C:\\[Link] file. Write to this file such a variable with the -1 value,
then add 1 to it and display the result value in the script debug window.
DebugLogString(result);
289
The MsgObject and Event objects and their built-
in methods and properties
290
The MsgObject and Event objects
The MsgObject object is a prototype (template) used to create objects. It implements methods and properties used to process system
events in Axxon PSIM. The methods and properties of the MsgObject object allow you to get information about system objects that
send or receive events, generate reactions for system objects, change their states, and so on.
You can invoke the methods and properties of the MsgObject object-prototype via the objects declared and initialized on its basis, or
via the Event static object.
The Event object is a static object that implements the interface for invoking the system events of Axxon PSIM. The Event object
provides access to the system event that started the script. All methods and properties of the MsgObject prototype are available
when working with the Event object.
You can declare (create) objects on the basis of the MsgObject prototype using the CreateMsg method of the Core object (see The
CreateMsg method).
291
The GetSourceType method
The GetSourceType method returns the system type of the MsgObject or Event object.
Example. On macro 1, arm Detection Zones *.1 in the Day mode for cameras 1–4. On macro 2, arm Detection Zones *.2 in the Night
mode for cameras 1–4. On macro 3, arm Detection Zones *.3 in the Rain mode for cameras 1–4.
Note
The * charachter corresponds to identification number of a camera in the system (from 1 to 4).
//Switching the cameras to the Nigh mode by arming the *.2 detection zones
if([Link]() == "2")
{
for (k = 1; k<= 4; k = k+1)
{
DoReactStr("CAM_ZONE", k + ".1", "DISARM", "");
DoReactStr("CAM_ZONE", k + ".2", "ARM", "");
DoReactStr("CAM_ZONE", k + ".3", "DISARM", "");
}
}
//Switching the cameras to the Rain mode by arming the *.3 detection zones
if([Link]() == "3")
{
for (k = 1; k<= 4; k = k+1)
{
DoReactStr("CAM_ZONE", k + ".1", "DISARM", "");
DoReactStr("CAM_ZONE", k + ".2", "DISARM", "");
DoReactStr("CAM_ZONE", k + ".3", "ARM", "");
}
}
}
292
The GetSourceId method
The GetSourceId method returns the identification (registration) number of the MsgObject or Event object.
293
The GetAction method
The GetAction method returns the event received as an Event object or specified for a MsgObject object.
294
The GetParam method
The GetParam method returns the value of the specified parameter of the system object for the MsgObject or Event object.
Method arguments:
1. param is a required argument. It corresponds to the parameter name of the system object for which the MsgObject object
(or the Event static object) was created. Possible values: String type, range is limited by the parameters available for the
given object.
Note
If the object has no parameter with this name, then the method returns an empty string.
Example. When any event from any camera is registered, check from which computer the event comes. If the computer has the WS3
name, create the event copy in which the computer’s name is “Computer”.
if ([Link] == "CAM")
{
var msg = [Link]();
if ([Link]("SLAVE_id") == "WS3")
{
[Link]("SLAVE_id", "Computer");
NotifyEvent(msg);
}
}
295
The SetParam method
The SetParam method sets a value to the specified parameter of the MsgObject or Event object. The method changes only the
specified parameters of an object, other parameters remain unchanged.
Method arguments:
1. param is a required argument. It corresponds to the parameter name of the system object for which the MsgObject object
(or the Event static object) was created. Possible values: String type, range is limited by the parameters available for the
given object.
2. value is a required argument. It sets the value to the parameter specified in the param argument. Possible values: String
type, range depends on the set parameter.
296
The MsgToString method
The MsgToString method converts the MsgObject objects (including the Event static object) into a String variable.
Example. Send messages about all events registered for microphone 1 to a specified email address.
Note
297
The StringToMsg method
The StringToMsg method converts a String variable into a MsgObject object.
Method arguments:
1. msg is a required argument. It specifies a variable of the String type that you want to convert into a MsgObject object. Possibl
e values: variables of the String type that match the syntax of the MsgObject objects representation:
"objtype|id|action|param1<value1>,param2<value2>…", where
Example. On alarm from Sensor 1 and 3, start recording audio from Microphone 1. On alarm from Sensor 2 or 4, start recording audio
from Microphone 2.
298
The StringToParams method
The StringToParams method converts a String variable into the list of parameters and overwrites the existing list of parameters of the
MsgObject object.
Method arguments:
1. params is a required argument. It specifies a variable of the String type that you want to convert into a list of parameters of
the MsgObject object. Possible values: variables of the String type that match the syntax of the MsgObject objects
parameter list representation:
“param1<value1>,param2<value2>…”, where
param1<value1>,param2<value2> is a list of parameters with their values. Elements of the list are separated by commas without
spaces. If no parameters need to be specified, an empty string is used after the vertical line (|), for example: “CAM|1|MD_START|”
Example. When registering an Attach event for any of the cameras, re-initiate the Attach event in the system with changed values
of the Number of the PTZ device (telemetry_id) and Number of the microphone for synchronous recording (audio_id)
parameters. The values must be equal to the corresponding camera numbers plus 1.
299
The Clone method
The Clone method creates a copy of a MsgObject and Event object.
Example. When relay 1 closes, start video recording on camera 1 and close relay 2. When relay 1 opens, start video recording on
camera 2 and open relay 2.
}
if([Link] == "OFF")
{
[Link] = "2";
DoReact(msgevent);
DoReactStr("CAM","2","REC","");
DoReactStr("GRELE","2","OFF","");
}
}
300
The GetObjectIds method
GetObjectIds method is responsible for receiving identifiers from all objects of a specified type.
Method arguments:
1. objectType is a required argument. It specifies the type of the system object for which you want to return the value of the
specified parameter (CAM, GRAY, GRABBER, and so on). Possible values: String type, range is limited by object types
registered in the system.
A string is returned:
CAM||COUNT|id.3<5>,[Link]<4>,id.0<2>,id.1<3>,id.2<4>
where
301
The GetObjectParams method
GetObjectParams method is used to get the parameters of an object.
Method arguments:
1. objectType is a required argument. It specifies the type of the system object (CAM, GRAY, GRABBER, and so on) for which
you want to return the type of the parent object. Possible values: String type, range is limited by object types registered in the
system.
2. objectId is an object’s identifier. Possible values: String type.
Example. On macro 1, check the color control of camera 2. If camera 2 is a color one, set it to recording.
302
The SourceType property
The SourceType property allows you to return and set the system type for the MsgObject or Event object.
SourceType : String
Example. When relay 1 closes (for example, the button connected to the relay is pressed), print the frames from cameras 1 and 2.
303
The SourceId property
The SourceType property allows you to return and set the identification number for the MsgObject or Event objects.
SourceId : String
304
The Action property
The Action property allows you to return and set a reaction or event for the MsgObject or Event objects.
SourceId : String
305
Programming guide. Conclusion
For more information about Axxon PSIM, see:
If you have any difficulties and problems while working with this software product, you can contact us. Before contacting us, we kindly
ask you to answer the following questions:
The more detailed and precise information you give us, the faster our experts will resolve your problem.
We are striving to improve the quality of our products, and hence welcome any suggestions and comments regarding the operation of
our software and its documentation.
306