diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 1a1ac6d6d5d78e..c78946354d0e9a 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -7287,10 +7287,15 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { int16u y2 = 3; } + struct DPTZStruct { + int16u videoStreamID = 0; + ViewportStruct viewport = 1; + } + readonly attribute optional MPTZStruct MPTZPosition = 0; readonly attribute optional int8u maxPresets = 1; readonly attribute optional MPTZPresetStruct MPTZPresets[] = 2; - readonly attribute optional int16u DPTZRelativeMove[] = 3; + readonly attribute optional DPTZStruct DPTZStreams[] = 3; readonly attribute optional int8u zoomMax = 4; readonly attribute optional int16s tiltMin = 5; readonly attribute optional int16s tiltMax = 6; @@ -7341,7 +7346,7 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { /** This command SHALL set the values for the pan, tilt, and zoom in the mechanical PTZ. */ command MPTZSetPosition(MPTZSetPositionRequest): DefaultSuccess = 0; - /** This command SHALL move the device by the delta values relative to the currently defined position. */ + /** This command SHALL move the camera by the delta values relative to the currently defined position. */ command MPTZRelativeMove(MPTZRelativeMoveRequest): DefaultSuccess = 1; /** This command SHALL move the camera to the positions specified by the Preset passed. */ command MPTZMoveToPreset(MPTZMoveToPresetRequest): DefaultSuccess = 2; @@ -7351,7 +7356,7 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { command MPTZRemovePreset(MPTZRemovePresetRequest): DefaultSuccess = 4; /** This command allows for setting the digital viewport for a specific Video Stream. */ command DPTZSetViewport(DPTZSetViewportRequest): DefaultSuccess = 5; - /** This command SHALL change the viewports location by the amount specified in a relative fashion. */ + /** This command SHALL change the per stream viewport by the amount specified in a relative fashion. */ command DPTZRelativeMove(DPTZRelativeMoveRequest): DefaultSuccess = 6; } @@ -9699,7 +9704,7 @@ endpoint 1 { callback attribute MPTZPosition; ram attribute maxPresets default = 5; callback attribute MPTZPresets; - callback attribute DPTZRelativeMove; + callback attribute DPTZStreams; ram attribute zoomMax default = 100; ram attribute tiltMin default = -90; ram attribute tiltMax default = 90; diff --git a/examples/all-clusters-app/all-clusters-common/include/camera-av-settings-user-level-management-instance.h b/examples/all-clusters-app/all-clusters-common/include/camera-av-settings-user-level-management-instance.h index 8132a8c829cd78..ea17e8d698585c 100644 --- a/examples/all-clusters-app/all-clusters-common/include/camera-av-settings-user-level-management-instance.h +++ b/examples/all-clusters-app/all-clusters-common/include/camera-av-settings-user-level-management-instance.h @@ -33,12 +33,15 @@ class AVSettingsUserLevelManagementDelegate : public Delegate ~AVSettingsUserLevelManagementDelegate() = default; bool CanChangeMPTZ() override; - bool IsValidVideoStreamID(uint16_t videoStreamID) override; CHIP_ERROR LoadMPTZPresets(std::vector & mptzPresetHelpers) override; - CHIP_ERROR LoadDPTZRelativeMove(std::vector dptzRelativeMove) override; + CHIP_ERROR LoadDPTZStreams(std::vector dptzStream) override; CHIP_ERROR PersistentAttributesLoadedCallback() override; + virtual void VideoStreamAllocated(uint16_t aStreamID) override; + virtual void VideoStreamDeallocated(uint16_t aStreamID) override; + virtual void DefaultViewportUpdated(Structs::ViewportStruct::Type aViewport) override; + /** * delegate command handlers */ @@ -52,7 +55,8 @@ class AVSettingsUserLevelManagementDelegate : public Delegate Protocols::InteractionModel::Status MPTZRemovePreset(uint8_t aPreset) override; Protocols::InteractionModel::Status DPTZSetViewport(uint16_t aVideoStreamID, Structs::ViewportStruct::Type aViewport) override; Protocols::InteractionModel::Status DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, - Optional aDeltaY, Optional aZoomDelta) override; + Optional aDeltaY, Optional aZoomDelta, + Structs::ViewportStruct::Type & aViewport) override; }; void Shutdown(); diff --git a/examples/all-clusters-app/all-clusters-common/src/camera-av-settings-user-level-management-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/camera-av-settings-user-level-management-stub.cpp index 2523e6fe032805..335e987c299d3f 100644 --- a/examples/all-clusters-app/all-clusters-common/src/camera-av-settings-user-level-management-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/camera-av-settings-user-level-management-stub.cpp @@ -46,12 +46,26 @@ bool AVSettingsUserLevelManagementDelegate::CanChangeMPTZ() return true; } -bool AVSettingsUserLevelManagementDelegate::IsValidVideoStreamID(uint16_t aVideoStreamID) +void AVSettingsUserLevelManagementDelegate::VideoStreamAllocated(uint16_t aStreamID) { - // The server needs to verify that the provided Video Stream ID is valid and known and subject to digital modification - // The camera app needs to also have an instance of AV Stream Management, querying that to determine validity of the provided - // id. - return true; + // The app needs to invoke this whenever the AV Stream Manager allocates a video stream; this informs the server of the + // id that is now subject to DPTZ, and the default viewport of the device + Structs::ViewportStruct::Type viewport = { 0, 0, 1920, 1080 }; + this->GetServer()->AddMoveCapableVideoStream(aStreamID, viewport); +} + +void AVSettingsUserLevelManagementDelegate::VideoStreamDeallocated(uint16_t aStreamID) +{ + // The app needs to invoke this whenever the AV Stream Manager deallocates a video stream; this informs the server of the + // deallocated id that is now not subject to DPTZ + this->GetServer()->RemoveMoveCapableVideoStream(aStreamID); +} + +void AVSettingsUserLevelManagementDelegate::DefaultViewportUpdated(Structs::ViewportStruct::Type aViewport) +{ + // The app needs to invoke this whenever the AV Stream Manager updates the device level default Viewport. This informs + // the server of the new viewport that shall be appled to all known streams. + this->GetServer()->UpdateMoveCapableVideoStreams(aViewport); } Status AVSettingsUserLevelManagementDelegate::MPTZSetPosition(Optional aPan, Optional aTilt, @@ -109,12 +123,17 @@ Status AVSettingsUserLevelManagementDelegate::DPTZSetViewport(uint16_t aVideoStr } Status AVSettingsUserLevelManagementDelegate::DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, - Optional aDeltaY, Optional aZoomDelta) + Optional aDeltaY, Optional aZoomDelta, + Structs::ViewportStruct::Type & aViewport) { // The Cluster implementation has ensured that the videoStreamID represents a valid stream. - // The application needs to interact with its instance of AVStreamManagement to access the stream, validate the viewport - // and set the new values for the viewpoort based on the pixel movement requested + // The application needs to interact with its instance of AVStreamManagement to access the stream, validate + // new dimensions after application of the deltas, and set the new values for the viewport based on the pixel movement + // requested + // The passed in viewport is empty, and needs to be populated by the delegate with the value of the viewport after + // applying all deltas within the constraints of the sensor. // + aViewport = { 0, 0, 1920, 1080 }; return Status::Success; } @@ -124,9 +143,9 @@ CHIP_ERROR AVSettingsUserLevelManagementDelegate::LoadMPTZPresets(std::vector dptzRelativeMove) +CHIP_ERROR AVSettingsUserLevelManagementDelegate::LoadDPTZStreams(std::vector dptzStreams) { - dptzRelativeMove.clear(); + dptzStreams.clear(); return CHIP_NO_ERROR; } @@ -156,7 +175,7 @@ void emberAfCameraAvSettingsUserLevelManagementClusterInitCallback(chip::Endpoin CameraAvSettingsUserLevelManagement::OptionalAttributes::kMptzPosition, CameraAvSettingsUserLevelManagement::OptionalAttributes::kMaxPresets, CameraAvSettingsUserLevelManagement::OptionalAttributes::kMptzPresets, - CameraAvSettingsUserLevelManagement::OptionalAttributes::kDptzRelativeMove, + CameraAvSettingsUserLevelManagement::OptionalAttributes::kDptzStreams, CameraAvSettingsUserLevelManagement::OptionalAttributes::kZoomMax, CameraAvSettingsUserLevelManagement::OptionalAttributes::kTiltMin, CameraAvSettingsUserLevelManagement::OptionalAttributes::kTiltMax, diff --git a/examples/camera-app/camera-common/camera-app.matter b/examples/camera-app/camera-common/camera-app.matter index 580e455c0d50ef..ab983b8c9a062f 100644 --- a/examples/camera-app/camera-common/camera-app.matter +++ b/examples/camera-app/camera-common/camera-app.matter @@ -2385,10 +2385,15 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { int16u y2 = 3; } + struct DPTZStruct { + int16u videoStreamID = 0; + ViewportStruct viewport = 1; + } + readonly attribute optional MPTZStruct MPTZPosition = 0; readonly attribute optional int8u maxPresets = 1; readonly attribute optional MPTZPresetStruct MPTZPresets[] = 2; - readonly attribute optional int16u DPTZRelativeMove[] = 3; + readonly attribute optional DPTZStruct DPTZStreams[] = 3; readonly attribute optional int8u zoomMax = 4; readonly attribute optional int16s tiltMin = 5; readonly attribute optional int16s tiltMax = 6; @@ -2439,7 +2444,7 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { /** This command SHALL set the values for the pan, tilt, and zoom in the mechanical PTZ. */ command MPTZSetPosition(MPTZSetPositionRequest): DefaultSuccess = 0; - /** This command SHALL move the device by the delta values relative to the currently defined position. */ + /** This command SHALL move the camera by the delta values relative to the currently defined position. */ command MPTZRelativeMove(MPTZRelativeMoveRequest): DefaultSuccess = 1; /** This command SHALL move the camera to the positions specified by the Preset passed. */ command MPTZMoveToPreset(MPTZMoveToPresetRequest): DefaultSuccess = 2; @@ -2449,7 +2454,7 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { command MPTZRemovePreset(MPTZRemovePresetRequest): DefaultSuccess = 4; /** This command allows for setting the digital viewport for a specific Video Stream. */ command DPTZSetViewport(DPTZSetViewportRequest): DefaultSuccess = 5; - /** This command SHALL change the viewports location by the amount specified in a relative fashion. */ + /** This command SHALL change the per stream viewport by the amount specified in a relative fashion. */ command DPTZRelativeMove(DPTZRelativeMoveRequest): DefaultSuccess = 6; } @@ -3206,7 +3211,7 @@ endpoint 1 { callback attribute MPTZPosition; ram attribute maxPresets default = 5; callback attribute MPTZPresets; - callback attribute DPTZRelativeMove; + callback attribute DPTZStreams; ram attribute zoomMax default = 100; ram attribute tiltMin default = -90; ram attribute tiltMax default = 90; diff --git a/examples/camera-app/camera-common/src/camera-app.cpp b/examples/camera-app/camera-common/src/camera-app.cpp index 14c5939b42d38a..0ea1f044b3480e 100644 --- a/examples/camera-app/camera-common/src/camera-app.cpp +++ b/examples/camera-app/camera-common/src/camera-app.cpp @@ -95,7 +95,7 @@ CameraApp::CameraApp(chip::EndpointId aClustersEndpoint, CameraDeviceInterface * CameraAvSettingsUserLevelManagement::OptionalAttributes::kMptzPosition, CameraAvSettingsUserLevelManagement::OptionalAttributes::kMaxPresets, CameraAvSettingsUserLevelManagement::OptionalAttributes::kMptzPresets, - CameraAvSettingsUserLevelManagement::OptionalAttributes::kDptzRelativeMove, + CameraAvSettingsUserLevelManagement::OptionalAttributes::kDptzStreams, CameraAvSettingsUserLevelManagement::OptionalAttributes::kZoomMax, CameraAvSettingsUserLevelManagement::OptionalAttributes::kTiltMin, CameraAvSettingsUserLevelManagement::OptionalAttributes::kTiltMax, diff --git a/examples/camera-app/linux/include/camera-device.h b/examples/camera-app/linux/include/camera-device.h index ef456082cdff81..efedef5d4c2631 100644 --- a/examples/camera-app/linux/include/camera-device.h +++ b/examples/camera-app/linux/include/camera-device.h @@ -237,7 +237,7 @@ class CameraDevice : public CameraDeviceInterface, public CameraDeviceInterface: int16_t mTilt = chip::app::Clusters::CameraAvSettingsUserLevelManagement::kDefaultTilt; uint8_t mZoom = chip::app::Clusters::CameraAvSettingsUserLevelManagement::kDefaultZoom; // Use a standard 1080p aspect ratio - chip::app::Clusters::CameraAvStreamManagement::ViewportStruct mViewport = { 320, 585, 2240, 1665 }; + chip::app::Clusters::CameraAvStreamManagement::ViewportStruct mViewport = { 0, 0, 1920, 1080 }; uint16_t mCurrentVideoFrameRate = 0; bool mHDREnabled = false; bool mMicrophoneMuted = false; diff --git a/examples/camera-app/linux/include/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.h b/examples/camera-app/linux/include/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.h index 616af44dcec6c6..43307514634f50 100644 --- a/examples/camera-app/linux/include/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.h +++ b/examples/camera-app/linux/include/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.h @@ -37,10 +37,9 @@ class CameraAVSettingsUserLevelManager : public Delegate ~CameraAVSettingsUserLevelManager() = default; bool CanChangeMPTZ() override; - bool IsValidVideoStreamID(uint16_t videoStreamID) override; CHIP_ERROR LoadMPTZPresets(std::vector & mptzPresetHelpers) override; - CHIP_ERROR LoadDPTZRelativeMove(std::vector dptzRelativeMove) override; + CHIP_ERROR LoadDPTZStreams(std::vector dptzStreams) override; CHIP_ERROR PersistentAttributesLoadedCallback() override; /** @@ -56,12 +55,20 @@ class CameraAVSettingsUserLevelManager : public Delegate Protocols::InteractionModel::Status MPTZRemovePreset(uint8_t aPreset) override; Protocols::InteractionModel::Status DPTZSetViewport(uint16_t aVideoStreamID, Structs::ViewportStruct::Type aViewport) override; Protocols::InteractionModel::Status DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, - Optional aDeltaY, Optional aZoomDelta) override; + Optional aDeltaY, Optional aZoomDelta, + Structs::ViewportStruct::Type & aViewport) override; - void SetCameraDeviceHAL(CameraDeviceInterface::CameraHALInterface * aCameraDevice); + void SetCameraDeviceHAL(CameraDeviceInterface * aCameraDevice); + + /** + * DPTZ Stream Indication + */ + void VideoStreamAllocated(uint16_t aStreamID) override; + void VideoStreamDeallocated(uint16_t aStreamID) override; + void DefaultViewportUpdated(Structs::ViewportStruct::Type aViewport) override; private: - CameraDeviceInterface::CameraHALInterface * mCameraDeviceHAL = nullptr; + CameraDeviceInterface * mCameraDeviceHAL = nullptr; }; } // namespace CameraAvSettingsUserLevelManagement diff --git a/examples/camera-app/linux/include/clusters/camera-avstream-mgmt/camera-av-stream-manager.h b/examples/camera-app/linux/include/clusters/camera-avstream-mgmt/camera-av-stream-manager.h index 56bbaefd6c14f9..b030e9a01f7aad 100644 --- a/examples/camera-app/linux/include/clusters/camera-avstream-mgmt/camera-av-stream-manager.h +++ b/examples/camera-app/linux/include/clusters/camera-avstream-mgmt/camera-av-stream-manager.h @@ -78,10 +78,10 @@ class CameraAVStreamManager : public CameraAVStreamMgmtDelegate CameraAVStreamManager() = default; ~CameraAVStreamManager() = default; - void SetCameraDeviceHAL(CameraDeviceInterface::CameraHALInterface * aCameraDevice); + void SetCameraDeviceHAL(CameraDeviceInterface * aCameraDevice); private: - CameraDeviceInterface::CameraHALInterface * mCameraDeviceHAL = nullptr; + CameraDeviceInterface * mCameraDeviceHAL = nullptr; }; } // namespace CameraAvStreamManagement diff --git a/examples/camera-app/linux/src/camera-device.cpp b/examples/camera-app/linux/src/camera-device.cpp index 1061455d474bda..92c52ca05cf06b 100644 --- a/examples/camera-app/linux/src/camera-device.cpp +++ b/examples/camera-app/linux/src/camera-device.cpp @@ -65,8 +65,6 @@ CameraDevice::CameraDevice() // Provider manager uses the Media controller to register WebRTC Transport with media controller for AV source data mWebRTCProviderManager.SetMediaController(&mMediaController); - - mCameraAVSettingsUserLevelManager.SetCameraDeviceHAL(this); } CameraDevice::~CameraDevice() diff --git a/examples/camera-app/linux/src/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.cpp b/examples/camera-app/linux/src/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.cpp index 88fc735fdf6728..787b21e1fcfa1b 100644 --- a/examples/camera-app/linux/src/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.cpp +++ b/examples/camera-app/linux/src/clusters/camera-avsettingsuserlevel-mgmt/camera-avsettingsuserlevel-manager.cpp @@ -28,7 +28,7 @@ using namespace chip::app::Clusters::CameraAvSettingsUserLevelManagement; using chip::Protocols::InteractionModel::Status; -void CameraAVSettingsUserLevelManager::SetCameraDeviceHAL(CameraDeviceInterface::CameraHALInterface * aCameraDeviceHAL) +void CameraAVSettingsUserLevelManager::SetCameraDeviceHAL(CameraDeviceInterface * aCameraDeviceHAL) { mCameraDeviceHAL = aCameraDeviceHAL; } @@ -40,20 +40,20 @@ bool CameraAVSettingsUserLevelManager::CanChangeMPTZ() return true; } -bool CameraAVSettingsUserLevelManager::IsValidVideoStreamID(uint16_t aVideoStreamID) +void CameraAVSettingsUserLevelManager::VideoStreamAllocated(uint16_t aStreamID) { - // The server needs to verify that the provided Video Stream ID is valid and known and subject to digital modification - // The camera app needs to also have an instance of AV Stream Management, querying that to determine validity of the provided - // id. - for (VideoStream & stream : mCameraDeviceHAL->GetAvailableVideoStreams()) - { - if (stream.videoStreamParams.videoStreamID == aVideoStreamID && stream.isAllocated) - { - return true; - } - } + ViewportStruct viewport = mCameraDeviceHAL->GetCameraHALInterface().GetViewport(); + this->GetServer()->AddMoveCapableVideoStream(aStreamID, viewport); +} - return false; +void CameraAVSettingsUserLevelManager::VideoStreamDeallocated(uint16_t aStreamID) +{ + this->GetServer()->RemoveMoveCapableVideoStream(aStreamID); +} + +void CameraAVSettingsUserLevelManager::DefaultViewportUpdated(Structs::ViewportStruct::Type aViewport) +{ + this->GetServer()->UpdateMoveCapableVideoStreams(aViewport); } Status CameraAVSettingsUserLevelManager::MPTZSetPosition(Optional aPan, Optional aTilt, Optional aZoom) @@ -64,17 +64,17 @@ Status CameraAVSettingsUserLevelManager::MPTZSetPosition(Optional aPan, // if (aPan.HasValue()) { - mCameraDeviceHAL->SetPan(aPan.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetPan(aPan.Value()); } if (aTilt.HasValue()) { - mCameraDeviceHAL->SetTilt(aTilt.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetTilt(aTilt.Value()); } if (aZoom.HasValue()) { - mCameraDeviceHAL->SetZoom(aZoom.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetZoom(aZoom.Value()); } return Status::Success; @@ -88,17 +88,17 @@ Status CameraAVSettingsUserLevelManager::MPTZRelativeMove(Optional aPan // if (aPan.HasValue()) { - mCameraDeviceHAL->SetPan(aPan.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetPan(aPan.Value()); } if (aTilt.HasValue()) { - mCameraDeviceHAL->SetTilt(aTilt.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetTilt(aTilt.Value()); } if (aZoom.HasValue()) { - mCameraDeviceHAL->SetZoom(aZoom.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetZoom(aZoom.Value()); } return Status::Success; @@ -112,17 +112,17 @@ Status CameraAVSettingsUserLevelManager::MPTZMoveToPreset(uint8_t aPreset, Optio // if (aPan.HasValue()) { - mCameraDeviceHAL->SetPan(aPan.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetPan(aPan.Value()); } if (aTilt.HasValue()) { - mCameraDeviceHAL->SetTilt(aTilt.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetTilt(aTilt.Value()); } if (aZoom.HasValue()) { - mCameraDeviceHAL->SetZoom(aZoom.Value()); + mCameraDeviceHAL->GetCameraHALInterface().SetZoom(aZoom.Value()); } return Status::Success; @@ -147,10 +147,10 @@ Status CameraAVSettingsUserLevelManager::MPTZRemovePreset(uint8_t aPreset) Status CameraAVSettingsUserLevelManager::DPTZSetViewport(uint16_t aVideoStreamID, Structs::ViewportStruct::Type aViewport) { // The Cluster implementation has ensured that the videoStreamID represents a valid stream. - // The application needs to interact with iHAL to access the stream, validate the viewport + // The application needs to interact with HAL to access the stream, validate the viewport // and set the new viewport value. // - for (VideoStream & stream : mCameraDeviceHAL->GetAvailableVideoStreams()) + for (VideoStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableVideoStreams()) { if (stream.videoStreamParams.videoStreamID == aVideoStreamID && stream.isAllocated) { @@ -162,8 +162,8 @@ Status CameraAVSettingsUserLevelManager::DPTZSetViewport(uint16_t aVideoStreamID // uint16_t requestedWidth = aViewport.x2 - aViewport.x1; uint16_t requestedHeight = aViewport.y2 - aViewport.y1; - VideoResolutionStruct minResolution = mCameraDeviceHAL->GetMinViewport(); - VideoSensorParamsStruct sensorParms = mCameraDeviceHAL->GetVideoSensorParams(); + VideoResolutionStruct minResolution = mCameraDeviceHAL->GetCameraHALInterface().GetMinViewport(); + VideoSensorParamsStruct sensorParms = mCameraDeviceHAL->GetCameraHALInterface().GetVideoSensorParams(); if ((requestedWidth < minResolution.width) || (requestedHeight < minResolution.height) || (requestedWidth > sensorParms.sensorWidth) || (requestedHeight > sensorParms.sensorHeight)) { @@ -186,7 +186,7 @@ Status CameraAVSettingsUserLevelManager::DPTZSetViewport(uint16_t aVideoStreamID ChipLogError(Camera, "CameraApp: DPTZSetViewport with mismatching aspect ratio."); return Status::ConstraintError; } - mCameraDeviceHAL->SetViewport(stream, aViewport); + mCameraDeviceHAL->GetCameraHALInterface().SetViewport(stream, aViewport); return Status::Success; } } @@ -196,19 +196,20 @@ Status CameraAVSettingsUserLevelManager::DPTZSetViewport(uint16_t aVideoStreamID } Status CameraAVSettingsUserLevelManager::DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, - Optional aDeltaY, Optional aZoomDelta) + Optional aDeltaY, Optional aZoomDelta, + Structs::ViewportStruct::Type & aViewport) { // The Cluster implementation has ensured that the videoStreamID represents a valid stream. // The application needs to interact with its instance of AVStreamManagement to access the stream, validate the viewport // and set the new values for the viewpoort based on the pixel movement requested // - for (VideoStream & stream : mCameraDeviceHAL->GetAvailableVideoStreams()) + for (VideoStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableVideoStreams()) { if (stream.videoStreamParams.videoStreamID == aVideoStreamID && stream.isAllocated) { ViewportStruct viewport = stream.viewport; - VideoResolutionStruct minResolution = mCameraDeviceHAL->GetMinViewport(); - VideoSensorParamsStruct sensorParms = mCameraDeviceHAL->GetVideoSensorParams(); + VideoResolutionStruct minResolution = mCameraDeviceHAL->GetCameraHALInterface().GetMinViewport(); + VideoSensorParamsStruct sensorParms = mCameraDeviceHAL->GetCameraHALInterface().GetVideoSensorParams(); if (aDeltaX.HasValue()) { @@ -294,7 +295,8 @@ Status CameraAVSettingsUserLevelManager::DPTZRelativeMove(uint16_t aVideoStreamI viewport.x2 = sensorParms.sensorWidth - 1; viewport.y2 = sensorParms.sensorHeight - 1; } - mCameraDeviceHAL->SetViewport(stream, viewport); + mCameraDeviceHAL->GetCameraHALInterface().SetViewport(stream, viewport); + aViewport = viewport; return Status::Success; } } @@ -309,9 +311,9 @@ CHIP_ERROR CameraAVSettingsUserLevelManager::LoadMPTZPresets(std::vector dptzRelativeMove) +CHIP_ERROR CameraAVSettingsUserLevelManager::LoadDPTZStreams(std::vector dptzStreams) { - dptzRelativeMove.clear(); + dptzStreams.clear(); return CHIP_NO_ERROR; } diff --git a/examples/camera-app/linux/src/clusters/camera-avstream-mgmt/camera-av-stream-manager.cpp b/examples/camera-app/linux/src/clusters/camera-avstream-mgmt/camera-av-stream-manager.cpp index e45103089ae1dc..abfaef73f9b2f0 100644 --- a/examples/camera-app/linux/src/clusters/camera-avstream-mgmt/camera-av-stream-manager.cpp +++ b/examples/camera-app/linux/src/clusters/camera-avstream-mgmt/camera-av-stream-manager.cpp @@ -36,7 +36,7 @@ using namespace chip::app::Clusters::CameraAvStreamManagement; using namespace chip::app::Clusters::CameraAvStreamManagement::Attributes; using chip::Protocols::InteractionModel::Status; -void CameraAVStreamManager::SetCameraDeviceHAL(CameraDeviceInterface::CameraHALInterface * aCameraDeviceHAL) +void CameraAVStreamManager::SetCameraDeviceHAL(CameraDeviceInterface * aCameraDeviceHAL) { mCameraDeviceHAL = aCameraDeviceHAL; } @@ -47,7 +47,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::VideoStreamAllocate(c outStreamID = kInvalidStreamID; bool foundAvailableStream = false; - for (VideoStream & stream : mCameraDeviceHAL->GetAvailableVideoStreams()) + for (VideoStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableVideoStreams()) { if (!stream.isAllocated) { @@ -59,7 +59,14 @@ Protocols::InteractionModel::Status CameraAVStreamManager::VideoStreamAllocate(c outStreamID = stream.videoStreamParams.videoStreamID; // Start the video stream from HAL for serving. - mCameraDeviceHAL->StartVideoStream(outStreamID); + mCameraDeviceHAL->GetCameraHALInterface().StartVideoStream(outStreamID); + + // Set the default viewport on the newly allocated stream + mCameraDeviceHAL->GetCameraHALInterface().SetViewport(stream, + mCameraDeviceHAL->GetCameraHALInterface().GetViewport()); + + // Inform DPTZ that there's an allocated stream + mCameraDeviceHAL->GetCameraAVSettingsUserLevelMgmtDelegate().VideoStreamAllocated(outStreamID); return Status::Success; } @@ -78,7 +85,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::VideoStreamModify(con const chip::Optional waterMarkEnabled, const chip::Optional osdEnabled) { - for (VideoStream & stream : mCameraDeviceHAL->GetAvailableVideoStreams()) + for (VideoStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableVideoStreams()) { if (stream.videoStreamParams.videoStreamID == streamID && stream.isAllocated) { @@ -101,15 +108,17 @@ Protocols::InteractionModel::Status CameraAVStreamManager::VideoStreamModify(con Protocols::InteractionModel::Status CameraAVStreamManager::VideoStreamDeallocate(const uint16_t streamID) { - for (VideoStream & stream : mCameraDeviceHAL->GetAvailableVideoStreams()) + for (VideoStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableVideoStreams()) { if (stream.videoStreamParams.videoStreamID == streamID && stream.isAllocated) { // Stop the video stream - mCameraDeviceHAL->StopVideoStream(streamID); + mCameraDeviceHAL->GetCameraHALInterface().StopVideoStream(streamID); stream.isAllocated = false; + mCameraDeviceHAL->GetCameraAVSettingsUserLevelMgmtDelegate().VideoStreamDeallocated(streamID); + break; } } @@ -123,7 +132,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::AudioStreamAllocate(c outStreamID = kInvalidStreamID; bool foundAvailableStream = false; - for (AudioStream & stream : mCameraDeviceHAL->GetAvailableAudioStreams()) + for (AudioStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableAudioStreams()) { if (!stream.isAllocated) { @@ -135,7 +144,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::AudioStreamAllocate(c outStreamID = stream.audioStreamParams.audioStreamID; // Start the audio stream from HAL for serving. - mCameraDeviceHAL->StartAudioStream(outStreamID); + mCameraDeviceHAL->GetCameraHALInterface().StartAudioStream(outStreamID); return Status::Success; } @@ -152,12 +161,12 @@ Protocols::InteractionModel::Status CameraAVStreamManager::AudioStreamAllocate(c Protocols::InteractionModel::Status CameraAVStreamManager::AudioStreamDeallocate(const uint16_t streamID) { - for (AudioStream & stream : mCameraDeviceHAL->GetAvailableAudioStreams()) + for (AudioStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableAudioStreams()) { if (stream.audioStreamParams.audioStreamID == streamID && stream.isAllocated) { // Stop the audio stream - mCameraDeviceHAL->StopAudioStream(streamID); + mCameraDeviceHAL->GetCameraHALInterface().StopAudioStream(streamID); stream.isAllocated = false; break; @@ -173,7 +182,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::SnapshotStreamAllocat outStreamID = kInvalidStreamID; bool foundAvailableStream = false; - for (SnapshotStream & stream : mCameraDeviceHAL->GetAvailableSnapshotStreams()) + for (SnapshotStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableSnapshotStreams()) { if (!stream.isAllocated) { @@ -185,7 +194,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::SnapshotStreamAllocat outStreamID = stream.snapshotStreamParams.snapshotStreamID; // Start the snapshot stream for serving. - mCameraDeviceHAL->StartSnapshotStream(outStreamID); + mCameraDeviceHAL->GetCameraHALInterface().StartSnapshotStream(outStreamID); return Status::Success; } @@ -204,7 +213,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::SnapshotStreamModify( const chip::Optional waterMarkEnabled, const chip::Optional osdEnabled) { - for (SnapshotStream & stream : mCameraDeviceHAL->GetAvailableSnapshotStreams()) + for (SnapshotStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableSnapshotStreams()) { if (stream.snapshotStreamParams.snapshotStreamID == streamID && stream.isAllocated) { @@ -227,12 +236,12 @@ Protocols::InteractionModel::Status CameraAVStreamManager::SnapshotStreamModify( Protocols::InteractionModel::Status CameraAVStreamManager::SnapshotStreamDeallocate(const uint16_t streamID) { - for (SnapshotStream & stream : mCameraDeviceHAL->GetAvailableSnapshotStreams()) + for (SnapshotStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableSnapshotStreams()) { if (stream.snapshotStreamParams.snapshotStreamID == streamID && stream.isAllocated) { // Stop the snapshot stream for serving. - mCameraDeviceHAL->StopSnapshotStream(streamID); + mCameraDeviceHAL->GetCameraHALInterface().StopSnapshotStream(streamID); stream.isAllocated = false; break; @@ -255,7 +264,7 @@ void CameraAVStreamManager::OnAttributeChanged(AttributeId attributeId) { case HDRModeEnabled::Id: { - mCameraDeviceHAL->SetHDRMode(GetCameraAVStreamMgmtServer()->GetHDRModeEnabled()); + mCameraDeviceHAL->GetCameraHALInterface().SetHDRMode(GetCameraAVStreamMgmtServer()->GetHDRModeEnabled()); break; } case SoftRecordingPrivacyModeEnabled::Id: { @@ -271,23 +280,34 @@ void CameraAVStreamManager::OnAttributeChanged(AttributeId attributeId) break; } case Viewport::Id: { - mCameraDeviceHAL->SetViewport(GetCameraAVStreamMgmtServer()->GetViewport()); + // Update the device default + mCameraDeviceHAL->GetCameraHALInterface().SetViewport(GetCameraAVStreamMgmtServer()->GetViewport()); + + // Update the per stream viewports on the camera + for (VideoStream & stream : mCameraDeviceHAL->GetCameraHALInterface().GetAvailableVideoStreams()) + { + mCameraDeviceHAL->GetCameraHALInterface().SetViewport(stream, GetCameraAVStreamMgmtServer()->GetViewport()); + } + + // Inform DPTZ (the server) that the camera default viewport has changed + mCameraDeviceHAL->GetCameraAVSettingsUserLevelMgmtDelegate().DefaultViewportUpdated( + GetCameraAVStreamMgmtServer()->GetViewport()); break; } case SpeakerMuted::Id: { - mCameraDeviceHAL->SetSpeakerMuted(GetCameraAVStreamMgmtServer()->GetSpeakerMuted()); + mCameraDeviceHAL->GetCameraHALInterface().SetSpeakerMuted(GetCameraAVStreamMgmtServer()->GetSpeakerMuted()); break; } case SpeakerVolumeLevel::Id: { - mCameraDeviceHAL->SetSpeakerVolume(GetCameraAVStreamMgmtServer()->GetSpeakerVolumeLevel()); + mCameraDeviceHAL->GetCameraHALInterface().SetSpeakerVolume(GetCameraAVStreamMgmtServer()->GetSpeakerVolumeLevel()); break; } case MicrophoneMuted::Id: { - mCameraDeviceHAL->SetMicrophoneMuted(GetCameraAVStreamMgmtServer()->GetMicrophoneMuted()); + mCameraDeviceHAL->GetCameraHALInterface().SetMicrophoneMuted(GetCameraAVStreamMgmtServer()->GetMicrophoneMuted()); break; } case MicrophoneVolumeLevel::Id: { - mCameraDeviceHAL->SetMicrophoneVolume(GetCameraAVStreamMgmtServer()->GetMicrophoneVolumeLevel()); + mCameraDeviceHAL->GetCameraHALInterface().SetMicrophoneVolume(GetCameraAVStreamMgmtServer()->GetMicrophoneVolumeLevel()); break; } default: @@ -299,7 +319,7 @@ Protocols::InteractionModel::Status CameraAVStreamManager::CaptureSnapshot(const const VideoResolutionStruct & resolution, ImageSnapshot & outImageSnapshot) { - if (mCameraDeviceHAL->CaptureSnapshot(streamID, resolution, outImageSnapshot) == CameraError::SUCCESS) + if (mCameraDeviceHAL->GetCameraHALInterface().CaptureSnapshot(streamID, resolution, outImageSnapshot) == CameraError::SUCCESS) { return Status::Success; } diff --git a/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.cpp b/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.cpp index 57be9482520926..05d35ae5c1041b 100644 --- a/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.cpp +++ b/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.cpp @@ -100,12 +100,12 @@ CHIP_ERROR CameraAvSettingsUserLevelMgmtServer::Init() mEndpointId)); } - if (SupportsOptAttr(OptionalAttributes::kDptzRelativeMove)) + if (SupportsOptAttr(OptionalAttributes::kDptzStreams)) { VerifyOrReturnError(HasFeature(Feature::kDigitalPTZ), CHIP_ERROR_INVALID_ARGUMENT, ChipLogError(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]: Feature configuration error. If " - "DPTZRelativeMove is enabled, then DigitalPTZ feature is required", + "DPTZStreams is enabled, then DigitalPTZ feature is required", mEndpointId)); } @@ -373,27 +373,57 @@ void CameraAvSettingsUserLevelMgmtServer::SetZoom(Optional aZoom) /** * Methods handling known video stream IDs, the addition and removal thereof. */ -void CameraAvSettingsUserLevelMgmtServer::AddMoveCapableVideoStreamID(uint16_t aVideoStreamID) +void CameraAvSettingsUserLevelMgmtServer::AddMoveCapableVideoStream(uint16_t aVideoStreamID, ViewportStruct::Type aViewport) { - mDptzRelativeMove.push_back(aVideoStreamID); - MarkDirty(Attributes::DPTZRelativeMove::Id); + DPTZStruct dptzEntry; + dptzEntry.videoStreamID = aVideoStreamID; + dptzEntry.viewport = aViewport; + mDptzStreams.push_back(dptzEntry); + MarkDirty(Attributes::DPTZStreams::Id); } -void CameraAvSettingsUserLevelMgmtServer::RemoveMoveCapableVideoStreamID(uint16_t aVideoStreamID) +void CameraAvSettingsUserLevelMgmtServer::UpdateMoveCapableVideoStream(uint16_t aVideoStreamID, ViewportStruct::Type aViewport) +{ + auto it = std::find_if(mDptzStreams.begin(), mDptzStreams.end(), + [aVideoStreamID](const DPTZStruct & dptzs) { return dptzs.videoStreamID == aVideoStreamID; }); + + if (it == mDptzStreams.end()) + { + ChipLogError(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]. No matching video stream ID, update not possible. ID=%d.", + mEndpointId, aVideoStreamID); + return; + } + + it->viewport = aViewport; + MarkDirty(Attributes::DPTZStreams::Id); +} + +void CameraAvSettingsUserLevelMgmtServer::UpdateMoveCapableVideoStreams(ViewportStruct::Type aViewport) +{ + for (auto & dptzStream : mDptzStreams) + { + dptzStream.viewport = aViewport; + } + + MarkDirty(Attributes::DPTZStreams::Id); +} + +void CameraAvSettingsUserLevelMgmtServer::RemoveMoveCapableVideoStream(uint16_t aVideoStreamID) { // Verify that this is a known ID, if it is, remove from the list // - auto it = std::find(mDptzRelativeMove.begin(), mDptzRelativeMove.end(), aVideoStreamID); + auto it = std::find_if(mDptzStreams.begin(), mDptzStreams.end(), + [aVideoStreamID](const DPTZStruct & dptzs) { return dptzs.videoStreamID == aVideoStreamID; }); - if (it == mDptzRelativeMove.end()) + if (it == mDptzStreams.end()) { ChipLogError(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]. No matching video stream ID, removal not possible. ID=%d.", mEndpointId, aVideoStreamID); return; } - mDptzRelativeMove.erase(it); - MarkDirty(Attributes::DPTZRelativeMove::Id); + mDptzStreams.erase(it); + MarkDirty(Attributes::DPTZStreams::Id); } /** @@ -401,9 +431,10 @@ void CameraAvSettingsUserLevelMgmtServer::RemoveMoveCapableVideoStreamID(uint16_ */ bool CameraAvSettingsUserLevelMgmtServer::KnownVideoStreamID(uint16_t aVideoStreamID) { - auto it = std::find(mDptzRelativeMove.begin(), mDptzRelativeMove.end(), aVideoStreamID); + auto it = std::find_if(mDptzStreams.begin(), mDptzStreams.end(), + [aVideoStreamID](const DPTZStruct & dptzs) { return dptzs.videoStreamID == aVideoStreamID; }); - return (it == mDptzRelativeMove.end() ? false : true); + return (it == mDptzStreams.end() ? false : true); } /** @@ -468,12 +499,12 @@ CHIP_ERROR CameraAvSettingsUserLevelMgmtServer::ReadAndEncodeMPTZPresets(Attribu }); } -CHIP_ERROR CameraAvSettingsUserLevelMgmtServer::ReadAndEncodeDPTZRelativeMove(AttributeValueEncoder & aEncoder) +CHIP_ERROR CameraAvSettingsUserLevelMgmtServer::ReadAndEncodeDPTZStreams(AttributeValueEncoder & aEncoder) { return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR { - for (const auto & dptzRelativeMove : mDptzRelativeMove) + for (const auto & dptzStream : mDptzStreams) { - ReturnErrorOnFailure(encoder.Encode(dptzRelativeMove)); + ReturnErrorOnFailure(encoder.Encode(dptzStream)); } return CHIP_NO_ERROR; @@ -504,7 +535,7 @@ void CameraAvSettingsUserLevelMgmtServer::LoadPersistentAttributes() } // Load DPTZRelativeMove - err = mDelegate.LoadDPTZRelativeMove(mDptzRelativeMove); + err = mDelegate.LoadDPTZStreams(mDptzStreams); if (err != CHIP_NO_ERROR) { ChipLogDetail(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]: Unable to load the DPTZRelativeMove from the KVS.", mEndpointId); @@ -551,12 +582,12 @@ CHIP_ERROR CameraAvSettingsUserLevelMgmtServer::Read(const ConcreteReadAttribute mEndpointId)); return ReadAndEncodeMPTZPresets(aEncoder); - case DPTZRelativeMove::Id: + case DPTZStreams::Id: VerifyOrReturnError( HasFeature(Feature::kDigitalPTZ), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute), ChipLogError(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]: can not get DPTZRelativeMove, feature is not supported", mEndpointId)); - return ReadAndEncodeDPTZRelativeMove(aEncoder); + return ReadAndEncodeDPTZStreams(aEncoder); case ZoomMax::Id: VerifyOrReturnError( HasFeature(Feature::kMechanicalZoom), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute), @@ -1192,25 +1223,26 @@ void CameraAvSettingsUserLevelMgmtServer::HandleDPTZSetViewport(HandlerContext & Structs::ViewportStruct::Type viewport = commandData.viewport; // Is this a video stream ID of which we have already been informed? - // If not, ask the delegate if it's ok. If yes, add to our set and proceed, if not, fail. + // If not, fail. // if (!KnownVideoStreamID(videoStreamID)) { - // Call the delegate to validate that the videoStreamID is known; if yes then add to our list and proceed - // - if (!mDelegate.IsValidVideoStreamID(videoStreamID)) - { - ChipLogError(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]: Unknown Video Stream ID provided. ID: %d", mEndpointId, - videoStreamID); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::NotFound); - return; - } - AddMoveCapableVideoStreamID(videoStreamID); + ChipLogError(Zcl, "CameraAVSettingsUserLevelMgmt[ep=%d]: Unknown Video Stream ID provided. ID: %d", mEndpointId, + videoStreamID); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::NotFound); + return; } // Call the delegate Status status = mDelegate.DPTZSetViewport(videoStreamID, viewport); + if (status == Status::Success) + { + // Update the viewport of our stream in DPTZStreams + // + UpdateMoveCapableVideoStream(videoStreamID, viewport); + } + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); } @@ -1247,8 +1279,14 @@ void CameraAvSettingsUserLevelMgmtServer::HandleDPTZRelativeMove(HandlerContext return; } - // Call the delegate - Status status = mDelegate.DPTZRelativeMove(videoStreamID, deltaX, deltaY, zoomDelta); + // Create a viewport and call the delegate; on success update our Stream Viewport with that which was set + ViewportStruct::Type viewport; + Status status = mDelegate.DPTZRelativeMove(videoStreamID, deltaX, deltaY, zoomDelta, viewport); + + if (status == Status::Success) + { + UpdateMoveCapableVideoStream(videoStreamID, viewport); + } ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); } diff --git a/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.h b/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.h index 7ac6009c78d246..7385d12292bf0c 100644 --- a/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.h +++ b/src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.h @@ -34,6 +34,7 @@ namespace CameraAvSettingsUserLevelManagement { using MPTZStructType = Structs::MPTZStruct::Type; using MPTZPresetStructType = Structs::MPTZPresetStruct::Type; +using DPTZStruct = Structs::DPTZStruct::Type; constexpr int16_t kMinPanValue = -180; constexpr int16_t kMaxPanValue = 180; @@ -54,15 +55,15 @@ class Delegate; enum class OptionalAttributes : uint32_t { - kMptzPosition = 0x0001, - kMaxPresets = 0x0002, - kMptzPresets = 0x0004, - kDptzRelativeMove = 0x0008, - kZoomMax = 0x0010, - kTiltMin = 0x0020, - kTiltMax = 0x0040, - kPanMin = 0x0080, - kPanMax = 0x0100, + kMptzPosition = 0x0001, + kMaxPresets = 0x0002, + kMptzPresets = 0x0004, + kDptzStreams = 0x0008, + kZoomMax = 0x0010, + kTiltMin = 0x0020, + kTiltMax = 0x0040, + kPanMin = 0x0080, + kPanMax = 0x0100, }; struct MPTZPresetHelper @@ -133,7 +134,7 @@ class CameraAvSettingsUserLevelMgmtServer : public AttributeAccessInterface, pub uint8_t GetMaxPresets() const { return mMaxPresets; } - const std::vector GetDptzRelativeMove() const { return mDptzRelativeMove; } + const std::vector GetDptzRelativeMove() const { return mDptzStreams; } uint8_t GetZoomMax() const { return mZoomMax; } @@ -164,18 +165,30 @@ class CameraAvSettingsUserLevelMgmtServer : public AttributeAccessInterface, pub void SetZoom(Optional aZoom); /** - * Allows for a delegate or application to provide the ID of an allocated video stream that is capable of digital movement. - * It is expected that this would be done by a delegate on the conclusion of allocating a video stream via the AV Stream + * Allows for a delegate or application to provide the ID and default Viewport of an allocated video stream that is capable of + * digital movement. This should be invoked by a delegate on the conclusion of allocating a video stream via the AV Stream * Management cluster. */ - void AddMoveCapableVideoStreamID(uint16_t aVideoStreamID); + void AddMoveCapableVideoStream(uint16_t aVideoStreamID, Structs::ViewportStruct::Type aViewport); + + /** + * Allows for a delegate or application to update the viewport of an already allocated video stream. + * This should be invoked whenever a viewport is updated by DPTZSetVewport or DPTZRelativeMove + */ + void UpdateMoveCapableVideoStream(uint16_t aVideoStreamID, Structs::ViewportStruct::Type aViewport); + + /** + * Allows for a delegate or application to update all of the viewports for all of the allocated video streams. + * This should be invoked whenever the device default viewport is updated via a write to Viewport on the + * AV Stream Management Cluster + */ + void UpdateMoveCapableVideoStreams(Structs::ViewportStruct::Type aViewport); /** * Allows for a delegate or application to remove a video stream from the set that is capable of digital movement. - * It is expected that this would be done by a delegate on the conclusion of deallocating a video stream via the AV Stream - * Management cluster. + * This should be invoked by a delegate on the conclusion of deallocating a video stream via the AV Stream Management cluster. */ - void RemoveMoveCapableVideoStreamID(uint16_t aVideoStreamID); + void RemoveMoveCapableVideoStream(uint16_t aVideoStreamID); EndpointId GetEndpointId() { return AttributeAccessInterface::GetEndpointId().Value(); } @@ -201,14 +214,14 @@ class CameraAvSettingsUserLevelMgmtServer : public AttributeAccessInterface, pub uint8_t mZoomMax = kMaxZoomValue; std::vector mMptzPresetHelpers; - std::vector mDptzRelativeMove; + std::vector mDptzStreams; // Attribute handler interface CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; // Helper Read functions for complex attribute types CHIP_ERROR ReadAndEncodeMPTZPresets(AttributeValueEncoder & encoder); - CHIP_ERROR ReadAndEncodeDPTZRelativeMove(AttributeValueEncoder & encoder); + CHIP_ERROR ReadAndEncodeDPTZStreams(AttributeValueEncoder & encoder); CHIP_ERROR StoreMPTZPosition(const MPTZStructType & mptzPosition); CHIP_ERROR LoadMPTZPosition(MPTZStructType & mptzPosition); @@ -260,9 +273,13 @@ class Delegate virtual bool CanChangeMPTZ() = 0; /** - * Allows the delegate to verify that a received video stream ID is valid + * DPTZ Stream handling. Invoked on the delegate by an app, providing to the delegate the id of an + * allocated or deallocated stream, or the viewport when the device level viewport is updated. + * The delegate shall invoke the appropriate MoveCapableVideoStream methods on its instance of the server */ - virtual bool IsValidVideoStreamID(uint16_t aVideoStreamID) = 0; + virtual void VideoStreamAllocated(uint16_t aStreamID) = 0; + virtual void VideoStreamDeallocated(uint16_t aStreamID) = 0; + virtual void DefaultViewportUpdated(Structs::ViewportStruct::Type aViewport) = 0; /** * Delegate command handlers @@ -342,7 +359,8 @@ class Delegate * @param aZoomDelta Relative change of digital zoom */ virtual Protocols::InteractionModel::Status DPTZRelativeMove(uint16_t aVideoStreamID, Optional aDeltaX, - Optional aDeltaY, Optional aZoomDelta) = 0; + Optional aDeltaY, Optional aZoomDelta, + Structs::ViewportStruct::Type & aViewport) = 0; /** * @brief Callback into the delegate once persistent attributes managed by @@ -358,7 +376,7 @@ class Delegate * server list, at initialization. */ virtual CHIP_ERROR LoadMPTZPresets(std::vector & mptzPresetHelpers) = 0; - virtual CHIP_ERROR LoadDPTZRelativeMove(std::vector dptzRelativeMove) = 0; + virtual CHIP_ERROR LoadDPTZStreams(std::vector dptzStreams) = 0; CameraAvSettingsUserLevelMgmtServer * mServer = nullptr; diff --git a/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp b/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp index 151a98860187d3..abb40eec802033 100644 --- a/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp +++ b/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp @@ -28,7 +28,9 @@ #include #include +#include #include + using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -840,6 +842,31 @@ CHIP_ERROR CameraAVStreamMgmtServer::SetNightVisionIllum(TriStateAutoEnum aNight CHIP_ERROR CameraAVStreamMgmtServer::SetViewport(const ViewportStruct & aViewport) { + // The following validation steps are required + // 1. the new viewport is not larger than the sensor max + // 2. the new viewport is not snaller than the sensor min + // 3. the new viewport has the same aspect ratio as the sensor + // + uint16_t requestedWidth = static_cast(aViewport.x2 - aViewport.x1); + uint16_t requestedHeight = static_cast(aViewport.y2 - aViewport.y1); + if ((requestedWidth < mMinViewPort.width) || (requestedHeight < mMinViewPort.height) || + (requestedWidth > mVideoSensorParams.sensorWidth) || (requestedHeight > mVideoSensorParams.sensorHeight)) + { + ChipLogError(Zcl, "CameraAVStreamMgmt[ep=%d]: SetViewport with invalid viewport dimensions", mEndpointId); + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + // Get the ARs to no more than 2DP. Otherwise you get mismatches e.g. 16:9 ratio calculation for 480p isn't the same as + // 1080p beyond 2DP. + float requestedAR = floorf((static_cast(requestedWidth) / requestedHeight) * 100) / 100; + float deviceAR = floorf((static_cast(mVideoSensorParams.sensorWidth) / mVideoSensorParams.sensorHeight) * 100) / 100; + + // Ensure that the aspect ration of the viewport matches the aspect ratio of the sensor + if (requestedAR != deviceAR) + { + ChipLogError(Zcl, "CameraAVStreamMgmt[ep=%d]: SetViewport with mismatching aspect ratio.", mEndpointId); + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } mViewport = aViewport; StoreViewport(mViewport); diff --git a/src/app/zap-templates/zcl/data-model/chip/camera-av-settings-user-level-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/camera-av-settings-user-level-management-cluster.xml index 9a53bb42181a50..98327a170914fe 100644 --- a/src/app/zap-templates/zcl/data-model/chip/camera-av-settings-user-level-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/camera-av-settings-user-level-management-cluster.xml @@ -18,22 +18,28 @@ limitations under the License. XML generated by Alchemy; DO NOT EDIT. Source: src/app_clusters/CameraAVSettingsUserLevelManagement.adoc Parameters: in-progress -Git: 0.7-summer-2025-1-ge4654a5ef +Git: 0.7-summer-2025-ncr-195-gdc1151679-dirty --> + + + + + + - + - - - + + + @@ -45,8 +51,7 @@ Git: 0.7-summer-2025-1-ge4654a5ef true true - - MPTZPosition + @@ -55,50 +60,42 @@ Git: 0.7-summer-2025-1-ge4654a5ef - - MaxPresets + - - MPTZPresets + - - DPTZRelativeMove + - - ZoomMax + - - TiltMin + - - TiltMax + - - PanMin + - - PanMax + @@ -118,10 +115,10 @@ Git: 0.7-summer-2025-1-ge4654a5ef - This command SHALL move the device by the delta values relative to the currently defined position. - - - + This command SHALL move the camera by the delta values relative to the currently defined position. + + + @@ -133,7 +130,7 @@ Git: 0.7-summer-2025-1-ge4654a5ef This command SHALL move the camera to the positions specified by the Preset passed. - + @@ -141,7 +138,7 @@ Git: 0.7-summer-2025-1-ge4654a5ef This command allows creating a new preset or updating the values of an existing one. - + @@ -150,7 +147,7 @@ Git: 0.7-summer-2025-1-ge4654a5ef This command SHALL remove a preset entry from the PresetMptzTable. - + @@ -166,7 +163,7 @@ Git: 0.7-summer-2025-1-ge4654a5ef - This command SHALL change the viewports location by the amount specified in a relative fashion. + This command SHALL change the per stream viewport by the amount specified in a relative fashion. diff --git a/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml index e166774c337cb4..a4f58973d6b7e6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml @@ -18,7 +18,7 @@ limitations under the License. XML generated by Alchemy; DO NOT EDIT. Source: src/app_clusters/CameraAVStreamManagement.adoc Parameters: in-progress -Git: 0.7-summer-2025-ncr-195-gdc1151679 +Git: 0.7-summer-2025-ncr-195-gdc1151679-dirty --> diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 73e89ed3e81e8f..d6cbb5c75ff9f4 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -9961,10 +9961,15 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { int16u y2 = 3; } + struct DPTZStruct { + int16u videoStreamID = 0; + ViewportStruct viewport = 1; + } + readonly attribute optional MPTZStruct MPTZPosition = 0; readonly attribute optional int8u maxPresets = 1; readonly attribute optional MPTZPresetStruct MPTZPresets[] = 2; - readonly attribute optional int16u DPTZRelativeMove[] = 3; + readonly attribute optional DPTZStruct DPTZStreams[] = 3; readonly attribute optional int8u zoomMax = 4; readonly attribute optional int16s tiltMin = 5; readonly attribute optional int16s tiltMax = 6; @@ -10015,7 +10020,7 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { /** This command SHALL set the values for the pan, tilt, and zoom in the mechanical PTZ. */ command MPTZSetPosition(MPTZSetPositionRequest): DefaultSuccess = 0; - /** This command SHALL move the device by the delta values relative to the currently defined position. */ + /** This command SHALL move the camera by the delta values relative to the currently defined position. */ command MPTZRelativeMove(MPTZRelativeMoveRequest): DefaultSuccess = 1; /** This command SHALL move the camera to the positions specified by the Preset passed. */ command MPTZMoveToPreset(MPTZMoveToPresetRequest): DefaultSuccess = 2; @@ -10025,7 +10030,7 @@ provisional cluster CameraAvSettingsUserLevelManagement = 1362 { command MPTZRemovePreset(MPTZRemovePresetRequest): DefaultSuccess = 4; /** This command allows for setting the digital viewport for a specific Video Stream. */ command DPTZSetViewport(DPTZSetViewportRequest): DefaultSuccess = 5; - /** This command SHALL change the viewports location by the amount specified in a relative fashion. */ + /** This command SHALL change the per stream viewport by the amount specified in a relative fashion. */ command DPTZRelativeMove(DPTZRelativeMoveRequest): DefaultSuccess = 6; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index ff20c1e0accb10..a1c6043fffb932 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -59015,7 +59015,7 @@ public static class CameraAvSettingsUserLevelManagementCluster extends BaseChipC private static final long MPTZ_POSITION_ATTRIBUTE_ID = 0L; private static final long MAX_PRESETS_ATTRIBUTE_ID = 1L; private static final long MPTZ_PRESETS_ATTRIBUTE_ID = 2L; - private static final long DPTZ_RELATIVE_MOVE_ATTRIBUTE_ID = 3L; + private static final long DPTZ_STREAMS_ATTRIBUTE_ID = 3L; private static final long ZOOM_MAX_ATTRIBUTE_ID = 4L; private static final long TILT_MIN_ATTRIBUTE_ID = 5L; private static final long TILT_MAX_ATTRIBUTE_ID = 6L; @@ -59221,8 +59221,8 @@ public interface MPTZPresetsAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public interface DPTZRelativeMoveAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public interface DPTZStreamsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -59315,30 +59315,30 @@ public void onSuccess(byte[] tlv) { }, MPTZ_PRESETS_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readDPTZRelativeMoveAttribute( - DPTZRelativeMoveAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DPTZ_RELATIVE_MOVE_ATTRIBUTE_ID); + public void readDPTZStreamsAttribute( + DPTZStreamsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DPTZ_STREAMS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DPTZ_RELATIVE_MOVE_ATTRIBUTE_ID, true); + }, DPTZ_STREAMS_ATTRIBUTE_ID, true); } - public void subscribeDPTZRelativeMoveAttribute( - DPTZRelativeMoveAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DPTZ_RELATIVE_MOVE_ATTRIBUTE_ID); + public void subscribeDPTZStreamsAttribute( + DPTZStreamsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DPTZ_STREAMS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DPTZ_RELATIVE_MOVE_ATTRIBUTE_ID, minInterval, maxInterval); + }, DPTZ_STREAMS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readZoomMaxAttribute( diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 315702e3f6a8ea..34db8a3d942fb5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -14859,6 +14859,67 @@ public String toString() { return output.toString(); } } +public static class CameraAvSettingsUserLevelManagementClusterDPTZStruct { + public Integer videoStreamID; + public ChipStructs.CameraAvSettingsUserLevelManagementClusterViewportStruct viewport; + private static final long VIDEO_STREAM_ID_ID = 0L; + private static final long VIEWPORT_ID = 1L; + + public CameraAvSettingsUserLevelManagementClusterDPTZStruct( + Integer videoStreamID, + ChipStructs.CameraAvSettingsUserLevelManagementClusterViewportStruct viewport + ) { + this.videoStreamID = videoStreamID; + this.viewport = viewport; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(VIDEO_STREAM_ID_ID, new UIntType(videoStreamID))); + values.add(new StructElement(VIEWPORT_ID, viewport.encodeTlv())); + + return new StructType(values); + } + + public static CameraAvSettingsUserLevelManagementClusterDPTZStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer videoStreamID = null; + ChipStructs.CameraAvSettingsUserLevelManagementClusterViewportStruct viewport = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == VIDEO_STREAM_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + videoStreamID = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == VIEWPORT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + viewport = ChipStructs.CameraAvSettingsUserLevelManagementClusterViewportStruct.decodeTlv(castingValue); + } + } + } + return new CameraAvSettingsUserLevelManagementClusterDPTZStruct( + videoStreamID, + viewport + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("CameraAvSettingsUserLevelManagementClusterDPTZStruct {\n"); + output.append("\tvideoStreamID: "); + output.append(videoStreamID); + output.append("\n"); + output.append("\tviewport: "); + output.append(viewport); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class WebRTCTransportProviderClusterICEServerStruct { public ArrayList urls; public Optional username; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index aecb69182e79ca..d6df155b525fb2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -17785,7 +17785,7 @@ public enum Attribute { MPTZPosition(0L), MaxPresets(1L), MPTZPresets(2L), - DPTZRelativeMove(3L), + DPTZStreams(3L), ZoomMax(4L), TiltMin(5L), TiltMax(6L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index c0e7f0f0155d0d..123c39402e31da 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -18522,7 +18522,7 @@ public void onError(Exception ex) { } } - public static class DelegatedCameraAvSettingsUserLevelManagementClusterDPTZRelativeMoveAttributeCallback implements ChipClusters.CameraAvSettingsUserLevelManagementCluster.DPTZRelativeMoveAttributeCallback, DelegatedClusterCallback { + public static class DelegatedCameraAvSettingsUserLevelManagementClusterDPTZStreamsAttributeCallback implements ChipClusters.CameraAvSettingsUserLevelManagementCluster.DPTZStreamsAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -18530,9 +18530,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index f051c0bbe100f6..bcbf2dd7b0d7f8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -17755,17 +17755,17 @@ private static Map readCameraAvSettingsUserLevelManagem readCameraAvSettingsUserLevelManagementMPTZPresetsCommandParams ); result.put("readMPTZPresetsAttribute", readCameraAvSettingsUserLevelManagementMPTZPresetsAttributeInteractionInfo); - Map readCameraAvSettingsUserLevelManagementDPTZRelativeMoveCommandParams = new LinkedHashMap(); - InteractionInfo readCameraAvSettingsUserLevelManagementDPTZRelativeMoveAttributeInteractionInfo = new InteractionInfo( + Map readCameraAvSettingsUserLevelManagementDPTZStreamsCommandParams = new LinkedHashMap(); + InteractionInfo readCameraAvSettingsUserLevelManagementDPTZStreamsAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvSettingsUserLevelManagementCluster) cluster).readDPTZRelativeMoveAttribute( - (ChipClusters.CameraAvSettingsUserLevelManagementCluster.DPTZRelativeMoveAttributeCallback) callback + ((ChipClusters.CameraAvSettingsUserLevelManagementCluster) cluster).readDPTZStreamsAttribute( + (ChipClusters.CameraAvSettingsUserLevelManagementCluster.DPTZStreamsAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedCameraAvSettingsUserLevelManagementClusterDPTZRelativeMoveAttributeCallback(), - readCameraAvSettingsUserLevelManagementDPTZRelativeMoveCommandParams + () -> new ClusterInfoMapping.DelegatedCameraAvSettingsUserLevelManagementClusterDPTZStreamsAttributeCallback(), + readCameraAvSettingsUserLevelManagementDPTZStreamsCommandParams ); - result.put("readDPTZRelativeMoveAttribute", readCameraAvSettingsUserLevelManagementDPTZRelativeMoveAttributeInteractionInfo); + result.put("readDPTZStreamsAttribute", readCameraAvSettingsUserLevelManagementDPTZStreamsAttributeInteractionInfo); Map readCameraAvSettingsUserLevelManagementZoomMaxCommandParams = new LinkedHashMap(); InteractionInfo readCameraAvSettingsUserLevelManagementZoomMaxAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 5930db47691a45..1e228f14fd37bc 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -19,6 +19,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterProductAppearanceStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BindingClusterTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BridgedDeviceBasicInformationClusterProductAppearanceStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterMPTZPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterMPTZStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterViewportStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt new file mode 100644 index 00000000000000..f8f1f1b5d5fb4e --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class CameraAvSettingsUserLevelManagementClusterDPTZStruct( + val videoStreamID: UInt, + val viewport: CameraAvSettingsUserLevelManagementClusterViewportStruct, +) { + override fun toString(): String = buildString { + append("CameraAvSettingsUserLevelManagementClusterDPTZStruct {\n") + append("\tvideoStreamID : $videoStreamID\n") + append("\tviewport : $viewport\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_VIDEO_STREAM_ID), videoStreamID) + viewport.toTlv(ContextSpecificTag(TAG_VIEWPORT), this) + endStructure() + } + } + + companion object { + private const val TAG_VIDEO_STREAM_ID = 0 + private const val TAG_VIEWPORT = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): CameraAvSettingsUserLevelManagementClusterDPTZStruct { + tlvReader.enterStructure(tlvTag) + val videoStreamID = tlvReader.getUInt(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + val viewport = + CameraAvSettingsUserLevelManagementClusterViewportStruct.fromTlv( + ContextSpecificTag(TAG_VIEWPORT), + tlvReader, + ) + + tlvReader.exitContainer() + + return CameraAvSettingsUserLevelManagementClusterDPTZStruct(videoStreamID, viewport) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvSettingsUserLevelManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvSettingsUserLevelManagementCluster.kt index 96bcd6426cf475..5718b27366bbc2 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvSettingsUserLevelManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvSettingsUserLevelManagementCluster.kt @@ -70,14 +70,17 @@ class CameraAvSettingsUserLevelManagementCluster( object SubscriptionEstablished : MPTZPresetsAttributeSubscriptionState() } - class DPTZRelativeMoveAttribute(val value: List?) + class DPTZStreamsAttribute( + val value: List? + ) - sealed class DPTZRelativeMoveAttributeSubscriptionState { - data class Success(val value: List?) : DPTZRelativeMoveAttributeSubscriptionState() + sealed class DPTZStreamsAttributeSubscriptionState { + data class Success(val value: List?) : + DPTZStreamsAttributeSubscriptionState() - data class Error(val exception: Exception) : DPTZRelativeMoveAttributeSubscriptionState() + data class Error(val exception: Exception) : DPTZStreamsAttributeSubscriptionState() - object SubscriptionEstablished : DPTZRelativeMoveAttributeSubscriptionState() + object SubscriptionEstablished : DPTZStreamsAttributeSubscriptionState() } class GeneratedCommandListAttribute(val value: List) @@ -599,7 +602,7 @@ class CameraAvSettingsUserLevelManagementCluster( } } - suspend fun readDPTZRelativeMoveAttribute(): DPTZRelativeMoveAttribute { + suspend fun readDPTZStreamsAttribute(): DPTZStreamsAttribute { val ATTRIBUTE_ID: UInt = 3u val attributePath = @@ -621,16 +624,18 @@ class CameraAvSettingsUserLevelManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Dptzrelativemove attribute not found in response" } + requireNotNull(attributeData) { "Dptzstreams attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List? = + val decodedValue: List? = if (tlvReader.isNextTag(AnonymousTag)) { - buildList { + buildList { tlvReader.enterArray(AnonymousTag) while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUShort(AnonymousTag)) + add( + CameraAvSettingsUserLevelManagementClusterDPTZStruct.fromTlv(AnonymousTag, tlvReader) + ) } tlvReader.exitContainer() } @@ -638,13 +643,13 @@ class CameraAvSettingsUserLevelManagementCluster( null } - return DPTZRelativeMoveAttribute(decodedValue) + return DPTZStreamsAttribute(decodedValue) } - suspend fun subscribeDPTZRelativeMoveAttribute( + suspend fun subscribeDPTZStreamsAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 3u val attributePaths = listOf( @@ -663,7 +668,7 @@ class CameraAvSettingsUserLevelManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - DPTZRelativeMoveAttributeSubscriptionState.Error( + DPTZStreamsAttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -676,18 +681,21 @@ class CameraAvSettingsUserLevelManagementCluster( .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { - "Dptzrelativemove attribute not found in Node State update" - } + requireNotNull(attributeData) { "Dptzstreams attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List? = + val decodedValue: List? = if (tlvReader.isNextTag(AnonymousTag)) { - buildList { + buildList { tlvReader.enterArray(AnonymousTag) while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUShort(AnonymousTag)) + add( + CameraAvSettingsUserLevelManagementClusterDPTZStruct.fromTlv( + AnonymousTag, + tlvReader, + ) + ) } tlvReader.exitContainer() } @@ -695,10 +703,10 @@ class CameraAvSettingsUserLevelManagementCluster( null } - decodedValue?.let { emit(DPTZRelativeMoveAttributeSubscriptionState.Success(it)) } + decodedValue?.let { emit(DPTZStreamsAttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(DPTZRelativeMoveAttributeSubscriptionState.SubscriptionEstablished) + emit(DPTZStreamsAttributeSubscriptionState.SubscriptionEstablished) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index f8b0de9573984c..9e81e8f68b0d0e 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -19,6 +19,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/BasicInformationClusterProductAppearanceStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/BindingClusterTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/BridgedDeviceBasicInformationClusterProductAppearanceStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterMPTZPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterMPTZStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterViewportStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt new file mode 100644 index 00000000000000..12414afe5eda42 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/CameraAvSettingsUserLevelManagementClusterDPTZStruct.kt @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class CameraAvSettingsUserLevelManagementClusterDPTZStruct( + val videoStreamID: UShort, + val viewport: CameraAvSettingsUserLevelManagementClusterViewportStruct, +) { + override fun toString(): String = buildString { + append("CameraAvSettingsUserLevelManagementClusterDPTZStruct {\n") + append("\tvideoStreamID : $videoStreamID\n") + append("\tviewport : $viewport\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_VIDEO_STREAM_ID), videoStreamID) + viewport.toTlv(ContextSpecificTag(TAG_VIEWPORT), this) + endStructure() + } + } + + companion object { + private const val TAG_VIDEO_STREAM_ID = 0 + private const val TAG_VIEWPORT = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): CameraAvSettingsUserLevelManagementClusterDPTZStruct { + tlvReader.enterStructure(tlvTag) + val videoStreamID = tlvReader.getUShort(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + val viewport = + CameraAvSettingsUserLevelManagementClusterViewportStruct.fromTlv( + ContextSpecificTag(TAG_VIEWPORT), + tlvReader, + ) + + tlvReader.exitContainer() + + return CameraAvSettingsUserLevelManagementClusterDPTZStruct(videoStreamID, viewport) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index cf054beaa6ede2..db155a971c5f29 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -42652,8 +42652,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::DPTZRelativeMove::Id: { - using TypeInfo = Attributes::DPTZRelativeMove::TypeInfo; + case Attributes::DPTZStreams::Id: { + using TypeInfo = Attributes::DPTZStreams::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -42668,11 +42668,99 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR { auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; - std::string newElement_0ClassName = "java/lang/Integer"; - std::string newElement_0CtorSignature = "(I)V"; - jint jninewElement_0 = static_cast(entry_0); + jobject newElement_0_videoStreamID; + std::string newElement_0_videoStreamIDClassName = "java/lang/Integer"; + std::string newElement_0_videoStreamIDCtorSignature = "(I)V"; + jint jninewElement_0_videoStreamID = static_cast(entry_0.videoStreamID); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + newElement_0_videoStreamIDClassName.c_str(), newElement_0_videoStreamIDCtorSignature.c_str(), + jninewElement_0_videoStreamID, newElement_0_videoStreamID); + jobject newElement_0_viewport; + jobject newElement_0_viewport_x1; + std::string newElement_0_viewport_x1ClassName = "java/lang/Integer"; + std::string newElement_0_viewport_x1CtorSignature = "(I)V"; + jint jninewElement_0_viewport_x1 = static_cast(entry_0.viewport.x1); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_viewport_x1ClassName.c_str(), + newElement_0_viewport_x1CtorSignature.c_str(), + jninewElement_0_viewport_x1, newElement_0_viewport_x1); + jobject newElement_0_viewport_y1; + std::string newElement_0_viewport_y1ClassName = "java/lang/Integer"; + std::string newElement_0_viewport_y1CtorSignature = "(I)V"; + jint jninewElement_0_viewport_y1 = static_cast(entry_0.viewport.y1); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_viewport_y1ClassName.c_str(), + newElement_0_viewport_y1CtorSignature.c_str(), + jninewElement_0_viewport_y1, newElement_0_viewport_y1); + jobject newElement_0_viewport_x2; + std::string newElement_0_viewport_x2ClassName = "java/lang/Integer"; + std::string newElement_0_viewport_x2CtorSignature = "(I)V"; + jint jninewElement_0_viewport_x2 = static_cast(entry_0.viewport.x2); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_viewport_x2ClassName.c_str(), + newElement_0_viewport_x2CtorSignature.c_str(), + jninewElement_0_viewport_x2, newElement_0_viewport_x2); + jobject newElement_0_viewport_y2; + std::string newElement_0_viewport_y2ClassName = "java/lang/Integer"; + std::string newElement_0_viewport_y2CtorSignature = "(I)V"; + jint jninewElement_0_viewport_y2 = static_cast(entry_0.viewport.y2); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_viewport_y2ClassName.c_str(), + newElement_0_viewport_y2CtorSignature.c_str(), + jninewElement_0_viewport_y2, newElement_0_viewport_y2); + + { + jclass viewportStructStructClass_2; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$CameraAvSettingsUserLevelManagementClusterViewportStruct", + viewportStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$CameraAvSettingsUserLevelManagementClusterViewportStruct"); + return nullptr; + } + + jmethodID viewportStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod( + env, viewportStructStructClass_2, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", + &viewportStructStructCtor_2); + if (err != CHIP_NO_ERROR || viewportStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$CameraAvSettingsUserLevelManagementClusterViewportStruct constructor"); + return nullptr; + } + + newElement_0_viewport = + env->NewObject(viewportStructStructClass_2, viewportStructStructCtor_2, newElement_0_viewport_x1, + newElement_0_viewport_y1, newElement_0_viewport_x2, newElement_0_viewport_y2); + } + + { + jclass DPTZStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$CameraAvSettingsUserLevelManagementClusterDPTZStruct", + DPTZStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$CameraAvSettingsUserLevelManagementClusterDPTZStruct"); + return nullptr; + } + + jmethodID DPTZStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, DPTZStructStructClass_1, "", + "(Ljava/lang/Integer;Lchip/devicecontroller/" + "ChipStructs$CameraAvSettingsUserLevelManagementClusterViewportStruct;)V", + &DPTZStructStructCtor_1); + if (err != CHIP_NO_ERROR || DPTZStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$CameraAvSettingsUserLevelManagementClusterDPTZStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(DPTZStructStructClass_1, DPTZStructStructCtor_1, newElement_0_videoStreamID, + newElement_0_viewport); + } chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 6721795901449d..ae24d22d73a8af 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -13116,9 +13116,9 @@ class ChipClusters: "reportable": True, }, 0x00000003: { - "attributeName": "DPTZRelativeMove", + "attributeName": "DPTZStreams", "attributeId": 0x00000003, - "type": "int", + "type": "", "reportable": True, }, 0x00000004: { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 5a4b1ed5def1c0..60012b7489e40e 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -47265,7 +47265,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="MPTZPosition", Tag=0x00000000, Type=typing.Optional[CameraAvSettingsUserLevelManagement.Structs.MPTZStruct]), ClusterObjectFieldDescriptor(Label="maxPresets", Tag=0x00000001, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="MPTZPresets", Tag=0x00000002, Type=typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.MPTZPresetStruct]]), - ClusterObjectFieldDescriptor(Label="DPTZRelativeMove", Tag=0x00000003, Type=typing.Optional[typing.List[uint]]), + ClusterObjectFieldDescriptor(Label="DPTZStreams", Tag=0x00000003, Type=typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.DPTZStruct]]), ClusterObjectFieldDescriptor(Label="zoomMax", Tag=0x00000004, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="tiltMin", Tag=0x00000005, Type=typing.Optional[int]), ClusterObjectFieldDescriptor(Label="tiltMax", Tag=0x00000006, Type=typing.Optional[int]), @@ -47281,7 +47281,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: MPTZPosition: typing.Optional[CameraAvSettingsUserLevelManagement.Structs.MPTZStruct] = None maxPresets: typing.Optional[uint] = None MPTZPresets: typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.MPTZPresetStruct]] = None - DPTZRelativeMove: typing.Optional[typing.List[uint]] = None + DPTZStreams: typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.DPTZStruct]] = None zoomMax: typing.Optional[uint] = None tiltMin: typing.Optional[int] = None tiltMax: typing.Optional[int] = None @@ -47349,6 +47349,19 @@ def descriptor(cls) -> ClusterObjectDescriptor: x2: 'uint' = 0 y2: 'uint' = 0 + @dataclass + class DPTZStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="videoStreamID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="viewport", Tag=1, Type=CameraAvSettingsUserLevelManagement.Structs.ViewportStruct), + ]) + + videoStreamID: 'uint' = 0 + viewport: 'CameraAvSettingsUserLevelManagement.Structs.ViewportStruct' = field(default_factory=lambda: CameraAvSettingsUserLevelManagement.Structs.ViewportStruct()) + class Commands: @dataclass class MPTZSetPosition(ClusterCommand): @@ -47530,7 +47543,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.MPTZPresetStruct]] = None @dataclass - class DPTZRelativeMove(ClusterAttributeDescriptor): + class DPTZStreams(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000552 @@ -47541,9 +47554,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[uint]]) + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.DPTZStruct]]) - value: typing.Optional[typing.List[uint]] = None + value: typing.Optional[typing.List[CameraAvSettingsUserLevelManagement.Structs.DPTZStruct]] = None @dataclass class ZoomMax(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 05ca035ba5057f..cf6ecaa68e96e3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -6009,7 +6009,7 @@ static BOOL AttributeIsSpecifiedInCameraAVSettingsUserLevelManagementCluster(Att case Attributes::MPTZPresets::Id: { return YES; } - case Attributes::DPTZRelativeMove::Id: { + case Attributes::DPTZStreams::Id: { return YES; } case Attributes::ZoomMax::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 8fb552c74283a5..960013dd224bd0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -18181,8 +18181,8 @@ static id _Nullable DecodeAttributeValueForCameraAVSettingsUserLevelManagementCl } return value; } - case Attributes::DPTZRelativeMove::Id: { - using TypeInfo = Attributes::DPTZRelativeMove::TypeInfo; + case Attributes::DPTZStreams::Id: { + using TypeInfo = Attributes::DPTZStreams::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -18194,8 +18194,14 @@ static id _Nullable DecodeAttributeValueForCameraAVSettingsUserLevelManagementCl auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + MTRCameraAVSettingsUserLevelManagementClusterDPTZStruct * newElement_0; + newElement_0 = [MTRCameraAVSettingsUserLevelManagementClusterDPTZStruct new]; + newElement_0.videoStreamID = [NSNumber numberWithUnsignedShort:entry_0.videoStreamID]; + newElement_0.viewport = [MTRCameraAVSettingsUserLevelManagementClusterViewportStruct new]; + newElement_0.viewport.x1 = [NSNumber numberWithUnsignedShort:entry_0.viewport.x1]; + newElement_0.viewport.y1 = [NSNumber numberWithUnsignedShort:entry_0.viewport.y1]; + newElement_0.viewport.x2 = [NSNumber numberWithUnsignedShort:entry_0.viewport.x2]; + newElement_0.viewport.y2 = [NSNumber numberWithUnsignedShort:entry_0.viewport.y2]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index c871657d4aa608..feeb9e75a4d994 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -14857,7 +14857,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command MPTZRelativeMove * - * This command SHALL move the device by the delta values relative to the currently defined position. + * This command SHALL move the camera by the delta values relative to the currently defined position. */ - (void)MPTZRelativeMoveWithParams:(MTRCameraAVSettingsUserLevelManagementClusterMPTZRelativeMoveParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)MPTZRelativeMoveWithCompletion:(MTRStatusCompletion)completion @@ -14889,7 +14889,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command DPTZRelativeMove * - * This command SHALL change the viewports location by the amount specified in a relative fashion. + * This command SHALL change the per stream viewport by the amount specified in a relative fashion. */ - (void)DPTZRelativeMoveWithParams:(MTRCameraAVSettingsUserLevelManagementClusterDPTZRelativeMoveParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; @@ -14911,11 +14911,11 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeMPTZPresetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeDPTZRelativeMoveWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeDPTZRelativeMoveWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeDPTZRelativeMoveWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeDPTZStreamsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDPTZStreamsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDPTZStreamsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeZoomMaxWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeZoomMaxWithParams:(MTRSubscribeParams *)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 9d63193e280baa..7cea0f269dd67c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -101835,9 +101835,9 @@ + (void)readAttributeMPTZPresetsWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeDPTZRelativeMoveWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeDPTZStreamsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::TypeInfo; + using TypeInfo = CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101846,11 +101846,11 @@ - (void)readAttributeDPTZRelativeMoveWithCompletion:(void (^)(NSArray * _Nullabl completion:completion]; } -- (void)subscribeAttributeDPTZRelativeMoveWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeDPTZStreamsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::TypeInfo; + using TypeInfo = CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101860,9 +101860,9 @@ - (void)subscribeAttributeDPTZRelativeMoveWithParams:(MTRSubscribeParams * _Nonn subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDPTZRelativeMoveWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeDPTZStreamsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::TypeInfo; + using TypeInfo = CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index e8406cb017c401..68a6ccc3ea910d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -4741,7 +4741,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeMPTZPositionID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeMaxPresetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeMPTZPresetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, - MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeDPTZRelativeMoveID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeDPTZStreamsID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeZoomMaxID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeTiltMinID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeTiltMaxID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 7606b7c6422706..5fe55e2d303a0a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -8273,8 +8273,8 @@ result = @"MPTZPresets"; break; - case MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeDPTZRelativeMoveID: - result = @"DPTZRelativeMove"; + case MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeDPTZStreamsID: + result = @"DPTZStreams"; break; case MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeZoomMaxID: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 98890aeb408d72..d9a01e16e631f5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -6969,7 +6969,7 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributeMPTZPresetsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeDPTZRelativeMoveWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeDPTZStreamsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeZoomMaxWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 5c0b756b568304..05815afb1714ca 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -20136,9 +20136,9 @@ - (void)DPTZRelativeMoveWithParams:(MTRCameraAVSettingsUserLevelManagementCluste return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVSettingsUserLevelManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeMPTZPresetsID) params:params]; } -- (NSDictionary * _Nullable)readAttributeDPTZRelativeMoveWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeDPTZStreamsWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVSettingsUserLevelManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeDPTZRelativeMoveID) params:params]; + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVSettingsUserLevelManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVSettingsUserLevelManagementAttributeDPTZStreamsID) params:params]; } - (NSDictionary * _Nullable)readAttributeZoomMaxWithParams:(MTRReadParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 53742bb416102d..4c679779a25b7d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -2339,6 +2339,12 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull y2 MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRCameraAVSettingsUserLevelManagementClusterDPTZStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull videoStreamID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRCameraAVSettingsUserLevelManagementClusterViewportStruct * _Nonnull viewport MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRWebRTCTransportProviderClusterICEServerStruct : NSObject @property (nonatomic, copy) NSArray * _Nonnull urls MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 24837ce9545eab..303b1ac3da7067 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -9781,6 +9781,36 @@ - (NSString *)description @end +@implementation MTRCameraAVSettingsUserLevelManagementClusterDPTZStruct +- (instancetype)init +{ + if (self = [super init]) { + + _videoStreamID = @(0); + + _viewport = [MTRCameraAVSettingsUserLevelManagementClusterViewportStruct new]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRCameraAVSettingsUserLevelManagementClusterDPTZStruct alloc] init]; + + other.videoStreamID = self.videoStreamID; + other.viewport = self.viewport; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: videoStreamID:%@; viewport:%@; >", NSStringFromClass([self class]), _videoStreamID, _viewport]; + return descriptionString; +} + +@end + @implementation MTRWebRTCTransportProviderClusterICEServerStruct - (instancetype)init { diff --git a/src/python_testing/TC_AVSUM_2_1.py b/src/python_testing/TC_AVSUM_2_1.py index 6f339fef669858..74253e1110bca8 100644 --- a/src/python_testing/TC_AVSUM_2_1.py +++ b/src/python_testing/TC_AVSUM_2_1.py @@ -60,7 +60,7 @@ def steps_TC_AVSUM_2_1(self) -> list[TestStep]: TestStep(8, "Read and verify MPTZPosition attribute."), TestStep(9, "Read and verify MaxPresets attribute, if supported."), TestStep(10, "Read and verify MPTZPresets attribute, if supported."), - TestStep(11, "Read and verify DPTZRelativeMove attribute, if supported"), + TestStep(11, "Read and verify DPTZStreams attribute, if supported"), ] return steps @@ -184,16 +184,16 @@ async def test_TC_AVSUM_2_1(self): if self.has_feature_dptz: self.step(11) - asserts.assert_in(attributes.DPTZRelativeMove.attribute_id, attribute_list, - "DPTZRelativeMove attribute is a mandatory attribute if DPTZ.") + asserts.assert_in(attributes.DPTZStreams.attribute_id, attribute_list, + "DPTZStreams attribute is a mandatory attribute if DPTZ.") - dptz_relative_move_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.DPTZRelativeMove) - if dptz_relative_move_dut is not None: + dptz_streams_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.DPTZStreams) + if dptz_streams_dut is not None: # Verify that all elements in the list are unique - asserts.assert_equal(len(dptz_relative_move_dut), len( - set(dptz_relative_move_dut)), "DPTZRelativeMove has non-unique values") - for videostreamid in dptz_relative_move_dut: - asserts.assert_greater_equal(videostreamid, 0, "Provided video stream id is out of range") + asserts.assert_equal(len(dptz_streams_dut), len( + set(dptz_streams_dut)), "DPTZStreams has non-unique values") + for streams in dptz_streams_dut: + asserts.assert_greater_equal(streams.videostreamid, 0, "Provided video stream id is out of range") else: logging.info("DPTZ Feature not supported. Test step skipped") self.skip_step(11) diff --git a/src/python_testing/TC_AVSUM_2_8.py b/src/python_testing/TC_AVSUM_2_8.py index d6c61df381d6bb..965a8ad9f8a453 100644 --- a/src/python_testing/TC_AVSUM_2_8.py +++ b/src/python_testing/TC_AVSUM_2_8.py @@ -53,12 +53,11 @@ def steps_TC_AVSUM_2_8(self) -> list[TestStep]: TestStep(2, "Send DPTZRelativeMove with an unknown stream ID, but valid Zoom Delta verify NotFound response"), TestStep(3, "Send a VideoStreamAllocate command to AVStreamManagement to allocate a video stream ID. Record the returned ID"), TestStep(4, "Send DPTZRelativeMove with the allocated stream ID, invalid Zoom Delta. Verify ConstraintError response"), - TestStep(5, "Send DPTZRelativeMove with the allocated stream ID, valid Zoom Delta. But a viewport hasn't been set. Verify NotFound response"), - TestStep(6, "Create a viewport with a valid AR. Set this via DPTZSetViewport"), - TestStep(7, "Setup deltaX and deltaY to move beyond the cartesian plan, send via DPTZRelativeMove. Verify success"), - TestStep(8, "Setup deltaX to move the viewport to the right, send via DPTZRelativeMove. Verify success"), - TestStep(9, "Setup deltaY to move the viewport down, send via DPTZRelativeMove. Verify success"), - TestStep(10, "Repeatedly invoke DPTZRelativeMove with a Zoom Delta of 100%, verify no error on max out of sensor size"), + TestStep(5, "Create a viewport with a valid AR. Set this via DPTZSetViewport"), + TestStep(6, "Setup deltaX and deltaY to move beyond the cartesian plan, send via DPTZRelativeMove. Verify success"), + TestStep(7, "Setup deltaX to move the viewport to the right, send via DPTZRelativeMove. Verify success"), + TestStep(8, "Setup deltaY to move the viewport down, send via DPTZRelativeMove. Verify success"), + TestStep(9, "Repeatedly invoke DPTZRelativeMove with a Zoom Delta of 100%, verify no error on max out of sensor size"), ] return steps @@ -95,10 +94,6 @@ async def test_TC_AVSUM_2_8(self): await self.send_dptz_relative_move_command(endpoint, videoStreamID, zoomDelta=101, expected_status=Status.ConstraintError) self.step(5) - # Send a dptzrelativemove for the correct stream, valid ZoomDelta, but we haven't actually set a viewport yet - await self.send_dptz_relative_move_command(endpoint, videoStreamID, zoomDelta=50, expected_status=Status.NotFound) - - self.step(6) # Set a viewport viewport = await self.read_avstr_attribute_expect_success(endpoint, attributesAVSTR.Viewport) sensordimensions = await self.read_avstr_attribute_expect_success(endpoint, attributesAVSTR.VideoSensorParams) @@ -111,21 +106,21 @@ async def test_TC_AVSUM_2_8(self): y2=viewportheight) await self.send_dptz_set_viewport_command(endpoint, videoStreamID, passingviewport) - self.step(7) + self.step(6) # Send a dptzrelativemove based on the set viewport, move to beyond cartesian plane deltaX = -x1 * 2 deltaY = -viewportheight * 2 await self.send_dptz_relative_move_command(endpoint, videoStreamID, deltaX=deltaX, deltaY=deltaY) - self.step(8) + self.step(7) # Send a dptzrelativemove based on the current viewport, move to the right await self.send_dptz_relative_move_command(endpoint, videoStreamID, deltaX=100) - self.step(9) + self.step(8) # Send a dptzrelativemove based on the new viewport, move down await self.send_dptz_relative_move_command(endpoint, videoStreamID, deltaY=100) - self.step(10) + self.step(9) # Send a dptzrelativemove based on the new viewport, zoom to beyond sensor size currentsize = (viewport.x2-viewport.x1) * (viewport.y2-viewport.y1) sensorsize = sensordimensions.sensorWidth * sensordimensions.sensorHeight diff --git a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/AttributeIds.h b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/AttributeIds.h index 9181727b4238e3..8ce41c28e39004 100644 --- a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/AttributeIds.h +++ b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/AttributeIds.h @@ -24,9 +24,9 @@ namespace MPTZPresets { inline constexpr AttributeId Id = 0x00000002; } // namespace MPTZPresets -namespace DPTZRelativeMove { +namespace DPTZStreams { inline constexpr AttributeId Id = 0x00000003; -} // namespace DPTZRelativeMove +} // namespace DPTZStreams namespace ZoomMax { inline constexpr AttributeId Id = 0x00000004; diff --git a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.h b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.h index 8d0f723dad3fff..ddc8bd78c6117e 100644 --- a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.h +++ b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.h @@ -80,18 +80,21 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace MPTZPresets -namespace DPTZRelativeMove { +namespace DPTZStreams { struct TypeInfo { - using Type = chip::app::DataModel::List; - using DecodableType = chip::app::DataModel::DecodableList; - using DecodableArgType = const chip::app::DataModel::DecodableList &; + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::DecodableType> &; static constexpr ClusterId GetClusterId() { return Clusters::CameraAvSettingsUserLevelManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::DPTZRelativeMove::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DPTZStreams::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace DPTZRelativeMove +} // namespace DPTZStreams namespace ZoomMax { struct TypeInfo { @@ -194,7 +197,7 @@ struct TypeInfo Attributes::MPTZPosition::TypeInfo::DecodableType MPTZPosition; Attributes::MaxPresets::TypeInfo::DecodableType maxPresets = static_cast(0); Attributes::MPTZPresets::TypeInfo::DecodableType MPTZPresets; - Attributes::DPTZRelativeMove::TypeInfo::DecodableType DPTZRelativeMove; + Attributes::DPTZStreams::TypeInfo::DecodableType DPTZStreams; Attributes::ZoomMax::TypeInfo::DecodableType zoomMax = static_cast(0); Attributes::TiltMin::TypeInfo::DecodableType tiltMin = static_cast(0); Attributes::TiltMax::TypeInfo::DecodableType tiltMax = static_cast(0); diff --git a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.ipp b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.ipp index 14306d4fd9b5db..83d2298bb6cab6 100644 --- a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.ipp +++ b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Attributes.ipp @@ -36,8 +36,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, maxPresets); case Attributes::MPTZPresets::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, MPTZPresets); - case Attributes::DPTZRelativeMove::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, DPTZRelativeMove); + case Attributes::DPTZStreams::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, DPTZStreams); case Attributes::ZoomMax::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, zoomMax); case Attributes::TiltMin::TypeInfo::GetAttributeId(): diff --git a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Metadata.h b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Metadata.h index cb90408e2f09a1..5ee8f52c9282ba 100644 --- a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Metadata.h +++ b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Metadata.h @@ -32,12 +32,11 @@ inline constexpr DataModel::AttributeEntry kMetadataEntry(MPTZPresets::Id, BitFlags(DataModel::AttributeQualityFlags::kListAttribute), Access::Privilege::kView, std::nullopt); } // namespace MPTZPresets -namespace DPTZRelativeMove { +namespace DPTZStreams { inline constexpr DataModel::AttributeEntry - kMetadataEntry(DPTZRelativeMove::Id, - BitFlags(DataModel::AttributeQualityFlags::kListAttribute), + kMetadataEntry(DPTZStreams::Id, BitFlags(DataModel::AttributeQualityFlags::kListAttribute), Access::Privilege::kView, std::nullopt); -} // namespace DPTZRelativeMove +} // namespace DPTZStreams namespace ZoomMax { inline constexpr DataModel::AttributeEntry kMetadataEntry(ZoomMax::Id, BitFlags(), Access::Privilege::kView, std::nullopt); diff --git a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.h b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.h index 2f73037e56715d..6915a3ba320b16 100644 --- a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.h +++ b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.h @@ -86,6 +86,29 @@ using DecodableType = Type; } // namespace MPTZPresetStruct namespace ViewportStruct = Clusters::detail::Structs::ViewportStruct; +namespace DPTZStruct { +enum class Fields : uint8_t +{ + kVideoStreamID = 0, + kViewport = 1, +}; + +struct Type +{ +public: + uint16_t videoStreamID = static_cast(0); + Structs::ViewportStruct::Type viewport; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace DPTZStruct } // namespace Structs } // namespace CameraAvSettingsUserLevelManagement } // namespace Clusters diff --git a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.ipp b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.ipp index fd92cd82e868c3..00c10937a453dd 100644 --- a/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.ipp +++ b/zzz_generated/app-common/clusters/CameraAvSettingsUserLevelManagement/Structs.ipp @@ -104,6 +104,40 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace MPTZPresetStruct + +namespace DPTZStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kVideoStreamID), videoStreamID); + encoder.Encode(to_underlying(Fields::kViewport), viewport); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kVideoStreamID)) + { + err = DataModel::Decode(reader, videoStreamID); + } + else if (__context_tag == to_underlying(Fields::kViewport)) + { + err = DataModel::Decode(reader, viewport); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace DPTZStruct } // namespace Structs } // namespace CameraAvSettingsUserLevelManagement } // namespace Clusters diff --git a/zzz_generated/app-common/clusters/shared/Structs.h b/zzz_generated/app-common/clusters/shared/Structs.h index 3c5d916b6b692d..f34d977ce213fd 100644 --- a/zzz_generated/app-common/clusters/shared/Structs.h +++ b/zzz_generated/app-common/clusters/shared/Structs.h @@ -169,6 +169,33 @@ struct DecodableType }; } // namespace MeasurementAccuracyStruct +namespace ViewportStruct { +enum class Fields : uint8_t +{ + kX1 = 0, + kY1 = 1, + kX2 = 2, + kY2 = 3, +}; + +struct Type +{ +public: + uint16_t x1 = static_cast(0); + uint16_t y1 = static_cast(0); + uint16_t x2 = static_cast(0); + uint16_t y2 = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace ViewportStruct namespace ApplicationStruct { enum class Fields : uint8_t { @@ -299,33 +326,6 @@ struct Type using DecodableType = Type; } // namespace OperationalStateStruct -namespace ViewportStruct { -enum class Fields : uint8_t -{ - kX1 = 0, - kY1 = 1, - kX2 = 2, - kY2 = 3, -}; - -struct Type -{ -public: - uint16_t x1 = static_cast(0); - uint16_t y1 = static_cast(0); - uint16_t x2 = static_cast(0); - uint16_t y2 = static_cast(0); - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace ViewportStruct namespace WebRTCSessionStruct { enum class Fields : uint8_t { diff --git a/zzz_generated/app-common/clusters/shared/Structs.ipp b/zzz_generated/app-common/clusters/shared/Structs.ipp index 58c3ca6645c410..4bab4aabc6e693 100644 --- a/zzz_generated/app-common/clusters/shared/Structs.ipp +++ b/zzz_generated/app-common/clusters/shared/Structs.ipp @@ -215,6 +215,50 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace MeasurementAccuracyStruct +namespace ViewportStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kX1), x1); + encoder.Encode(to_underlying(Fields::kY1), y1); + encoder.Encode(to_underlying(Fields::kX2), x2); + encoder.Encode(to_underlying(Fields::kY2), y2); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + uint8_t __context_tag = 0; + CHIP_ERROR err = __iterator.Next(__context_tag); + VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); + ReturnErrorOnFailure(err); + + if (__context_tag == to_underlying(Fields::kX1)) + { + err = DataModel::Decode(reader, x1); + } + else if (__context_tag == to_underlying(Fields::kY1)) + { + err = DataModel::Decode(reader, y1); + } + else if (__context_tag == to_underlying(Fields::kX2)) + { + err = DataModel::Decode(reader, x2); + } + else if (__context_tag == to_underlying(Fields::kY2)) + { + err = DataModel::Decode(reader, y2); + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace ViewportStruct + namespace ApplicationStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -400,50 +444,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace OperationalStateStruct -namespace ViewportStruct { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kX1), x1); - encoder.Encode(to_underlying(Fields::kY1), y1); - encoder.Encode(to_underlying(Fields::kX2), x2); - encoder.Encode(to_underlying(Fields::kY2), y2); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - uint8_t __context_tag = 0; - CHIP_ERROR err = __iterator.Next(__context_tag); - VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); - ReturnErrorOnFailure(err); - - if (__context_tag == to_underlying(Fields::kX1)) - { - err = DataModel::Decode(reader, x1); - } - else if (__context_tag == to_underlying(Fields::kY1)) - { - err = DataModel::Decode(reader, y1); - } - else if (__context_tag == to_underlying(Fields::kX2)) - { - err = DataModel::Decode(reader, x2); - } - else if (__context_tag == to_underlying(Fields::kY2)) - { - err = DataModel::Decode(reader, y2); - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace ViewportStruct - namespace WebRTCSessionStruct { CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index c0db84884d3053..f44c5f68376acc 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -14375,7 +14375,7 @@ class CameraAvStreamManagementCaptureSnapshot : public ClusterCommand | * MPTZPosition | 0x0000 | | * MaxPresets | 0x0001 | | * MPTZPresets | 0x0002 | -| * DPTZRelativeMove | 0x0003 | +| * DPTZStreams | 0x0003 | | * ZoomMax | 0x0004 | | * TiltMin | 0x0005 | | * TiltMax | 0x0006 | @@ -29830,7 +29830,7 @@ void registerClusterCameraAvSettingsUserLevelManagement(Commands & commands, Cre make_unique(Id, "mptzposition", Attributes::MPTZPosition::Id, credsIssuerConfig), // make_unique(Id, "max-presets", Attributes::MaxPresets::Id, credsIssuerConfig), // make_unique(Id, "mptzpresets", Attributes::MPTZPresets::Id, credsIssuerConfig), // - make_unique(Id, "dptzrelative-move", Attributes::DPTZRelativeMove::Id, credsIssuerConfig), // + make_unique(Id, "dptzstreams", Attributes::DPTZStreams::Id, credsIssuerConfig), // make_unique(Id, "zoom-max", Attributes::ZoomMax::Id, credsIssuerConfig), // make_unique(Id, "tilt-min", Attributes::TiltMin::Id, credsIssuerConfig), // make_unique(Id, "tilt-max", Attributes::TiltMax::Id, credsIssuerConfig), // @@ -29849,8 +29849,9 @@ void registerClusterCameraAvSettingsUserLevelManagement(Commands & commands, Cre make_unique>>( Id, "mptzpresets", Attributes::MPTZPresets::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( - Id, "dptzrelative-move", Attributes::DPTZRelativeMove::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "dptzstreams", Attributes::DPTZStreams::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "zoom-max", 0, UINT8_MAX, Attributes::ZoomMax::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "tilt-min", INT16_MIN, INT16_MAX, Attributes::TiltMin::Id, @@ -29876,7 +29877,7 @@ void registerClusterCameraAvSettingsUserLevelManagement(Commands & commands, Cre make_unique(Id, "mptzposition", Attributes::MPTZPosition::Id, credsIssuerConfig), // make_unique(Id, "max-presets", Attributes::MaxPresets::Id, credsIssuerConfig), // make_unique(Id, "mptzpresets", Attributes::MPTZPresets::Id, credsIssuerConfig), // - make_unique(Id, "dptzrelative-move", Attributes::DPTZRelativeMove::Id, credsIssuerConfig), // + make_unique(Id, "dptzstreams", Attributes::DPTZStreams::Id, credsIssuerConfig), // make_unique(Id, "zoom-max", Attributes::ZoomMax::Id, credsIssuerConfig), // make_unique(Id, "tilt-min", Attributes::TiltMin::Id, credsIssuerConfig), // make_unique(Id, "tilt-max", Attributes::TiltMax::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 6505debff7d8fe..99893341dae528 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -564,6 +564,47 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Measu ComplexArgumentParser::Finalize(request.accuracyRanges); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ViewportStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.x1", "x1", value.isMember("x1"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.y1", "y1", value.isMember("y1"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.x2", "x2", value.isMember("x2"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.y2", "y2", value.isMember("y2"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "x1"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.x1, value["x1"])); + valueCopy.removeMember("x1"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "y1"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.y1, value["y1"])); + valueCopy.removeMember("y1"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "x2"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.x2, value["x2"])); + valueCopy.removeMember("x2"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "y2"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.y2, value["y2"])); + valueCopy.removeMember("y2"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::ViewportStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.x1); + ComplexArgumentParser::Finalize(request.y1); + ComplexArgumentParser::Finalize(request.x2); + ComplexArgumentParser::Finalize(request.y2); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value) { @@ -745,47 +786,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Opera ComplexArgumentParser::Finalize(request.operationalStateLabel); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ViewportStruct::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.x1", "x1", value.isMember("x1"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.y1", "y1", value.isMember("y1"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.x2", "x2", value.isMember("x2"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ViewportStruct.y2", "y2", value.isMember("y2"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "x1"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.x1, value["x1"])); - valueCopy.removeMember("x1"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "y1"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.y1, value["y1"])); - valueCopy.removeMember("y1"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "x2"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.x2, value["x2"])); - valueCopy.removeMember("x2"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "y2"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.y2, value["y2"])); - valueCopy.removeMember("y2"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::ViewportStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.x1); - ComplexArgumentParser::Finalize(request.y1); - ComplexArgumentParser::Finalize(request.x2); - ComplexArgumentParser::Finalize(request.y2); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::WebRTCSessionStruct::Type & request, Json::Value & value) @@ -6892,6 +6892,38 @@ void ComplexArgumentParser::Finalize( ComplexArgumentParser::Finalize(request.settings); } +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DPTZStruct.videoStreamID", "videoStreamID", value.isMember("videoStreamID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DPTZStruct.viewport", "viewport", value.isMember("viewport"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "videoStreamID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.videoStreamID, value["videoStreamID"])); + valueCopy.removeMember("videoStreamID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "viewport"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.viewport, value["viewport"])); + valueCopy.removeMember("viewport"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.videoStreamID); + ComplexArgumentParser::Finalize(request.viewport); +} + CHIP_ERROR ComplexArgumentParser::Setup( const char * label, chip::app::Clusters::PushAvStreamTransport::Structs::TransportMotionTriggerTimeControlStruct::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index f068a314ff1da8..e243e5b0803fab 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -82,6 +82,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ViewportStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::detail::Structs::ViewportStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value); @@ -106,11 +111,6 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::OperationalStateStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ViewportStruct::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::detail::Structs::ViewportStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::WebRTCSessionStruct::Type & request, Json::Value & value); @@ -778,6 +778,12 @@ static CHIP_ERROR Setup(const char * label, static void Finalize(chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::MPTZPresetStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::PushAvStreamTransport::Structs::TransportMotionTriggerTimeControlStruct::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index a2de6167573d82..a25912b47218d5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -501,6 +501,47 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::ViewportStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("X1", indent + 1, value.x1); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'X1'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Y1", indent + 1, value.y1); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Y1'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("X2", indent + 1, value.x2); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'X2'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Y2", indent + 1, value.y2); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Y2'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value) { @@ -650,47 +691,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::ViewportStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("X1", indent + 1, value.x1); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'X1'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Y1", indent + 1, value.y1); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Y1'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("X2", indent + 1, value.x2); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'X2'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Y2", indent + 1, value.y2); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Y2'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::WebRTCSessionStruct::DecodableType & value) { @@ -6129,6 +6129,32 @@ CHIP_ERROR DataModelLogger::LogValue( return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("VideoStreamID", indent + 1, value.videoStreamID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'VideoStreamID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Viewport", indent + 1, value.viewport); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Viewport'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue( const char * label, size_t indent, const chip::app::Clusters::PushAvStreamTransport::Structs::TransportMotionTriggerTimeControlStruct::DecodableType & value) @@ -20800,10 +20826,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("MPTZPresets", 1, value); } - case CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::Id: { - chip::app::DataModel::DecodableList value; + case CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::DecodableType> + value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("DPTZRelativeMove", 1, value); + return DataModelLogger::LogValue("DPTZStreams", 1, value); } case CameraAvSettingsUserLevelManagement::Attributes::ZoomMax::Id: { uint8_t value; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 4c42e28cbedbce..8ff094a3b36ff6 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -56,6 +56,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::ViewportStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value); @@ -71,9 +74,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::OperationalStateStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::ViewportStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::WebRTCSessionStruct::DecodableType & value); @@ -475,6 +475,10 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::MPTZPresetStruct::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::CameraAvSettingsUserLevelManagement::Structs::DPTZStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::PushAvStreamTransport::Structs::TransportMotionTriggerTimeControlStruct::DecodableType & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index 300a4f26dac115..f7560adbe9bce0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -4396,8 +4396,8 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "MaxPresets"; case chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::MPTZPresets::Id: return "MPTZPresets"; - case chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::Id: - return "DPTZRelativeMove"; + case chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::Id: + return "DPTZStreams"; case chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::ZoomMax::Id: return "ZoomMax"; case chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::TiltMin::Id: diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index eaad1b88ae4f22..195ca82d9879eb 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -157366,7 +157366,7 @@ class SubscribeAttributeCameraAvStreamManagementClusterRevision : public Subscri | * MPTZPosition | 0x0000 | | * MaxPresets | 0x0001 | | * MPTZPresets | 0x0002 | -| * DPTZRelativeMove | 0x0003 | +| * DPTZStreams | 0x0003 | | * ZoomMax | 0x0004 | | * TiltMin | 0x0005 | | * TiltMax | 0x0006 | @@ -158111,34 +158111,34 @@ class SubscribeAttributeCameraAvSettingsUserLevelManagementMPTZPresets : public #if MTR_ENABLE_PROVISIONAL /* - * Attribute DPTZRelativeMove + * Attribute DPTZStreams */ -class ReadCameraAvSettingsUserLevelManagementDPTZRelativeMove : public ReadAttribute { +class ReadCameraAvSettingsUserLevelManagementDPTZStreams : public ReadAttribute { public: - ReadCameraAvSettingsUserLevelManagementDPTZRelativeMove() - : ReadAttribute("dptzrelative-move") + ReadCameraAvSettingsUserLevelManagementDPTZStreams() + : ReadAttribute("dptzstreams") { } - ~ReadCameraAvSettingsUserLevelManagementDPTZRelativeMove() + ~ReadCameraAvSettingsUserLevelManagementDPTZStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvSettingsUserLevelManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVSettingsUserLevelManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeDPTZRelativeMoveWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVSettingsUserLevelManagement.DPTZRelativeMove response %@", [value description]); + [cluster readAttributeDPTZStreamsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CameraAVSettingsUserLevelManagement.DPTZStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("CameraAVSettingsUserLevelManagement DPTZRelativeMove read Error", error); + LogNSError("CameraAVSettingsUserLevelManagement DPTZStreams read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -158147,21 +158147,21 @@ class ReadCameraAvSettingsUserLevelManagementDPTZRelativeMove : public ReadAttri } }; -class SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZRelativeMove : public SubscribeAttribute { +class SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZStreams : public SubscribeAttribute { public: - SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZRelativeMove() - : SubscribeAttribute("dptzrelative-move") + SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZStreams() + : SubscribeAttribute("dptzstreams") { } - ~SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZRelativeMove() + ~SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvSettingsUserLevelManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::DPTZRelativeMove::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvSettingsUserLevelManagement::Attributes::DPTZStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -158176,10 +158176,10 @@ class SubscribeAttributeCameraAvSettingsUserLevelManagementDPTZRelativeMove : pu if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeDPTZRelativeMoveWithParams:params + [cluster subscribeAttributeDPTZStreamsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVSettingsUserLevelManagement.DPTZRelativeMove response %@", [value description]); + NSLog(@"CameraAVSettingsUserLevelManagement.DPTZStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -194795,8 +194795,8 @@ void registerClusterCameraAvSettingsUserLevelManagement(Commands & commands) make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // + make_unique(), // + make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), //