Skip to content

Conversation

@MateoLostanlen
Copy link
Member

This PR introduces a new LinovisionCamera implementation for the camera API, enabling control and image capture for Linovision PTZ devices via ISAPI. The class follows the same public interface and overall architecture as ReolinkCamera, so it can be used by existing PTZ and capture flows with minimal changes.

What is included

  • New LinovisionCamera class backed by ISAPI endpoints

    • Snapshot capture using /ISAPI/Streaming/channels/{snapshot_channel}/picture
    • PTZ status via /ISAPI/PTZCtrl/channels/{ptz_channel}/status
    • Continuous PTZ commands via /ISAPI/PTZCtrl/channels/{ptz_channel}/continuous
    • Absolute PTZ moves using absoluteEx, including optional absoluteZoom
    • Perfect move option implemented by polling PTZ status until azimuth_raw matches the target
  • Real azimuth handling compatible with our existing config format

    • cam_azimuths remains real world azimuths for parity with Reolink
    • A new azimuth_offset_deg converts real azimuths into camera frame azimuths for commands
    • get_ptz_status returns both camera frame azimuth and real_azimuth_deg
  • Pose based movement without relying on device preset goto

    • move_to_pose(pose_id) resolves pose_id to a target azimuth from cam_poses and cam_azimuths
    • move_camera("ToPos") uses the mapping when available, otherwise falls back to ISAPI preset goto
  • Speed compatibility layer

    • Accepts Reolink style speed values and maps them into Linovision ISAPI ranges
    • move_absolute maps horizontal and vertical speed from 1 to 64 into 0.1 to 80
    • Continuous PTZ maps speed from 1 to 64 into 1 to 100
  • Zoom support

    • start_zoom_focus(position) sets the ISAPI absoluteZoom value while keeping current azimuth and elevation

Why

We need first class support for Linovision PTZ cameras in deployments. ISAPI support also makes pose targeting deterministic, since we can poll the camera until the target azimuth is reached, which is important for repeatable calibration and capture loops.

Notes and limitations

  • Manual focus, autofocus, and focus level endpoints are not implemented yet, the methods remain stubs
  • Zoom in start_zoom_focus currently uses the device range 1 to 25, consistent with the camera capabilities we observed
  • Preset goto speed is not exposed by the device, so pose movement is implemented through azimuth mapping plus absolute move for predictable results

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.49%. Comparing base (159635f) to head (7432184).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #317   +/-   ##
========================================
  Coverage    80.49%   80.49%           
========================================
  Files            7        7           
  Lines          810      810           
========================================
  Hits           652      652           
  Misses         158      158           
Flag Coverage Δ
unittests 80.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fe51
Copy link
Member

fe51 commented Dec 19, 2025

HI there, thanks a lot for the PR.

A question before reviewing the code, have you tested this branch of code on a device that is connected to other types of cameras to ensure that there is no regression?

Copy link
Member

@fe51 fe51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be relevant to also update the readme providing an example for linovision setup/default value ?

fe51
fe51 previously approved these changes Dec 19, 2025
Copy link
Member

@fe51 fe51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Approve in order to quickly be able to test with develop on some devices.

However, it might be relevant to delete reference hikvision adapter that does not exists yet (see comments) and add some info in the readme onhow to setup/init a linovision class :)

@MateoLostanlen MateoLostanlen merged commit ca00cea into develop Dec 19, 2025
10 of 11 checks passed
@MateoLostanlen MateoLostanlen deleted the linovision_camera branch December 19, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants