Skip to content

Python SDK: Make Cohn feature backwards compatible#757

Merged
tcamise-gpsw merged 6 commits intomainfrom
cohn_feature_backwards_compatible
May 30, 2025
Merged

Python SDK: Make Cohn feature backwards compatible#757
tcamise-gpsw merged 6 commits intomainfrom
cohn_feature_backwards_compatible

Conversation

@tcamise-gpsw
Copy link
Copy Markdown
Collaborator

@tcamise-gpsw tcamise-gpsw commented May 19, 2025

Pull Request Overview

This PR updates the SDK to support legacy COHN protobuf flows by introducing a unified ProtobufId identifier, adding support checks via a require_supported decorator, and enhancing the response parser and routing to handle unsupported protobuf responses gracefully.

  • Introduce ProtobufId type and update all parsers/commands to use it
  • Add require_supported decorator and is_supported checks for features
  • Extend BleRespBuilder and _route_response to identify and route unsupported protobuf errors
  • Update tests and mocks to cover new unsupported-CoHN behavior
  • Bump third-party dependency versions and enable debug logging for response parsing
Show a summary per file
File Description
demos/python/sdk_wireless_camera_control/thirdPartyDependencies.csv Bump packaging to 25.0 and protobuf to 6.31.0
demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py Add unsupported protobuf operation test; update imports
demos/python/sdk_wireless_camera_control/tests/unit/test_responses.py Add and adjust tests for unsupported protobuf responses
demos/python/sdk_wireless_camera_control/tests/unit/test_ble_commands.py Import new ErrorCode and FeatureId for BLE command tests
demos/python/sdk_wireless_camera_control/tests/mocks.py Extend mocks for protobuf and remove legacy BLE send override
demos/python/sdk_wireless_camera_control/open_gopro/util/logger.py Enable DEBUG logging for open_gopro.parsers.response
demos/python/sdk_wireless_camera_control/open_gopro/parsers/response.py Add validResponseProtobufIds and handle missing action IDs
demos/python/sdk_wireless_camera_control/open_gopro/models/types.py Introduce ProtobufId and update ResponseType
demos/python/sdk_wireless_camera_control/open_gopro/models/constants/constants.py Remove deprecated PROTOBUF_QUERY enum
demos/python/sdk_wireless_camera_control/open_gopro/gopro_wireless.py Enhance _route_response to match unsupported protobuf errors
demos/python/sdk_wireless_camera_control/open_gopro/features/base_feature.py Implement require_supported decorator and is_supported abstract property
demos/python/sdk_wireless_camera_control/open_gopro/features/cohn_feature.py Add support tracking and guard methods with require_supported
demos/python/sdk_wireless_camera_control/open_gopro/features/streaming/stream_feature.py Add is_supported property
demos/python/sdk_wireless_camera_control/open_gopro/features/access_point_feature.py Add is_supported property
demos/python/sdk_wireless_camera_control/open_gopro/api/builders.py Update BleProtoCommand to use ProtobufId
demos/python/sdk_wireless_camera_control/open_gopro/api/ble_commands.py Update protobuf commands to use ProtobufId in additional_matching_ids

@tcamise-gpsw tcamise-gpsw linked an issue May 19, 2025 that may be closed by this pull request
@tcamise-gpsw tcamise-gpsw requested a review from Copilot May 19, 2025 22:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the SDK to support legacy COHN protobuf flows by introducing a unified ProtobufId identifier, adding support checks via a require_supported decorator, and enhancing the response parser and routing to handle unsupported protobuf responses gracefully.

  • Introduce ProtobufId type and update all parsers/commands to use it
  • Add require_supported decorator and is_supported checks for features
  • Extend BleRespBuilder and _route_response to identify and route unsupported protobuf errors
  • Update tests and mocks to cover new unsupported-CoHN behavior
  • Bump third-party dependency versions and enable debug logging for response parsing

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
demos/python/sdk_wireless_camera_control/thirdPartyDependencies.csv Bump packaging to 25.0 and protobuf to 6.31.0
demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py Add unsupported protobuf operation test; update imports
demos/python/sdk_wireless_camera_control/tests/unit/test_responses.py Add and adjust tests for unsupported protobuf responses
demos/python/sdk_wireless_camera_control/tests/unit/test_ble_commands.py Import new ErrorCode and FeatureId for BLE command tests
demos/python/sdk_wireless_camera_control/tests/mocks.py Extend mocks for protobuf and remove legacy BLE send override
demos/python/sdk_wireless_camera_control/open_gopro/util/logger.py Enable DEBUG logging for open_gopro.parsers.response
demos/python/sdk_wireless_camera_control/open_gopro/parsers/response.py Add validResponseProtobufIds and handle missing action IDs
demos/python/sdk_wireless_camera_control/open_gopro/models/types.py Introduce ProtobufId and update ResponseType
demos/python/sdk_wireless_camera_control/open_gopro/models/constants/constants.py Remove deprecated PROTOBUF_QUERY enum
demos/python/sdk_wireless_camera_control/open_gopro/gopro_wireless.py Enhance _route_response to match unsupported protobuf errors
demos/python/sdk_wireless_camera_control/open_gopro/features/base_feature.py Implement require_supported decorator and is_supported abstract property
demos/python/sdk_wireless_camera_control/open_gopro/features/cohn_feature.py Add support tracking and guard methods with require_supported
demos/python/sdk_wireless_camera_control/open_gopro/features/streaming/stream_feature.py Add is_supported property
demos/python/sdk_wireless_camera_control/open_gopro/features/access_point_feature.py Add is_supported property
demos/python/sdk_wireless_camera_control/open_gopro/api/builders.py Update BleProtoCommand to use ProtobufId
demos/python/sdk_wireless_camera_control/open_gopro/api/ble_commands.py Update protobuf commands to use ProtobufId in additional_matching_ids
Comments suppressed due to low confidence (8)

demos/python/sdk_wireless_camera_control/open_gopro/parsers/response.py:41

  • [nitpick] Constant names should follow naming conventions (e.g., UPPER_SNAKE_CASE) or snake_case; consider renaming 'validResponseProtobufIds' to 'VALID_RESPONSE_PROTOBUF_IDS' or 'valid_response_protobuf_ids'.
validResponseProtobufIds: Final[list[tuple[FeatureId, ActionId]]] = [

demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py:10

  • The import 'test' is unused or refers to a non-existent module; remove it to avoid import errors.
import test

demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py:166

  • GoProResp is not imported in this test file, leading to a NameError; add 'from open_gopro.models import GoProResp' at the top.
mock_response = GoProResp(

demos/python/sdk_wireless_camera_control/tests/unit/test_wireless_gopro.py:168

  • ErrorCode is not imported in this test file; add 'from open_gopro.models.constants.constants import ErrorCode'.
status=ErrorCode.INVALID_PARAM,

demos/python/sdk_wireless_camera_control/tests/unit/test_responses.py:36

  • GoProUUID is not imported in this test, causing a NameError; add 'from open_gopro.models.constants import GoProUUID'.
identifier = BleRespBuilder.identify_response(GoProUUID.CQ_QUERY_RESP, response)

demos/python/sdk_wireless_camera_control/tests/unit/test_responses.py:55

  • ErrorCode is not imported in this test file; add 'from open_gopro.models.constants.constants import ErrorCode'.
assert r.status == ErrorCode.INVALID_PARAM

demos/python/sdk_wireless_camera_control/tests/mocks.py:7

  • [nitpick] The import 'Error' from csv is unused and can be removed to clean up unused imports.
from csv import Error

demos/python/sdk_wireless_camera_control/tests/mocks.py:9

  • [nitpick] The import 'is_' from operator is unused and can be removed to clean up unused imports.
from operator import is_

@tcamise-gpsw
Copy link
Copy Markdown
Collaborator Author

need to do a final round of e2e testing for both H11 and H13

@tcamise-gpsw tcamise-gpsw merged commit 470888d into main May 30, 2025
9 checks passed
@tcamise-gpsw tcamise-gpsw deleted the cohn_feature_backwards_compatible branch May 30, 2025 17:59
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.

Python SDK fails to open BLE on cameras that don't support COHN

2 participants