From 85098513a0351e94d9cc9a78710e09aa2eccdfbb Mon Sep 17 00:00:00 2001 From: rahehl <7577984+RaHehl@users.noreply.github.com> Date: Sun, 17 Nov 2024 22:22:08 +0100 Subject: [PATCH 1/3] feat: add feature flags for nfc and fingerprint --- src/uiprotect/data/devices.py | 3 +++ tests/sample_data/sample_bootstrap.json | 2 ++ tests/sample_data/sample_camera.json | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/uiprotect/data/devices.py b/src/uiprotect/data/devices.py index b6f21f93..d084f246 100644 --- a/src/uiprotect/data/devices.py +++ b/src/uiprotect/data/devices.py @@ -859,6 +859,9 @@ class CameraFeatureFlags(ProtectBaseObject): has_vertical_flip: bool | None = None # 3.0.22+ flash_range: Any | None = None + # 4.73.71+ + support_nfc: bool | None = None + has_fingerprint_sensor: bool | None = None focus: PTZRange pan: PTZRange diff --git a/tests/sample_data/sample_bootstrap.json b/tests/sample_data/sample_bootstrap.json index 0341f51f..16617c9a 100644 --- a/tests/sample_data/sample_bootstrap.json +++ b/tests/sample_data/sample_bootstrap.json @@ -2000,11 +2000,13 @@ "videoModeMaxFps": [], "hasMotionZones": true, "hasLcdScreen": true, + "hasFingerprintSensor": true, "mountPositions": [], "smartDetectTypes": [ "person", "vehicle" ], + "supportNfc": true, "motionAlgorithms": [ "enhanced" ], diff --git a/tests/sample_data/sample_camera.json b/tests/sample_data/sample_camera.json index df998ba4..6d1ea864 100644 --- a/tests/sample_data/sample_camera.json +++ b/tests/sample_data/sample_camera.json @@ -468,11 +468,13 @@ "videoModeMaxFps": [], "hasMotionZones": true, "hasLcdScreen": true, + "hasFingerprintSensor": true, "mountPositions": [], "smartDetectTypes": [ "person", "vehicle" ], + "supportNfc": true, "motionAlgorithms": [ "enhanced" ], From ac3b3691c61965ac8b46f7d4b85db49a22075eb1 Mon Sep 17 00:00:00 2001 From: rahehl <7577984+RaHehl@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:32:20 +0100 Subject: [PATCH 2/3] test: add tests for feature flags nfc and fingerprint --- tests/conftest.py | 3 +++ tests/test_api_ws.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index b4214ff1..2f68ed75 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -744,6 +744,9 @@ def tmp_binary_file(): "hasVerticalFlip", # 3.0.22+ "flashRange", + # 4.73.71+ + "supportNfc", + "hasFingerprintSensor" } NEW_ISP_SETTINGS = { diff --git a/tests/test_api_ws.py b/tests/test_api_ws.py index 82d5efc0..27fd80e8 100644 --- a/tests/test_api_ws.py +++ b/tests/test_api_ws.py @@ -339,6 +339,7 @@ def get_camera(): camera = get_camera() assert camera.last_nfc_card_scanned_event is None + assert camera.feature_flags.support_nfc is True msg = MagicMock() msg.data = packet.pack_frames() @@ -412,6 +413,7 @@ def get_camera(): camera = get_camera() assert camera.last_fingerprint_identified_event is None + assert camera.feature_flags.has_fingerprint_sensor is True msg = MagicMock() msg.data = packet.pack_frames() From cc8becd44a664d57501c6a5afde7d815fdabc89a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:32:47 +0000 Subject: [PATCH 3/3] chore(pre-commit.ci): auto fixes --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2f68ed75..1ec650c9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -746,7 +746,7 @@ def tmp_binary_file(): "flashRange", # 4.73.71+ "supportNfc", - "hasFingerprintSensor" + "hasFingerprintSensor", } NEW_ISP_SETTINGS = {