Versions Compared

Key

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

...

  1. Switch camera to the color mode and start recording from it when arming the first camera.

    Code Block
    OnEvent("CAM","1","ARM") //first camera is armed
    {
        DoReact("CAM","1","SETUP","color<1>"); // set color mode of camera
        DoReact("CAM","1","REC"); //record from the first camera
    }


  2. Arm the first camera when disabling the fifth camera.

    Code Block
    OnEvent("CAM","5","DETACH") // fifth camera is disabled
    {
        DoReact("CAM","1","ARM"); //first camera is armed
    }


  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 cameraswith speed of 2-2.5 FPS) if it is in the alarm state.

    Code Block
    OnEvent("CAM","1","MD_START") //first camera is in alarm state
    {
        DoReact("CAM","1","SETUP","rec_priority<2>"); // use half of resources when recording
    }


  4. Set maximum compression synchronously with the fourth microphone of audio card on the first camera when recording on disk from the first camera.

    Code Block
    OnEvent("CAM","1","REC") //first camera recording on disk
    {
        DoReact("CAM","1", "SETUP", "compression<5>, audio_type<OLXA_LINE>, audio_id<4>"); //first camera, maximum compression, synchronously with the forth microphone of audio card.


  5. Start recording from the first camera with minimum quality in black and white mode when it isn't alarmed.

    Code Block
    OnEvent("CAM","1","MD_STOP") // first camera stopped to be in alarm state
    {
        value = 5;
        DoReact("CAM", "1", "SETUP", "compression<" + value + ">,color<0>");
        //start recording from the first camera with minimum quality in the black and white mode.
    }


  6. Start recording from the first camera in the “rollback” mode when it is disarmed.

    Code Block
    OnEvent("CAM","1","DISARM")  //first camera is disarmed
    {
        DoReact("CAM","1","REC","rollback<1>");  // Start recording from the first camera in the "rollback" mode
    }


  7. Set new parameters of video signal when connecting the first camera.

    Code Block
    OnEvent("CAM","1","ATTACH") //first camera is connected
    {
        VIDEO_CANAL_ID = GETOBJECTPARAM("CAM","1","PARENT_ID"); // define ID of video channel to which the first camera belongs
        DoReact("GRABBER",VIDEO_CANAL_ID,"SETUP","chan<0>,mode<0>,resolution<1>,format<pal>"); //set new parameters of video channel
    }


  8. Start auto cruising on Camera 1 when Macro 2 is run.

    Code Block
    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.
    Code Block
    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="ВсегоAll:"+str(num)+" СработалоWorked:"+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.
    Code Block
    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>");
    }
    Info
    titleNote

    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.

...