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