Table of Contents

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 : IPTZMoveTransport

Inheritance

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

client ONVIFClientX

A connected ONVIF client. Must not be null.

profileToken string

The media profile token that carries the PTZ configuration. Must not be null or empty.

Exceptions

ArgumentNullException

Thrown when client is null.

ArgumentException

Thrown when profileToken is null or empty.

Properties

ProfileToken

Gets the media profile token used for PTZ commands.

public string ProfileToken { get; }

Property Value

string

Methods

ContinuousMoveAsync(float, float, float)

Starts (or updates) continuous PTZ movement at the given per-axis speeds.

public Task ContinuousMoveAsync(float panSpeed, float tiltSpeed, float zoomSpeed)

Parameters

panSpeed float

Pan speed in [-1, 1]; positive is right.

tiltSpeed float

Tilt speed in [-1, 1]; positive is up.

zoomSpeed float

Zoom speed in [-1, 1]; positive is in.

Returns

Task

A task that completes when the command has been issued.

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

client ONVIFClientX

A connected ONVIF client. Must not be null.

Returns

Task<OnvifPTZMoveTransport>

A new VisioForge.Core.AI.PTZ.OnvifPTZMoveTransport, or null when the device exposes no media profile with a usable token.

Exceptions

ArgumentNullException

Thrown when client is 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.

public Task GoToPresetAsync(string presetToken)

Parameters

presetToken string

The preset token to move to.

Returns

Task

A task that completes when the command has been issued.

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

client ONVIFClientX

A connected ONVIF client. Must not be null.

Returns

Task<bool>

true when the device exposes PTZ; otherwise false.

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 client is null.

StopAsync(bool, bool)

Stops PTZ movement on the selected axes.

public Task StopAsync(bool panTilt, bool zoom)

Parameters

panTilt bool

When true, stops pan/tilt movement.

zoom bool

When true, stops zoom movement.

Returns

Task

A task that completes when the stop has been issued.