// 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;//manual added [BvmsScriptClass()] public class ServerScript : IDisposable { private readonly IServerApi Api; private readonly ILog Logger; 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. } //Do not edit this fucntion call public void AutomaticControl(string DVR_IP_Address,string DVR_username,string DVR_password,int relayNumber) { HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create("http://" + DVR_IP_Address + "/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[" + relayNumber.ToString() + "].Mode=0"); loHttp.Credentials = new NetworkCredential(DVR_username, DVR_password); HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse(); loWebResponse.Close(); } //End of fucntion call AutomaticControl() [Scriptlet("c7d677c9-d12d-4a22-9cbf-eb53a7ed73fd")] public void Relay1Off(EventData e) { // Insert code here //Input information here //----------------------------------------------- string DVR_IP_Address = "160.10.170.152"; //DVR IP string DVR_username = "administrator"; //DVR username string DVR_password = "MyPassword1!"; //DVR password int relayNumber = 1; //indicate which DVR Relay you want to control //----------------------------------------------- //Do not edit this line ----------------------------- AutomaticControl(DVR_IP_Address,DVR_username,DVR_password,relayNumber-1); //Do not edit above line ----------------------------- } [Scriptlet("3b8ab20f-a71a-4e61-a770-f4b5869d23fa")] public void Relay2Off(EventData e) { // Insert code here //Input information here //----------------------------------------------- string DVR_IP_Address = "160.10.170.152"; //DVR IP string DVR_username = "administrator"; //DVR username string DVR_password = "MyPassword1!"; //DVR password int relayNumber = 2; //indicate which DVR Relay you want to control //----------------------------------------------- //Do not edit this line ----------------------------- AutomaticControl(DVR_IP_Address,DVR_username,DVR_password,relayNumber-1); //Do not edit above line ----------------------------- } }