From e83d9b94d2cf1348e12aaf53ba2892afbca66b23 Mon Sep 17 00:00:00 2001 From: Niklas Neugebauer Date: Mon, 20 Jan 2025 16:59:48 +0100 Subject: [PATCH] feat: ensure substream is updated with jovision_profile --- rosys/vision/rtsp_camera/rtsp_camera.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rosys/vision/rtsp_camera/rtsp_camera.py b/rosys/vision/rtsp_camera/rtsp_camera.py index 6c1634a2..348b4075 100644 --- a/rosys/vision/rtsp_camera/rtsp_camera.py +++ b/rosys/vision/rtsp_camera/rtsp_camera.py @@ -39,7 +39,7 @@ def __init__(self, self.ip: str | None = ip self.substream = jovision_profile or substream - self._register_parameter('jovision_profile', self.get_substream, self.set_jovision_profile, + self._register_parameter('jovision_profile', self.get_jovision_profile, self.set_jovision_profile, min_value=0, max_value=1, step=1, default_value=substream) self._register_parameter('substream', self.get_substream, self.set_substream, min_value=0, max_value=1, step=1, default_value=substream) @@ -53,8 +53,7 @@ def to_dict(self) -> dict[str, Any]: name: param.value for name, param in self._parameters.items() } if 'jovision_profile' in parameters: - parameters['substream'] = parameters['jovision_profile'] - del parameters['jovision_profile'] + del parameters['jovision_profile'] # DEPRECATED: 0.27.0 return super().to_dict() | parameters | { 'ip': self.ip, } @@ -126,6 +125,13 @@ async def get_fps(self) -> int | None: return await self.device.get_fps() + @deprecated_function(remove_in_version='0.27.0', stacklevel=3) + def get_jovision_profile(self) -> int | None: + assert self.device is not None + self.parameters['substream'].value = profile + + return self.get_substream() + @deprecated_function(remove_in_version='0.27.0', stacklevel=3) def set_jovision_profile(self, profile: int) -> None: assert self.device is not None