public OnVifPTZController(OnVifDevice OnVifDevice) : base(OnVifDevice) { // m_onVifDevice = OnVifDevice; // m_mediaClient = null; //m_profile = null; m_Timer = null; m_velocity = null; m_vector = null; m_options = null; m_relative = false; m_initialised = false; m_direction = m_direction = Direction.None; m_Presets = null; m_capabilities = null; m_ptzClient = null; m_ErrorMessage = ""; m_configs = null; m_initialised = false; m_panDistance = 0; m_tiltDistance = 0; m_bMoveActiv = false; m_timeinmsec = 200; m_doContineousMode = false; m_ProfileRefToken = ""; }
public static void CountinuousRotatePTZ(Structures set, OPTZ.PTZSpeed speed, int timeout = -1) { try { if (set.GetPTZTokens() == "" || !set.IsActive) { return; } var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress mediaAddress = new EndpointAddress(set.GetONVIF + "onvif/PTZ"); PTZClient mediaClient = new PTZClient(bind, mediaAddress); mediaClient.ClientCredentials.UserName.UserName = set.Login; mediaClient.ClientCredentials.UserName.Password = set.Password; mediaClient.ContinuousMove(set.GetMediaTokens()[0], speed, "0"); System.Threading.Thread.Sleep(timeout <= 0 ? (int)Settings.StaticMembers.PTZSettings.Timeout : timeout);//1000 mediaClient.Stop(set.GetPTZTokens(), true, true); } catch { return; } }
public static bool PTZSupport(Structures set) { try { if (set.GetPTZTokens() == "" || !set.IsActive) { return(false); } var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress mediaAddress = new EndpointAddress(set.GetONVIF + "/onvif/PTZ"); PTZClient mediaClient = new PTZClient(bind, mediaAddress); mediaClient.ClientCredentials.UserName.UserName = set.Login; mediaClient.ClientCredentials.UserName.Password = set.Password; var nodes = mediaClient.GetNodes(); return(nodes[0].HomeSupported); } catch { return(false); } }
protected void SetHomePostion(string profile) { PTZClient client = PtzClient; RunStep(() => { client.SetHomePosition(profile); }, "Set Home position"); DoRequestDelay(); }
public static PTZConfiguration[] GetPtzConfigurations(BaseOnvifTest test, PTZClient client) { PTZConfiguration[] result = null; RunStep(test, () => { result = client.GetConfigurations(); }, "Get PTZ configurations"); DoRequestDelay(test); return(result); }
public static void PTZStop(Structures set) { try { if (set.GetPTZTokens() == "" || !set.IsActive || !set.GetPTZController().IsSuported) { return; } var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress mediaAddress = new EndpointAddress(set.GetONVIF + "/onvif/PTZ"); PTZClient mediaClient = new PTZClient(bind, mediaAddress); mediaClient.ClientCredentials.UserName.UserName = set.Login; mediaClient.ClientCredentials.UserName.Password = set.Password; mediaClient.Stop(set.GetPTZTokens(), true, true); } catch { return; } }
public static string PTZStatus(Structures set) { try { if (set.GetPTZTokens() == "" || !set.IsActive) { return(MoveStatus.UNKNOWN.ToString()); } var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress mediaAddress = new EndpointAddress(set.GetONVIF + "/onvif/PTZ"); PTZClient mediaClient = new PTZClient(bind, mediaAddress); mediaClient.ClientCredentials.UserName.UserName = set.Login; mediaClient.ClientCredentials.UserName.Password = set.Password; try { var t = mediaClient.GetStatus(set.GetPTZTokens()).MoveStatus; return(t.PanTilt.ToString()); } catch { return(MoveStatus.UNKNOWN.ToString()); } } catch { return(MoveStatus.UNKNOWN.ToString()); } }
public static void RotatePTZ(Structures set, PTZVector vector, OPTZ.PTZSpeed speed) { try { if (set.GetPTZTokens() == "" || !set.IsActive) { return; } var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress mediaAddress = new EndpointAddress(set.GetONVIF + "/onvif/PTZ"); PTZClient mediaClient = new PTZClient(bind, mediaAddress); mediaClient.ClientCredentials.UserName.UserName = set.Login; mediaClient.ClientCredentials.UserName.Password = set.Password; var t = mediaClient.GetConfigurations()[0].DefaultPTZTimeout; mediaClient.RelativeMove(set.GetMediaTokens()[0], vector, speed); //set.GetMediaTokens()[0] //mediaClient.ContinuousMove(set.GetMediaTokens()[0], speed) } catch { return; } }
private void UpdatePtzLocation(PTZClient ptzClient, string profileToken) { // Get Status PTZStatus status = ptzClient.GetStatus(profileToken); lblPtzLocationX.Text = "x: " + status.Position.PanTilt.x.ToString(); lblPtzLocationY.Text = "y: " + status.Position.PanTilt.y.ToString(); lblPtzLocationZoom.Text = "zoom: " + status.Position.Zoom.x.ToString(); }
protected PTZNode[] GetPtzNodes() { PTZClient client = PtzClient; PTZNode[] nodes = null; RunStep(() => { nodes = client.GetNodes(); }, "Get PTZ Nodes"); DoRequestDelay(); return(nodes); }
protected PTZNode GetPtzNode() { PTZClient client = PtzClient; PTZNode node = null; RunStep(() => { node = client.GetNode(_ptzNode); }, "Get PTZ Node"); DoRequestDelay(); return(node); }
private void Stop_zoom(object sender, RoutedEventArgs e) { bool flag = combobox.Items.Count > 0 && combobox.SelectedIndex != 2; if (flag) { PTZClient pTZClient = GetPTZClient(); PTZConfigurationOptions configurationOptions = pTZClient.GetConfigurationOptions(profiles[combobox.SelectedIndex].PTZConfiguration.token); pTZClient.Stop(profiles[combobox.SelectedIndex].token, true, true); } }
public async Task <OnvifDevice> Setup() { device = await OnvifClientFactory.CreateDeviceClientAsync(Host + ":" + Port, UserName, Password); var devicecapabilities = await device.GetCapabilitiesAsync(new CapabilityCategory[] { CapabilityCategory.All }); var info = await device.GetDeviceInformationAsync(new GetDeviceInformationRequest() { }); media = await OnvifClientFactory.CreateMediaClientAsync(Host + ":" + Port, UserName, Password); var profiles = await media.GetProfilesAsync(); ptz = await Onvif.Core.Client.OnvifClientFactory.CreatePTZClientAsync(Host + ":" + Port, UserName, Password); var capabilities = await ptz.GetServiceCapabilitiesAsync(); var config = await ptz.GetConfigurationsAsync(); var space = config.PTZConfiguration[0].DefaultAbsolutePantTiltPositionSpace; token = profiles.Profiles[0].token; xrange = config.PTZConfiguration[0].PanTiltLimits.Range.XRange; yrange = config.PTZConfiguration[0].PanTiltLimits.Range.YRange; zrange = config.PTZConfiguration[0].ZoomLimits.Range.XRange; var status = await ptz.GetStatusAsync(token); //var presets = await ptz.GetPresetsAsync(token); //Console.WriteLine("preset "); // await ptz.GotoPresetAsync(token, presets.Preset[0].token, null); //Thread.Sleep(4000); var nodes = await ptz.GetNodesAsync(); //Console.WriteLine("home "); //await ptz.GotoHomePositionAsync(token, null); //Thread.Sleep(2000); //Console.WriteLine("ContinuousMoveAsync "); /* * await ptz.ContinuousMoveAsync(token, new PTZSpeed() {PanTilt = new Vector2D() {x = -1f, y = -1}, Zoom = new Vector1D() { x=0f}}, "2"); * Thread.Sleep(2000); * await ptz.StopAsync(token, true, true); */ return(this); }
//public OnvifPtz(string ip, int port, string user, string password) //{ // System.Net.IPAddress.TryParse(ip, out IP); // Port = port; // User = user; // Password = password; // PtzClient = OnvifServices.GetOnvifPTZClient(IP.ToString(), Port, User, Password); // MediaClient = OnvifServices.GetOnvifMediaClient(IP.ToString(), Port, User, Password); //} public OnvifPtz(string mediaUri, string ptzUri, double deviceTimeOffset, string user, string password) { User = user; Password = password; if (string.IsNullOrEmpty(mediaUri) | string.IsNullOrEmpty(ptzUri)) { throw new Exception("Media and/or PTZ URI is empty or null. PTZ object cannot be created"); } PtzClient = OnvifServices.GetOnvifPTZClient(ptzUri, deviceTimeOffset, User, Password); MediaClient = OnvifServices.GetOnvifMediaClient(mediaUri, deviceTimeOffset, User, Password); }
protected PTZConfiguration[] GetPtzConfigurations() { PTZClient client = PtzClient; PTZConfiguration[] configurations = null; RunStep(() => { configurations = client.GetConfigurations(); }, "Get PTZ Configurations"); DoRequestDelay(); if (configurations != null) { LogStepEvent(string.Format("{0} configurations found", configurations.Length)); } return(configurations); }
void Connect() { HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest; var messageElement = new TextMessageEncodingBindingElement(); // FIXME: Probe for Soap12 if Soap11 fails messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap11, AddressingVersion.None); CustomBinding bind = new CustomBinding(messageElement, httpBinding); media = new MediaClient(bind, new EndpointAddress(uriEntry.Text + "media_service")); media.ClientCredentials.UserName.UserName = @"admin"; media.ClientCredentials.UserName.Password = @"admin"; ptz = new PTZClient(bind, new EndpointAddress(uriEntry.Text + "ptz_service")); ptz.ClientCredentials.UserName.UserName = @"admin"; ptz.ClientCredentials.UserName.Password = @"admin"; foreach (var v in media.GetVideoSources()) { Console.WriteLine(v.Resolution.Width + "x" + v.Resolution.Height); Console.WriteLine(v.token); } profile = media.GetProfiles().First(); Console.WriteLine(profile.VideoSourceConfiguration.Name); Console.WriteLine(profile.VideoEncoderConfiguration.Resolution.Width + " " + profile.VideoEncoderConfiguration.Resolution.Height); Transport t = new Transport { Protocol = TransportProtocol.RTSP, Tunnel = null, }; Console.WriteLine(media.GetStreamUri( new StreamSetup { Stream = StreamType.RTPUnicast, Transport = t }, profile.token).Uri); xmax = profile.PTZConfiguration.PanTiltLimits.Range.XRange.Max; xmin = profile.PTZConfiguration.PanTiltLimits.Range.XRange.Min; ymax = profile.PTZConfiguration.PanTiltLimits.Range.YRange.Max; ymin = profile.PTZConfiguration.PanTiltLimits.Range.YRange.Min; zmax = profile.PTZConfiguration.ZoomLimits.Range.XRange.Max; zmin = profile.PTZConfiguration.ZoomLimits.Range.XRange.Min; tmax = "1"; hbox1.Visible = true; }
/// <summary> /// Instantiates PTZ object with known media profile /// </summary> /// <param name="mediaUri">Camera's Media URI (from device client GetServices())</param> /// <param name="ptzUri">Camera's PTZ URI (from device client GetServices())</param> /// <param name="deviceTimeOffset">Difference between device time and client time (seconds)</param> /// <param name="mediaProfile">Media Profile to use</param> /// <param name="user">Username</param> /// <param name="password">Password</param> public OnvifPtz(string mediaUri, string ptzUri, double deviceTimeOffset, RTSP_Viewer.OnvifMediaServiceReference.Profile mediaProfile, string user, string password) { User = user; Password = password; if (string.IsNullOrEmpty(mediaUri) | string.IsNullOrEmpty(ptzUri)) { throw new Exception("Media and/or PTZ URI is empty or null. PTZ object cannot be created"); } PtzClient = OnvifServices.GetOnvifPTZClient(ptzUri, deviceTimeOffset, User, Password); MediaProfile = mediaProfile; // Should be able to remove this once all instantiates go through this constructor (only used by GetMediaProfile - which is only necessary if a mediaProfile is not provided) MediaClient = OnvifServices.GetOnvifMediaClient(mediaUri, deviceTimeOffset, User, Password); }
private void zoomin(object sender, RoutedEventArgs e) { bool flag = combobox.Items.Count > 0 && combobox.SelectedIndex != 2; if (flag) { PTZClient pTZClient = GetPTZClient(); PTZConfigurationOptions configurationOptions = pTZClient.GetConfigurationOptions(profiles[combobox.SelectedIndex].PTZConfiguration.token); ROCKFIRM.PTZ.PTZSpeed velocity = new ROCKFIRM.PTZ.PTZSpeed { Zoom = new ROCKFIRM.PTZ.Vector1D { x = 0.5f } }; pTZClient.ContinuousMove(profiles[combobox.SelectedIndex].token, velocity, null); } }
public static async Task <PTZClient> CreatePTZClientAsync(string host, string username, string password) { var binding = CreateBinding(); var device = await CreateDeviceClientAsync(host, username, password); var caps = await device.GetCapabilitiesAsync(new CapabilityCategory [] { CapabilityCategory.PTZ }); var ptz = new PTZClient(binding, new EndpointAddress(new Uri(caps.Capabilities.PTZ.XAddr))); var time_shift = await GetDeviceTimeShift(device); ptz.ChannelFactory.Endpoint.EndpointBehaviors.Clear(); ptz.ChannelFactory.Endpoint.EndpointBehaviors.Add(new SoapSecurityHeaderBehavior(username, password, time_shift)); // Connectivity Test await ptz.OpenAsync(); return(ptz); }
private void PTZTest(DeviceClient client, double deviceTimeOffset, string ip, int port) { // Create Media object OnvifMediaServiceReference.MediaClient mediaService = OnvifServices.GetOnvifMediaClient(ServiceUris[OnvifNamespace.MEDIA], deviceTimeOffset, "", ""); // Create PTZ object PTZClient ptzService = OnvifServices.GetOnvifPTZClient(ServiceUris["http://www.onvif.org/ver20/ptz/wsdl"], deviceTimeOffset, "", ""); // ip, port); // new PTZClient(client.Endpoint.Binding, client.Endpoint.Address); // Get target profile OnvifMediaServiceReference.Profile[] mediaProfiles = mediaService.GetProfiles(); string profileToken = mediaProfiles[0].token; OnvifMediaServiceReference.Profile mediaProfile = mediaService.GetProfile(profileToken); // Get Presets try { PTZPreset[] presets = ptzService.GetPresets(profileToken); lbxPtzInfo.Items.Add(""); lbxPtzInfo.Items.Add("Presets"); foreach (PTZPreset p in presets) { lbxPtzInfo.Items.Add(string.Format(" Preset {0} ({1}) @ {2}:{3} {4}", p.Name, p.token, p.PTZPosition.PanTilt.x, p.PTZPosition.PanTilt.y, p.PTZPosition.Zoom.x)); } UpdatePtzLocation(ptzService, profileToken); } catch (Exception ex) { tssLbl.Text = "Unable to get presets and update location: " + ex.Message; throw; } // Fails if not a PTZ OnvifPtzServiceReference.PTZNode node = ptzService.GetNode("1"); // nodes[0].token); OnvifPtzServiceReference.PTZConfiguration[] ptzConfigs = ptzService.GetConfigurations(); File.AppendAllText("ptz.txt", string.Format("\nPTZ configs found: {0}", ptzConfigs.Length)); File.AppendAllText("ptz.txt", string.Format("\nPTZ config - Name: {0}", ptzConfigs[0].Name)); File.AppendAllText("ptz.txt", string.Format("\nPTZ config - Token: {0}", ptzConfigs[0].token)); }
private PTZClient GetPTZClient() { EndpointAddress remoteAddress = new EndpointAddress(string.Format("http://{0}:{1}/onvif/ptz_service", address.Text, 8899)); HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement { AuthenticationScheme = AuthenticationSchemes.Digest }; TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement { MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None) }; CustomBinding binding = new CustomBinding(new BindingElement[] { textMessageEncodingBindingElement, httpTransportBindingElement }); PTZClient pTZClient = new PTZClient(binding, remoteAddress); PasswordDigestBehavior item = new PasswordDigestBehavior(camusername, campassword); pTZClient.Endpoint.Behaviors.Add(item); return(pTZClient); }
public static PTZVector PTZPosition(Structures set) { try { //if (set.GetPTZTokens() == "" || !set.IsActive) return new PTZVector(); var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress mediaAddress = new EndpointAddress(set.GetONVIF + "/onvif/PTZ"); PTZClient mediaClient = new PTZClient(bind, mediaAddress); mediaClient.ClientCredentials.UserName.UserName = set.Login; mediaClient.ClientCredentials.UserName.Password = set.Password; return(mediaClient.GetStatus(set.GetMediaTokens()[0]).Position); } catch { return(new PTZVector()); } }
public static PTZClient GetOnvifPTZClient(string Uri, double deviceTimeOffset, string username = "", string password = "") { EndpointAddress serviceAddress = new EndpointAddress(Uri); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest; var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); CustomBinding bind = new CustomBinding(messageElement, httpBinding); PTZClient ptzClient = new PTZClient(bind, serviceAddress); if (username != string.Empty) { // Handles adding of SOAP Security header containing User Token (user, nonce, pwd digest) PasswordDigestBehavior behavior = new PasswordDigestBehavior(username, password); ptzClient.Endpoint.Behaviors.Add(behavior); } return(ptzClient); }
public bool Initialise(string cameraAddress, string userName, string password) { bool result = false; try { var messageElement = new TextMessageEncodingBindingElement() { MessageVersion = MessageVersion.CreateVersion( EnvelopeVersion.Soap12, AddressingVersion.None) }; HttpTransportBindingElement httpBinding = new HttpTransportBindingElement() { AuthenticationScheme = AuthenticationSchemes.Digest }; CustomBinding bind = new CustomBinding(messageElement, httpBinding); mediaClient = new MediaClient(bind, new EndpointAddress($"http://{cameraAddress}/onvif/Media")); mediaClient.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; mediaClient.ClientCredentials.HttpDigest.ClientCredential.UserName = userName; mediaClient.ClientCredentials.HttpDigest.ClientCredential.Password = password; ptzClient = new PTZClient(bind, new EndpointAddress($"http://{cameraAddress}/onvif/PTZ")); ptzClient.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; ptzClient.ClientCredentials.HttpDigest.ClientCredential.UserName = userName; ptzClient.ClientCredentials.HttpDigest.ClientCredential.Password = password; var profs = mediaClient.GetProfiles(); profile = mediaClient.GetProfile(profs[0].token); var configs = ptzClient.GetConfigurations(); options = ptzClient.GetConfigurationOptions(configs[0].token); velocity = new OnvifPTZService.PTZSpeed() { PanTilt = new OnvifPTZService.Vector2D() { x = 0, y = 0, space = options.Spaces.ContinuousPanTiltVelocitySpace[0].URI, }, Zoom = new OnvifPTZService.Vector1D() { x = 0, space = options.Spaces.ContinuousZoomVelocitySpace[0].URI, } }; if (relative) { timer = new Timer(TimerInterval); timer.Elapsed += Timer_Elapsed; velocity.PanTilt.space = options.Spaces.RelativePanTiltTranslationSpace[0].URI; panDistance = (options.Spaces.RelativePanTiltTranslationSpace[0].XRange.Max - options.Spaces.RelativePanTiltTranslationSpace[0].XRange.Min) / PanIncrements; tiltDistance = (options.Spaces.RelativePanTiltTranslationSpace[0].YRange.Max - options.Spaces.RelativePanTiltTranslationSpace[0].YRange.Min) / TiltIncrements; } vector = new PTZVector() { PanTilt = new OnvifPTZService.Vector2D() { x = 0, y = 0, space = options.Spaces.RelativePanTiltTranslationSpace[0].URI } }; ErrorMessage = ""; result = initialised = true; } catch (Exception ex) { ErrorMessage = ex.Message; } return(result); }
// public bool IsInitialized { get { return m_initialised; } } public override async Task <bool> InitalizeAsync() { if (this.m_onVifDevice.ServicesResponse == null) { bool b = await this.m_onVifDevice.InitalizeDeviceAsync(); if (this.m_onVifDevice.ServicesResponse == null) { return(false); } } try { foreach (var service in this.m_onVifDevice.ServicesResponse.Service) { if (service.Namespace == "http://www.onvif.org/ver20/ptz/wsdl") { string serviceAdress = service.XAddr; m_ErrorMessage = ""; // m_profile = this.m_media10Services.ProfilesResponse.Profiles[0]; HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest; var messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); CustomBinding binding = new CustomBinding(messageElement, httpBinding); this.m_ptzClient = new PTZClient(binding, new EndpointAddress(serviceAdress)); /* * while (m_ptzClient.Endpoint.EndpointBehaviors.Count > 0) * { * m_ptzClient.Endpoint.EndpointBehaviors.RemoveAt(0); * } */ m_ptzClient.Endpoint.EndpointBehaviors.Add(m_onVifDevice.GetBasicBasicAuthBehaviour); m_ptzClient.Endpoint.EndpointBehaviors.Add(m_onVifDevice.GetPasswordDigestBehavior); m_configs = await m_ptzClient.GetConfigurationsAsync(); m_options = await m_ptzClient.GetConfigurationOptionsAsync(m_configs.PTZConfiguration[0].token); m_capabilities = await m_ptzClient.GetServiceCapabilitiesAsync(); m_velocity = new OnvifPTZService.PTZSpeed() { PanTilt = new OnvifPTZService.Vector2D() { x = 0, y = 0, space = m_options.Spaces.ContinuousPanTiltVelocitySpace[0].URI, } , Zoom = new OnvifPTZService.Vector1D() { x = 0, space = m_options.Spaces.ContinuousZoomVelocitySpace[0].URI, } }; m_vector = new PTZVector() { PanTilt = new OnvifPTZService.Vector2D() { x = 0, y = 0, space = m_options.Spaces.RelativePanTiltTranslationSpace[0].URI } }; m_initialised = true; m_bMoveActiv = false; if (m_relative) { m_velocity.PanTilt.space = m_options.Spaces.ContinuousPanTiltVelocitySpace[0].URI; m_velocity.PanTilt.space = m_configs.PTZConfiguration[0].DefaultPTZSpeed.PanTilt.space; m_panDistance = (m_options.Spaces.RelativePanTiltTranslationSpace[0].XRange.Max - m_options.Spaces.RelativePanTiltTranslationSpace[0].XRange.Min) / PanIncrements; m_tiltDistance = (m_options.Spaces.RelativePanTiltTranslationSpace[0].YRange.Max - m_options.Spaces.RelativePanTiltTranslationSpace[0].YRange.Min) / TiltIncrements; } break; } } } catch (Exception ex) { m_ErrorMessage = ex.Message; throw new OnVifException("OnVifPTZController.InitalizeAsync", ex); // return false; } return(m_initialised); }