Class OnvifPTZMoveTransport
- Namespace
- VisioForge.Core.AI.PTZ
- Assembly
- VisioForge.Core.AI.dll
VisioForge.Core.AI.PTZ.IPTZMoveTransport implementation that actuates a real ONVIF PTZ camera through a connected VisioForge.Core.ONVIFX.ONVIFClientX and a media profile token.
public sealed class OnvifPTZMoveTransport : IPTZMoveTransportInheritance
Implements
Inherited Members
Remarks
The wrapped client must already be connected (see ONVIFClientX.ConnectAsync) and the device
must support PTZ (verify with VisioForge.Core.AI.PTZ.OnvifPTZMoveTransport.IsPTZSupportedAsync(VisioForge.Core.ONVIFX.ONVIFClientX), which falls back to a media-profile
PTZConfiguration probe when the ONVIF service cache is empty). Use VisioForge.Core.AI.PTZ.OnvifPTZMoveTransport.CreateAsync(VisioForge.Core.ONVIFX.ONVIFClientX) to
resolve a PTZ-capable media profile token automatically.
Constructors
OnvifPTZMoveTransport(ONVIFClientX, string)
Initializes a new instance of the VisioForge.Core.AI.PTZ.OnvifPTZMoveTransport class.
public OnvifPTZMoveTransport(ONVIFClientX client, string profileToken)Parameters
clientONVIFClientX-
A connected ONVIF client. Must not be null.
profileTokenstring-
The media profile token that carries the PTZ configuration. Must not be null or empty.
Exceptions
- ArgumentNullException
-
Thrown when
clientis null. - ArgumentException
-
Thrown when
profileTokenis null or empty.
Properties
ProfileToken
Gets the media profile token used for PTZ commands.
public string ProfileToken { get; }Property Value
Methods
ContinuousMoveAsync(float, float, float)
Starts (or updates) continuous PTZ movement at the given per-axis speeds.
public Task<bool> ContinuousMoveAsync(float panSpeed, float tiltSpeed, float zoomSpeed)Parameters
panSpeedfloat-
Pan speed in [-1, 1]; positive is right.
tiltSpeedfloat-
Tilt speed in [-1, 1]; positive is up.
zoomSpeedfloat-
Zoom speed in [-1, 1]; positive is in.
Returns
CreateAsync(ONVIFClientX)
Creates a transport for a connected client, preferring a media profile that carries a
PTZConfiguration and falling back to the first token-bearing profile otherwise.
public static Task<OnvifPTZMoveTransport> CreateAsync(ONVIFClientX client)Parameters
clientONVIFClientX-
A connected ONVIF client. Must not be null.
Returns
- Task<OnvifPTZMoveTransport>
-
A new VisioForge.Core.AI.PTZ.OnvifPTZMoveTransport, or
nullwhen the device exposes no media profile with a usable token.
Exceptions
- ArgumentNullException
-
Thrown when
clientis null.
GoToPresetAsync(string)
Moves the camera to a named preset. Used to return home when the target is lost.
Implementations that do not support presets may treat this as a no-op and return true;
a null or empty token is not a preset and returns false.
public Task<bool> GoToPresetAsync(string presetToken)Parameters
presetTokenstring-
The preset token to move to.
Returns
IsPTZSupportedAsync(ONVIFClientX)
Determines whether the connected device supports PTZ, robustly against cameras whose ONVIF service list is not populated after connect.
public static Task<bool> IsPTZSupportedAsync(ONVIFClientX client)Parameters
clientONVIFClientX-
A connected ONVIF client. Must not be null.
Returns
Remarks
VisioForge.Core.ONVIFX.ONVIFClientX.IsPTZSupported only consults the client's cached
supported-services list; some cameras (e.g. Dahua) drop the authenticated GetServices
refresh during connect, leaving that cache empty and the method reporting "no PTZ" for a
PTZ-capable device. This helper trusts that fast path first, then falls back to an authoritative
probe: a media profile that carries a PTZConfiguration is proof the device supports PTZ.
Exceptions
- ArgumentNullException
-
Thrown when
clientis null.
StopAsync(bool, bool)
Stops PTZ movement on the selected axes.
public Task<bool> StopAsync(bool panTilt, bool zoom)