private void button1_Click(object sender, EventArgs e) { //_device.AbsoluteMove(1, 1); // _device.RelativeMove(1, 1); _device.MoveUp(); OnvifServices.v20.PTZ.PTZNode node = _device.PTZ.GetNodes()[0]; //var response = _device.Managment.GetServices(true); }
public OperationResponse RelativeMove(float x, float y) { OperationResponse rs = this.CheckPTZSupported(); if (rs.IsSuccess) { if (!this.IsRelativeMoveSupported) { rs.IsSuccess = false; rs.Message = "Operacion de Movimiento Relativo no soportada"; } } if (rs.IsSuccess) { try { OnvifServices.v20.PTZ.PTZNode node = this.PTZ.GetNodes()[0]; if (node != null) { OnvifServices.v20.PTZ.FloatRange xRange = node.SupportedPTZSpaces.RelativePanTiltTranslationSpace[0].XRange; OnvifServices.v20.PTZ.FloatRange yRange = node.SupportedPTZSpaces.RelativePanTiltTranslationSpace[0].YRange; if (x < xRange.Min || x > xRange.Max) { throw new KenosOnvifException(string.Format("Valor x inválido. x: {0}", x)); } if (y < yRange.Min || y > yRange.Max) { throw new KenosOnvifException(string.Format("Valor y inválido. y: {0}", y)); } } OnvifServices.v20.PTZ.PTZVector translation = new OnvifServices.v20.PTZ.PTZVector { PanTilt = new OnvifServices.v20.PTZ.Vector2D { x = x, y = y, space = this.PTZConfig.DefaultRelativePanTiltTranslationSpace } }; OnvifServices.v20.PTZ.PTZSpeed speed = new OnvifServices.v20.PTZ.PTZSpeed { PanTilt = new OnvifServices.v20.PTZ.Vector2D { space = this.PTZConfig.DefaultPTZSpeed.PanTilt.space, x = this.PTZConfig.DefaultPTZSpeed.PanTilt.x, y = this.PTZConfig.DefaultPTZSpeed.PanTilt.y }, Zoom = new OnvifServices.v20.PTZ.Vector1D() { space = this.PTZConfig.DefaultPTZSpeed.Zoom.space, x = this.PTZConfig.DefaultPTZSpeed.Zoom.x } }; this.PTZ.RelativeMove(this.ProfileToken, translation, speed); } catch (Exception ex) { RaiseOnLog("Error realizando movimiento relativo", ex); } } if (!rs.IsSuccess) { RaiseOnLog(rs); } return(rs); }