Documentation for Axxon PSIM 1.0.0-1.0.1.

Previous page The DoReact method  The DoReactSetup method Next page


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.

Syntax for method invocation:

 function DoReactStr(objtype : String, id : String, action : String, param<value> [, param<value>] : String)

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 argument. 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.

Syntax for setting a value to a parameter corresponds to a string:

"param<value>", where

param is a name of the parameter;

value is a value of the parameter.

Syntax for setting a value to several parameters corresponds to a string:

"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.

 if (Event.SourceType == "CAM" && Event.Action == "MD_START")
{
 var camid = Event.SourceId;
 DoReactStr("MONITOR","1","ACTIVATE_CAM","cam<"+ camid +">");
 DoReactStr("MONITOR","1","KEY_PRESSED","key<SCREEN.1>");
}

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).

if (Event.SourceType == "CAM" && Event.Action == "MD_STOP")
{
 var camid = Event.SourceId;
 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.

if (Event.SourceType == "MACRO" && Event.Action == "RUN" && Event.SourceId == "1")
{
 DoReactStr("MONITOR","10","CONTROL_TELEMETRY","cam<4>,on<1>");
}
if (Event.SourceType == "MACRO" && Event.Action == "RUN" && Event.SourceId == "2")
{
 DoReactStr("MONITOR","10","CONTROL_TELEMETRY","cam<4>,on<0>");
}