separate autotracking onvif needs from standard ptz control setup

This commit is contained in:
Josh Hawkins 2024-03-09 08:28:46 -06:00
parent 62d13024f6
commit 445268ae12

View File

@ -120,6 +120,16 @@ class OnvifController:
ptz = onvif.create_ptz_service()
# setup continuous moving request
move_request = ptz.create_type("ContinuousMove")
move_request.ProfileToken = profile.token
self.cams[camera_name]["move_request"] = move_request
# extra setup for autotracking cameras
if (
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
and self.config.cameras[camera_name].onvif.autotracking.enabled
):
request = ptz.create_type("GetConfigurationOptions")
request.ConfigurationToken = profile.PTZConfiguration.token
ptz_config = ptz.GetConfigurationOptions(request)
@ -169,11 +179,6 @@ class OnvifController:
None,
)
# setup continuous moving request
move_request = ptz.create_type("ContinuousMove")
move_request.ProfileToken = profile.token
self.cams[camera_name]["move_request"] = move_request
# setup relative moving request for autotracking
move_request = ptz.create_type("RelativeMove")
move_request.ProfileToken = profile.token
@ -242,6 +247,10 @@ class OnvifController:
if configs.DefaultRelativeZoomTranslationSpace:
supported_features.append("zoom-r")
if (
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
and self.config.cameras[camera_name].onvif.autotracking.enabled
):
try:
# get camera's zoom limits from onvif config
self.cams[camera_name]["relative_zoom_range"] = (
@ -261,6 +270,10 @@ class OnvifController:
if configs.DefaultAbsoluteZoomPositionSpace:
supported_features.append("zoom-a")
if (
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
and self.config.cameras[camera_name].onvif.autotracking.enabled
):
try:
# get camera's zoom limits from onvif config
self.cams[camera_name]["absolute_zoom_range"] = (
@ -278,7 +291,9 @@ class OnvifController:
# set relative pan/tilt space for autotracker
if (
fov_space_id is not None
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
and self.config.cameras[camera_name].onvif.autotracking.enabled
and fov_space_id is not None
and configs.DefaultRelativePanTiltTranslationSpace is not None
):
supported_features.append("pt-r-fov")