Bosch Building Technologies

    Showing results for 
    Search instead for 
    Did you mean: 

    How to enable/ disable audio recording for a specific camera using Virtual Input in BVMS?

    warnning.png Note

    This is just an example how to start and stop an audio recording of a camera on particular BVMS event that trigger scriplets. Any event could be used. For example Operator Client Event Buttons, can be used, when the requirement is that the operator should be able to start and stop recording from Operator Client. 


    Follow the step-by-step guide below:


    Step-by-step guide


    1. Configure the Virtual Input that can be toggled by the Operator in BVMS Operator Client (Devices)



    • Do not forget to Save
    • Drag & drop the Virtual Input into the Logical Tree from Maps and structure

    • Save


    2. Configure Event for this Virtual Input:

    • Go in the Events tab and open the Command Script Editor
    • Attached you can find an example script. Paste the script into Command Script Editor:


    Note: They just turn on or off the Audio setting of a camera, by sending the respective rcpp command to the camera. When Audio is ON, it will be recorded.



    • Paste the Script and Save


    • Configure the Event for this Virtual Input:
      • VI on - call a server scriplet AudioON
      • VI off - call a server scriplet AudioOFF


    • Save & Activate


    3. Configure the Audio settings of the camera and click Set



    4. Open the Operator Client and start using the Virtual Inputs


    Script example - explained:

    Note: Where text is red, adapt it for your system

    // ScriptType: ServerScript
    // ScriptLanguage: CS

    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using log4net;
    using Bosch.Vms.Core;
    using Bosch.Vms.SDK;
    using System.Net;


    public class ServerScript : IDisposable
    private readonly IServerApi Api;
    private readonly ILog Logger;

    private void RequestURL(string lcUrl)
    { // *** Establish the request HttpWebRequest
    HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(lcUrl); // *** Set properties
    loHttp.Timeout = 10000; // 10 secs
    loHttp.UserAgent = "Code Sample Web Client";

    // camera autentication
    loHttp.Credentials = new NetworkCredential("service","WSS4Bosch!");

    // *** Retrieve request info headers
    HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
    loWebResponse.Close(); }

    public ServerScript(IServerApi api)
    this.Logger = LogManager.GetLogger("ServerScript");
    this.Api = api; }

    public void Dispose()

    // Use this method to cleanup any resources here (consider fully implementing the Dispose pattern).
    // For example, stop and dispose any started timers. Ensure that all threads that were started are stopped here.
    // DO NOT BLOCK in this method for a very long time, as this may block the applications current activity.


    public void AudioOn(EventData e)
    //this is just example ip address
    RequestURL(""); }


    public void AudioOff(EventData e)
    //this is just example ip address
    RequestURL(""); }

    Version history
    Last update:
    ‎01-09-2024 08:46 AM
    Updated by: