Class PtzService
Implementation of the ONVIF PTZ service
public class PtzService : IPtzService
- Inheritance
-
PtzService
- Implements
- Inherited Members
Constructors
PtzService(HttpClient, OnvifCredentials, string, ILogger<PtzService>, IAuthenticator?)
Initialize a new PTZ service
public PtzService(HttpClient httpClient, OnvifCredentials credentials, string endpoint, ILogger<PtzService> logger, IAuthenticator? authenticator = null)
Parameters
httpClientHttpClientHTTP client to use for requests
credentialsOnvifCredentialsONVIF credentials
endpointstringPTZ service endpoint URL
loggerILogger<PtzService>Logger for PTZ operations
authenticatorIAuthenticatorOptional authenticator to use (defaults to WSSE)
Methods
AbsoluteMoveAsync(string, PtzPosition)
Moves the camera to an absolute position
public Task AbsoluteMoveAsync(string profileToken, PtzPosition position)
Parameters
profileTokenstringThe token identifying the profile to use
positionPtzPositionThe absolute position to move to
Returns
AbsoluteMoveAsync(string, PtzVector)
public Task AbsoluteMoveAsync(string profileToken, PtzVector position)
Parameters
Returns
ContinuousMoveAsync(string, PtzVector)
public Task ContinuousMoveAsync(string profileToken, PtzVector velocity)
Parameters
Returns
ContinuousMoveAsync(string, PtzVector, TimeSpan?)
Starts continuous movement in the specified direction
public Task ContinuousMoveAsync(string profileToken, PtzVector velocity, TimeSpan? timeout = null)
Parameters
profileTokenstringThe token identifying the profile to use
velocityPtzVectorThe velocity vector for the movement
timeoutTimeSpan?Optional timeout after which movement will stop
Returns
CreatePresetAsync(string, string)
public Task<string> CreatePresetAsync(string profileToken, string presetName)
Parameters
Returns
CreateTourAsync(string, PtzTour)
Creates a new PTZ tour
public Task<string> CreateTourAsync(string profileToken, PtzTour tour)
Parameters
profileTokenstringThe token identifying the profile to use
tourPtzTourThe tour configuration to create
Returns
DeleteTourAsync(string, string)
Deletes a PTZ tour
public Task DeleteTourAsync(string profileToken, string tourToken)
Parameters
profileTokenstringThe token identifying the profile to use
tourTokenstringThe token identifying the tour to delete
Returns
GetPositionAsync(string)
Gets the current PTZ position of the camera
public Task<PtzPosition> GetPositionAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
- Task<PtzPosition>
The current PTZ position
GetPresetsAsync(string)
Gets all presets configured for the camera
public Task<List<PtzPreset>> GetPresetsAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
GetStatusAsync(string)
Gets the status of the PTZ device including position and movement
public Task<PtzStatus> GetStatusAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
GetSupportedAuxiliaryCommandsAsync(string)
Gets the list of supported auxiliary commands
public Task<List<string>> GetSupportedAuxiliaryCommandsAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
GetTourAsync(string, string)
Gets a specific PTZ tour by token
public Task<PtzTour> GetTourAsync(string profileToken, string tourToken)
Parameters
profileTokenstringThe token identifying the profile to use
tourTokenstringThe token identifying the tour
Returns
GetTourOptionsAsync(string)
Gets configuration options for PTZ tours
public Task<TourOptions> GetTourOptionsAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
- Task<TourOptions>
The tour configuration options
GetToursAsync(string)
Gets all available PTZ tours for a profile
public Task<List<PtzTour>> GetToursAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
GotoPresetAsync(string, string)
Moves the camera to a specific preset position
public Task GotoPresetAsync(string profileToken, string presetToken)
Parameters
profileTokenstringThe token identifying the profile to use
presetTokenstringThe token identifying the preset to go to
Returns
PauseTourAsync(string, string)
Temporarily pauses a running tour
public Task PauseTourAsync(string profileToken, string tourToken)
Parameters
profileTokenstringThe token identifying the profile to use
tourTokenstringThe token identifying the tour to pause
Returns
RelativeMoveAsync(string, PtzVector)
Moves the camera relative to its current position
public Task RelativeMoveAsync(string profileToken, PtzVector translation)
Parameters
profileTokenstringThe token identifying the profile to use
translationPtzVectorThe relative movement vector
Returns
RemovePresetAsync(string, string)
public Task RemovePresetAsync(string profileToken, string presetToken)
Parameters
Returns
SendAuxiliaryCommandAsync(string, string)
Sends an auxiliary command to the PTZ device
public Task<string> SendAuxiliaryCommandAsync(string profileToken, string auxiliaryCommand)
Parameters
profileTokenstringThe token identifying the profile to use
auxiliaryCommandstringThe auxiliary command to send
Returns
SetPresetAsync(string, string?, string?)
Sets a new preset at the current camera position
public Task<string> SetPresetAsync(string profileToken, string? presetName = null, string? presetToken = null)
Parameters
profileTokenstringThe token identifying the profile to use
presetNamestringOptional name for the preset
presetTokenstringOptional token for the preset (if updating existing)
Returns
StartTourAsync(string, string)
Starts a PTZ tour
public Task StartTourAsync(string profileToken, string tourToken)
Parameters
profileTokenstringThe token identifying the profile to use
tourTokenstringThe token identifying the tour to start
Returns
StopAsync(string)
Stops all PTZ movement
public Task StopAsync(string profileToken)
Parameters
profileTokenstringThe token identifying the profile to use
Returns
StopTourAsync(string, string)
Stops a running PTZ tour
public Task StopTourAsync(string profileToken, string tourToken)
Parameters
profileTokenstringThe token identifying the profile to use
tourTokenstringThe token identifying the tour to stop
Returns
UpdateTourAsync(string, PtzTour)
Modifies an existing PTZ tour
public Task UpdateTourAsync(string profileToken, PtzTour tour)
Parameters
profileTokenstringThe token identifying the profile to use
tourPtzTourThe tour with updated configuration