Bosch Building Technologies

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

    Central_Support_0-1704785812533.png

     

    • Do not forget to Save
    • Drag & drop the Virtual Input into the Logical Tree from Maps and structure
    Central_Support_1-1704785838054.png

    • 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: 
      AudioOnOff_EncoderCredentials.zip

     

    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.

    Central_Support_2-1704785890230.pngCentral_Support_3-1704785907750.png

     

    • Paste the Script and Save
    Central_Support_4-1704785957924.png

     

    • Configure the Event for this Virtual Input:
      • VI on - call a server scriplet AudioON
      • VI off - call a server scriplet AudioOFF
    Central_Support_5-1704785980254.pngCentral_Support_6-1704786007744.png

     

    • Save & Activate

     

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

    Central_Support_5-1702994686758.png

     

    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;

    [BvmsScriptClass()]

    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!");
    loHttp.PreAuthenticate=true;

    // *** 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.
    }

     

    [Scriptlet("169ad1f0-0b55-4bdd-a817-581371a95316")]
    public void AudioOn(EventData e)
    {
    //this is just example ip address
    RequestURL("http://192.168.1.46/rcp.xml?command=0x000c&type=F_FLAG&direction=WRITE&payload=1"); }

     

    [Scriptlet("f36bb5b0-2fea-4722-bcb2-15f3ed64878f")]
    public void AudioOff(EventData e)
    {
    //this is just example ip address
    RequestURL("http://192.168.178.46/rcp.xml?command=0x000c&type=F_FLAG&direction=WRITE&payload=0"); }
    }

    Version history
    Last update:
    ‎01-09-2024 08:46 AM
    Updated by:
    Attachments
    Contributors
    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist