Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The GetSourceType method returns the system type of the MsgObject or Event object.the MsgObject object or Event.

Syntax for method invocation:Method call syntax

Code Block
languagejavascript
 function  GetSourceType() : String

Method arguments: There are no method arguments.

Usage examples

Problem. When Macro 1 startsExample. On macro 1, arm Detection Zones *.1 in the Day mode for Cameras № 1 – 4.  When Macro 2 startscameras 1–4. On macro 2, arm Detection Zones *.2 in the Night mode for Cameras № 1 – 4. When Macro 3 startscameras 1–4. On macro 3, arm Detection Zones *.3 in the Rain mode for Cameras № 1 – 4cameras 1–4

Info
titleNote

 Symbol " The * " charachter corresponds to identification number of a camera in the system (from  1 to 4).

Code Block
languagejavascript
 if(Event.GetSourceType() == "MACRO" && Event.GetAction() == "RUN")
{
  var k;
  //Switching the cameras to the Day mode by arming the *.1 detection zones
  if(Event.GetSourceId() == "1")
  {
for (k = 1;  k<= 4;  k = k+1)
    {
      DoReactStr("CAM_ZONE", k + ".1", "ARM", "");
      DoReactStr("CAM_ZONE", k + ".2", "DISARM", "");
      DoReactStr("CAM_ZONE", k + ".3", "DISARM", "");
    }
  }
 
  //Switching the cameras to the Nigh mode by arming the *.2 detection zones
  if(Event.GetSourceId() == "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(Event.GetSourceId() == "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", "");
    }
  }
}