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 61292d2e270288..9ba24161bb9815 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 @@ -509,17 +509,20 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat ReturnErrorOnFailure(aEncoder.Encode(mMicrophoneAGCEnabled)); break; case ImageRotation::Id: - VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttributes::kSupportsImageRotation), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, ChipLogError(Zcl, "CameraAVStreamMgmt: can not get ImageRotation, feature is not supported")); ReturnErrorOnFailure(aEncoder.Encode(mImageRotation)); break; case ImageFlipHorizontal::Id: - VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttributes::kSupportsImageFlipHorizontal), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, ChipLogError(Zcl, "CameraAVStreamMgmt: can not get ImageFlipHorizontal, feature is not supported")); ReturnErrorOnFailure(aEncoder.Encode(mImageFlipHorizontal)); break; case ImageFlipVertical::Id: - VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttributes::kSupportsImageFlipVertical), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, ChipLogError(Zcl, "CameraAVStreamMgmt: can not get ImageFlipHorizontal, feature is not supported")); ReturnErrorOnFailure(aEncoder.Encode(mImageFlipVertical)); break; @@ -569,15 +572,6 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa ReturnErrorOnFailure(SetHDRModeEnabled(hdrModeEnabled)); return CHIP_NO_ERROR; } - case RankedVideoStreamPrioritiesList::Id: { // TODO - VerifyOrReturnError( - HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, - ChipLogError(Zcl, "CameraAVStreamMgmt: can not set RankedVideoStreamPrioritiesList, feature is not supported")); - uint8_t newValue; - ReturnErrorOnFailure(aDecoder.Decode(newValue)); - ReturnErrorOnFailure(mDelegate.SetRankedVideoStreamPrioritiesList(newValue)); - return CHIP_NO_ERROR; - } case SoftRecordingPrivacyModeEnabled::Id: { VerifyOrReturnError( HasFeature(Feature::kPrivacy), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, @@ -621,9 +615,8 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa return CHIP_NO_ERROR; } case Viewport::Id: { - VerifyOrReturnError( - HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, - ChipLogError(Zcl, "CameraAVStreamMgmt: can not set RankedVideoStreamPrioritiesList, feature is not supported")); + VerifyOrReturnError(HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "CameraAVStreamMgmt: can not set Viewport, feature is not supported")); ViewportStruct viewPort; ReturnErrorOnFailure(aDecoder.Decode(viewPort)); ReturnErrorOnFailure(SetViewport(viewPort)); @@ -670,6 +663,33 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa ReturnErrorOnFailure(SetMicrophoneAGCEnabled(micAGCEnabled)); return CHIP_NO_ERROR; } + case ImageRotation::Id: { + VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttributes::kSupportsImageRotation), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "CameraAVStreamMgmt: can not set ImageRotation, feature is not supported")); + uint16_t imageRotation; + ReturnErrorOnFailure(aDecoder.Decode(imageRotation)); + ReturnErrorOnFailure(SetImageRotation(imageRotation)); + return CHIP_NO_ERROR; + } + case ImageFlipHorizontal::Id: { + VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttributes::kSupportsImageFlipHorizontal), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "CameraAVStreamMgmt: can not set ImageFlipHorizontal, feature is not supported")); + bool imageFlipHorizontal; + ReturnErrorOnFailure(aDecoder.Decode(imageFlipHorizontal)); + ReturnErrorOnFailure(SetImageFlipHorizontal(imageFlipHorizontal)); + return CHIP_NO_ERROR; + } + case ImageFlipVertical::Id: { + VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttributes::kSupportsImageFlipVertical), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "CameraAVStreamMgmt: can not set ImageFlipVertical, feature is not supported")); + bool imageFlipVertical; + ReturnErrorOnFailure(aDecoder.Decode(imageFlipVertical)); + ReturnErrorOnFailure(SetImageFlipVertical(imageFlipVertical)); + return CHIP_NO_ERROR; + } case LocalVideoRecordingEnabled::Id: { VerifyOrReturnError( HasFeature(Feature::kVideo) && HasFeature(Feature::kStorage), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, diff --git a/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.h b/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.h index e55de76d68b990..12589d643add43 100644 --- a/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.h +++ b/src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.h @@ -161,9 +161,11 @@ enum class OptionalAttributes : uint32_t kSupportsNightVision = 0x0004, kSupportsNightVisionIllum = 0x0008, kSupportsMicrophoneAGCEnabled = 0x0010, - kSupportsStatusLightEnabled = 0x0020, - kSupportsStatusLightBrightness = 0x0040, - kSupportsDepthSensorStatus = 0x0080, + kSupportsImageRotation = 0x0020, + kSupportsImageFlipHorizontal = 0x0040, + kSupportsImageFlipVertical = 0x0080, + kSupportsStatusLightEnabled = 0x0100, + kSupportsStatusLightBrightness = 0x0200, }; class CameraAVStreamMgmtServer : public CommandHandlerInterface, public AttributeAccessInterface