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 f6b0a098f7dcf2..0ee4b2e52e4b51 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 @@ -1249,6 +1249,9 @@ void CameraAVStreamMgmtServer::LoadPersistentAttributes() ChipLogDetail(Zcl, "CameraAVStreamMgmt: Unable to load the StatusLightBrightness from the KVS. Defaulting to %d", to_underlying(mStatusLightBrightness)); } + + // Signal delegate that all persistent configuration attributes have been loaded. + mDelegate.PersistentAttributesLoadedCallback(); } CHIP_ERROR CameraAVStreamMgmtServer::StoreViewport(const ViewportStruct & viewport) 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 58a525f505abb0..e355d45a14c2cc 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 @@ -116,10 +116,11 @@ class CameraAVStreamMgmtDelegate virtual Protocols::InteractionModel::Status SetStreamPriorities(const DataModel::DecodableList streamPriorities) = 0; - // Get attribute methods for list index items - - virtual uint8_t GetMaxConcurrentVideoEncoders() = 0; - virtual uint32_t GetMaxEncodedPixelRate() = 0; + /** + * @brief Callback into the delegate once persistent attributes managed by + * the Cluster have been loaded from Storage. + */ + virtual Protocols::InteractionModel::Status PersistentAttributesLoadedCallback() = 0; protected: friend class CameraAVStreamMgmtServer; @@ -191,6 +192,7 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut bool IsLocalVideoRecordingEnabled() const; + // Attribute Setters Protocols::InteractionModel::Status SetCurrentFrameRate(uint16_t aCurrentFrameRate); Protocols::InteractionModel::Status SetHDRModeEnabled(bool aHDRModeEnabled); @@ -239,6 +241,212 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut Protocols::InteractionModel::Status SetStatusLightBrightness(Globals::ThreeLevelAutoEnum aStatusLightBrightness); + // Attribute Getters + uint8_t GetMaxConcurrentVideoEncoders() const + { + return mMaxConcurrentVideoEncoders; + } + + uint32_t GetMaxEncodedPixelRate() const + { + return mMaxEncodedPixelRate; + } + + const VideoSensorParamsStruct & GetVideoSensorParams() const + { + return mVideoSensorParams; + } + + bool GetNightVisionCapable() const + { + return mNightVisionCapable; + } + + const VideoResolutionStruct & GetMinViewport() const + { + return mMinViewPort; + } + + const std::vector & GetRateDistortionTradeOffPoints() const + { + return mRateDistortionTradeOffPointsList; + } + + uint32_t GetMaxContentBufferSize() const + { + return mMaxContentBufferSize; + } + + const AudioCapabilitiesStruct & GetMicrophoneCapabilities() const + { + return mMicrophoneCapabilities; + } + + const AudioCapabilitiesStruct & GetSpeakerCapabilities() const + { + return mSpeakerCapabilities; + } + + TwoWayTalkSupportTypeEnum GetTwoWayTalkSupport() const + { + return mTwoWayTalkSupport; + } + + const std::vector & GetSupportedSnapshotParams() const + { + return mSupportedSnapshotParamsList; + } + + uint32_t GetMaxNetworkBandwidth() const + { + return mMaxNetworkBandwidth; + } + + uint16_t GetCurrentFrameRate() const + { + return mCurrentFrameRate; + } + + bool GetHDRModeEnabled() const + { + return mHDRModeEnabled; + } + + const std::unordered_set & GetFabricsUsingCamera() const + { + return mFabricsUsingCamera; + } + + const std::vector & GetAllocatedVideoStreams() const + { + return mAllocatedVideoStreams; + } + + const std::vector & GetAllocatedAudioStreams() const + { + return mAllocatedAudioStreams; + } + + const std::vector & GetAllocatedSnapshotStreams() const + { + return mAllocatedSnapshotStreams; + } + + const StreamTypeEnum * GetRankedVideoStreamPriorities() const + { + return mRankedVideoStreamPriorities; + } + + bool GetSoftRecordingPrivacyModeEnabled() const + { + return mSoftRecordingPrivacyModeEnabled; + } + + bool GetSoftLivestreamPrivacyModeEnabled() const + { + return mSoftLivestreamPrivacyModeEnabled; + } + + bool GetHardPrivacyModeOn() const + { + return mHardPrivacyModeOn; + } + + TriStateAutoEnum GetNightVision() const + { + return mNightVision; + } + + TriStateAutoEnum GetNightVisionIllum() const + { + return mNightVisionIllum; + } + + const ViewportStruct & GetViewport() const + { + return mViewport; + } + + bool GetSpeakerMuted() const + { + return mSpeakerMuted; + } + + uint8_t GetSpeakerVolumeLevel() const + { + return mSpeakerVolumeLevel; + } + + uint8_t GetSpeakerMaxLevel() const + { + return mSpeakerMaxLevel; + } + + uint8_t GetSpeakerMinLevel() const + { + return mSpeakerMinLevel; + } + + bool GetMicrophoneMuted() const + { + return mMicrophoneMuted; + } + + uint8_t GetMicrophoneVolumeLevel() const + { + return mMicrophoneVolumeLevel; + } + + uint8_t GetMicrophoneMaxLevel() const + { + return mMicrophoneMaxLevel; + } + + uint8_t GetMicrophoneMinLevel() const + { + return mMicrophoneMinLevel; + } + + bool IsMicrophoneAGCEnabled() const + { + return mMicrophoneAGCEnabled; + } + + uint16_t GetImageRotation() const + { + return mImageRotation; + } + + bool GetImageFlipHorizontal() const + { + return mImageFlipHorizontal; + } + + bool GetImageFlipVertical() const + { + return mImageFlipVertical; + } + + bool GetLocalVideoRecordingEnabled() const + { + return mLocalVideoRecordingEnabled; + } + + bool GetLocalSnapshotRecordingEnabled() const + { + return mLocalSnapshotRecordingEnabled; + } + + bool GetStatusLightEnabled() const + { + return mStatusLightEnabled; + } + + Globals::ThreeLevelAutoEnum GetStatusLightBrightness() const + { + return mStatusLightBrightness; + } + EndpointId GetEndpointId() { return AttributeAccessInterface::GetEndpointId().Value(); } CHIP_ERROR AddToFabricsUsingCamera(chip::FabricIndex aFabricIndex) @@ -280,7 +488,7 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut return CHIP_NO_ERROR; } - CHIP_ERROR SetRankedVideoStreamPriorities(const uint8_t newPriorities[kNumOfStreamTypes]) + CHIP_ERROR SetRankedVideoStreamPriorities(const StreamTypeEnum newPriorities[kNumOfStreamTypes]) { std::copy(newPriorities, newPriorities + kNumOfStreamTypes, mRankedVideoStreamPriorities); return CHIP_NO_ERROR; @@ -351,30 +559,31 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut const TwoWayTalkSupportTypeEnum mTwoWayTalkSupport; const uint32_t mMaxNetworkBandwidth; - uint16_t mCurrentFrameRate; + uint16_t mCurrentFrameRate = 0; bool mHDRModeEnabled = false; bool mSoftRecordingPrivacyModeEnabled = false; bool mSoftLivestreamPrivacyModeEnabled = false; bool mHardPrivacyModeOn = false; - TriStateAutoEnum mNightVision; - TriStateAutoEnum mNightVisionIllum; - ViewportStruct mViewport; - bool mSpeakerMuted = false; - uint8_t mSpeakerVolumeLevel; - uint8_t mSpeakerMaxLevel = kMaxSpeakerLevel; - uint8_t mSpeakerMinLevel = 0; - bool mMicrophoneMuted = false; - uint8_t mMicrophoneVolumeLevel; - uint8_t mMicrophoneMaxLevel = kMaxMicrophoneLevel; - uint8_t mMicrophoneMinLevel = 0; - bool mMicrophoneAGCEnabled = false; - uint16_t mImageRotation; - bool mImageFlipHorizontal = false; - bool mImageFlipVertical = false; - bool mLocalVideoRecordingEnabled = false; - bool mLocalSnapshotRecordingEnabled = false; - bool mStatusLightEnabled = false; - Globals::ThreeLevelAutoEnum mStatusLightBrightness; + TriStateAutoEnum mNightVision = TriStateAutoEnum::kOn; + TriStateAutoEnum mNightVisionIllum = TriStateAutoEnum::kOn; + ViewportStruct mViewport = {0, 0, 0, 0}; + bool mSpeakerMuted = false; + uint8_t mSpeakerVolumeLevel = 0; + uint8_t mSpeakerMaxLevel = kMaxSpeakerLevel; + uint8_t mSpeakerMinLevel = 0; + bool mMicrophoneMuted = false; + uint8_t mMicrophoneVolumeLevel = 0; + uint8_t mMicrophoneMaxLevel = kMaxMicrophoneLevel; + uint8_t mMicrophoneMinLevel = 0; + bool mMicrophoneAGCEnabled = false; + uint16_t mImageRotation = 0; + bool mImageFlipHorizontal = false; + bool mImageFlipVertical = false; + bool mLocalVideoRecordingEnabled = false; + bool mLocalSnapshotRecordingEnabled = false; + bool mStatusLightEnabled = false; + + Globals::ThreeLevelAutoEnum mStatusLightBrightness = Globals::ThreeLevelAutoEnum::kMedium; // Managed lists std::unordered_set mFabricsUsingCamera; @@ -383,7 +592,7 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut std::vector mSupportedSnapshotParamsList; - uint8_t mRankedVideoStreamPriorities[kNumOfStreamTypes]; + StreamTypeEnum mRankedVideoStreamPriorities[kNumOfStreamTypes]; std::vector mAllocatedVideoStreams; std::vector mAllocatedAudioStreams;