Skip to content

Commit

Permalink
Add Getters for attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
pidarped committed Dec 13, 2024
1 parent 6db59e6 commit f99991b
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ class CameraAVStreamMgmtDelegate
virtual Protocols::InteractionModel::Status
SetStreamPriorities(const DataModel::DecodableList<StreamTypeEnum> 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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<Structs::RateDistortionTradeOffPointsStruct::Type> & 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<Structs::SnapshotParamsStruct::Type> & 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<chip::FabricIndex> & GetFabricsUsingCamera() const
{
return mFabricsUsingCamera;
}

const std::vector<VideoStreamStruct> & GetAllocatedVideoStreams() const
{
return mAllocatedVideoStreams;
}

const std::vector<AudioStreamStruct> & GetAllocatedAudioStreams() const
{
return mAllocatedAudioStreams;
}

const std::vector<SnapshotStreamStruct> & 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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<chip::FabricIndex> mFabricsUsingCamera;
Expand All @@ -383,7 +592,7 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut

std::vector<Structs::SnapshotParamsStruct::Type> mSupportedSnapshotParamsList;

uint8_t mRankedVideoStreamPriorities[kNumOfStreamTypes];
StreamTypeEnum mRankedVideoStreamPriorities[kNumOfStreamTypes];

std::vector<VideoStreamStruct> mAllocatedVideoStreams;
std::vector<AudioStreamStruct> mAllocatedAudioStreams;
Expand Down

0 comments on commit f99991b

Please sign in to comment.