• 1000 , я получил ошибку 400-Плохой запрос. Я не совсем понимаю, потому что это тот же клиент PTZ и тот же профайл-токен ... Кто-нибудь может мне объяснить?
Вот мои коды:
DeviceClient client = OnvifServices.GetOnvifDeviceClient(IP.ToString(), Port);
string xaddr = string.Format("http://{0}/onvif/services", txtIP.Text);
MediaClient mediaService = OnvifServices.GetOnvifMediaClient(xaddr, DeviceTimeOffset, txtUser.Text, txtPassword.Text);
EndpointAddress serviceAddress = new EndpointAddress(string.Format("http://{0}/onvif/services", IP));
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);
PtzClient = new PTZClient(bind, serviceAddress);
PtzClient.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
PtzClient.ClientCredentials.HttpDigest.ClientCredential.UserName = txtUser.Text;
PtzClient.ClientCredentials.HttpDigest.ClientCredential.Password = txtPassword.Text;
Profile[] mediaProfiles = mediaService.GetProfiles();
string profileToken = mediaProfiles[0].token;
PTZConfigurationOptions options = PtzClient.GetConfigurationOptions(configs[0].token);
PTZPreset[] presets = PtzClient.GetPresets(profileToken);
var presetToken = presets[0].token;
PTZ.PTZSpeed velocity = new PTZ.PTZSpeed();
velocity.PanTilt = new PTZ.Vector2D();
velocity.Zoom = new PTZ.Vector1D();
velocity.PanTilt.x = options.Spaces.ContinuousPanTiltVelocitySpace[0].XRange.Max;
velocity.PanTilt.y = options.Spaces.ContinuousPanTiltVelocitySpace[0].YRange.Max;
velocity.PanTilt.space = options.Spaces.ContinuousPanTiltVelocitySpace[0].URI;
velocity.Zoom.x = options.Spaces.ContinuousZoomVelocitySpace[0].XRange.Max;
velocity.Zoom.space = options.Spaces.ContinuousZoomVelocitySpace[0].URI;
if (presets.Length >= 1)
{
var presetToken = presets[1 - 0].token;
PtzClient.GotoPreset(profileToken, presetToken, velocity);
}
введите описание изображения здесь