MACRO Macro

TIME_ZONE Time zone

Formats and functions

Format of events procedure for the Macro object:

OnEvent("MACRO","_id_","_event_")

Operator format to describe actions with the Macros:

DoReact("MACRO","_id_","_command_" [,"_parameters_"]);

Function to check the state of the Macro object:

CheckState ("MACRO","number","state")

Format of events procedure for the Time zone object:

OnEvent("TIME_ZONE","_id_","_event_")

Operator format to describe actions with the Time zone:

DoReact("MACRO","_id_","_command_" [,"_parameters_"]);

Function to check the state of the Time zone object:

CheckState ("TIME_ZONE","number","state")

Examples

Examples of using events and reaction of the Macro object:

  1. Write the current position of camera to preset 1 when running macro 1.

    OnEvent("MACRO","1","RUN")
    {
        DoReact("TELEMETRY","1","SET_PRESET","TEL_PRIOR<1>");
    }
  2. Run macro 2 if camera 1 is armed.

    OnEvent("CAM","1","ARM")
    {
        DoReact("MACRO", "2", "RUN");
    }
  3. Start and stop patrolling of a PTZ device on macros.
    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.
    OnEvent("MACRO","1","RUN") //when running macro 1
    {
        //square brackets are needed to separate the wait statement into a separate thread
        [           
        flag=1;
        for(a=1;flag<2;a=1) //loop statement
        {
            Sleep(500); //wait statement creates a pause of 500 milliseconds
            ff="!!!!!!!!!!!!!!!!!!";
        }
        ]
    }
     
    OnEvent("MACRO","2","RUN") //when running macro 2
    {
        flag=2;
    }

Examples of using events and reactions of the Time zone object:

  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>");
    }