Skip to content

Commit

Permalink
Remove some attributes to simplify AVStreamMgmt cluster slightly.
Browse files Browse the repository at this point in the history
Attributes related to White balance, ShutterSPeed, ISO and Depth sensor
were removed based on feedback at the Nov member meeting.
Also, adjustments for read/write mode changes for certain attributes.
  • Loading branch information
pidarped committed Nov 12, 2024
1 parent 91eb08d commit 308df22
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 1,828 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,21 +492,6 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get NightVisionIllumination, feature is not supported"));
ReturnErrorOnFailure(aEncoder.Encode(mNightVisionIllum));
break;
case AWBEnabled::Id:
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get AWBEnabled, feature is not supported"));
ReturnErrorOnFailure(aEncoder.Encode(mAWBEnabled));
break;
case AutoShutterSpeedEnabled::Id:
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get AutoShutterSpeedEnabled, feature is not supported"));
ReturnErrorOnFailure(aEncoder.Encode(mAutoShutterSpeedEnabled));
break;
case AutoISOEnabled::Id:
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get AutoISOEnabled, feature is not supported"));
ReturnErrorOnFailure(aEncoder.Encode(mAutoISOEnabled));
break;
case Viewport::Id:
VerifyOrReturnError(HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get Viewport, feature is not supported"));
Expand Down Expand Up @@ -597,12 +582,6 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get StatusLightBrightness, feature is not supported");
ReturnErrorOnFailure(aEncoder.Encode(mStatusLightBrightness));
break;
case DepthSensorStatus::Id:
VerifyOrReturnError(HasFeature(Feature::kVideo) && SupportsOptAttr(OptionalAttributes::kSupportsDepthSensorStatus),
CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get DepthSensorStatus, feature is not supported");
ReturnErrorOnFailure(aEncoder.Encode(mDepthSensorStatus));
break;
}

return CHIP_NO_ERROR;
Expand Down Expand Up @@ -674,28 +653,13 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
ReturnErrorOnFailure(SetNightVisionIllum(nightVisionIllum));
return CHIP_NO_ERROR;
}
case AWBEnabled::Id: {
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set AWBEnabled, feature is not supported"));
bool awbEnabled;
ReturnErrorOnFailure(aDecoder.Decode(awbEnabled));
ReturnErrorOnFailure(SetAWBEnabled(awbEnabled));
return CHIP_NO_ERROR;
}
case AutoShutterSpeedEnabled::Id: {
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set AutoShutterSpeedEnabled, feature is not supported"));
bool autoShutterSpeedEnabled;
ReturnErrorOnFailure(aDecoder.Decode(autoShutterSpeedEnabled));
ReturnErrorOnFailure(SetAutoShutterSpeedEnabled(autoShutterSpeedEnabled));
return CHIP_NO_ERROR;
}
case AutoISOEnabled::Id: {
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set AutoISOEnabled, feature is not supported"));
bool autoISOEnabled;
ReturnErrorOnFailure(aDecoder.Decode(autoISOEnabled));
ReturnErrorOnFailure(SetAutoISOEnabled(autoISOEnabled));
case Viewport::Id: {
VerifyOrReturnError(
HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set RankedVideoStreamPrioritiesList, feature is not supported"));
ViewportStruct viewPort;
ReturnErrorOnFailure(aDecoder.Decode(viewPort));
ReturnErrorOnFailure(SetViewport(viewPort));
return CHIP_NO_ERROR;
}
case SpeakerMuted::Id: {
Expand All @@ -714,22 +678,6 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
ReturnErrorOnFailure(SetSpeakerVolumeLevel(speakerVolLevel));
return CHIP_NO_ERROR;
}
case SpeakerMaxLevel::Id: {
VerifyOrReturnError(HasFeature(Feature::kAudio) && HasFeature(Feature::kSpeaker), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set SpeakerMaxLevel, feature is not supported"));
uint8_t speakerMaxLevel;
ReturnErrorOnFailure(aDecoder.Decode(speakerMaxLevel));
ReturnErrorOnFailure(SetSpeakerMaxLevel(speakerMaxLevel));
return CHIP_NO_ERROR;
}
case SpeakerMinLevel::Id: {
VerifyOrReturnError(HasFeature(Feature::kAudio) && HasFeature(Feature::kSpeaker), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set SpeakerMinLevel, feature is not supported"));
uint8_t speakerMinLevel;
ReturnErrorOnFailure(aDecoder.Decode(speakerMinLevel));
ReturnErrorOnFailure(SetSpeakerMinLevel(speakerMinLevel));
return CHIP_NO_ERROR;
}
case MicrophoneMuted::Id: {
VerifyOrReturnError(HasFeature(Feature::kAudio), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set MicrophoneMuted, feature is not supported"));
Expand All @@ -746,22 +694,6 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
ReturnErrorOnFailure(SetMicrophoneVolumeLevel(micVolLevel));
return CHIP_NO_ERROR;
}
case MicrophoneMaxLevel::Id: {
VerifyOrReturnError(HasFeature(Feature::kAudio), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set MicrophoneMaxLevel, feature is not supported"));
uint8_t micMaxLevel;
ReturnErrorOnFailure(aDecoder.Decode(micMaxLevel));
ReturnErrorOnFailure(SetMicrophoneMaxLevel(micMaxLevel));
return CHIP_NO_ERROR;
}
case MicrophoneMinLevel::Id: {
VerifyOrReturnError(HasFeature(Feature::kAudio), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set MicrophoneMinLevel, feature is not supported"));
uint8_t micMinLevel;
ReturnErrorOnFailure(aDecoder.Decode(micMinLevel));
ReturnErrorOnFailure(SetMicrophoneMaxLevel(micMinLevel));
return CHIP_NO_ERROR;
}
case MicrophoneAGCEnabled::Id: {
VerifyOrReturnError(HasFeature(Feature::kAudio) && SupportsOptAttr(OptionalAttributes::kSupportsMicrophoneAGCEnabled),
CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
Expand Down Expand Up @@ -807,15 +739,6 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
ReturnErrorOnFailure(SetStatusLightBrightness(statusLightBrightness));
return CHIP_NO_ERROR;
}
case DepthSensorStatus::Id: {
VerifyOrReturnError(HasFeature(Feature::kVideo) && SupportsOptAttr(OptionalAttributes::kSupportsDepthSensorStatus),
CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set DepthSensorStatus, feature is not supported");
TriStateAutoEnum depthSensorStatus;
ReturnErrorOnFailure(aDecoder.Decode(depthSensorStatus));
ReturnErrorOnFailure(SetDepthSensorStatus(depthSensorStatus));
return CHIP_NO_ERROR;
}

default:
// Unknown attribute
Expand Down Expand Up @@ -937,42 +860,6 @@ Status CameraAVStreamMgmtServer::SetNightVisionIllum(TriStateAutoEnum aNightVisi
return Protocols::InteractionModel::Status::Success;
}

Status CameraAVStreamMgmtServer::SetAWBEnabled(bool aAWBEnabled)
{
if (mAWBEnabled != aAWBEnabled)
{
mAWBEnabled = aAWBEnabled;

ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, mClusterId, Attributes::AWBEnabled::Id);
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mAWBEnabled);
}
return Protocols::InteractionModel::Status::Success;
}

Status CameraAVStreamMgmtServer::SetAutoShutterSpeedEnabled(bool aAutoShutterSpeedEnabled)
{
if (mAutoShutterSpeedEnabled != aAutoShutterSpeedEnabled)
{
mAutoShutterSpeedEnabled = aAutoShutterSpeedEnabled;

ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, mClusterId, Attributes::AutoShutterSpeedEnabled::Id);
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mAutoShutterSpeedEnabled);
}
return Protocols::InteractionModel::Status::Success;
}

Status CameraAVStreamMgmtServer::SetAutoISOEnabled(bool aAutoISOEnabled)
{
if (mAutoISOEnabled != aAutoISOEnabled)
{
mAutoISOEnabled = aAutoISOEnabled;

ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, mClusterId, Attributes::AutoISOEnabled::Id);
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mAutoISOEnabled);
}
return Protocols::InteractionModel::Status::Success;
}

Status CameraAVStreamMgmtServer::SetViewport(const ViewportStruct & aViewport)
{
if (mViewport != aViewport)
Expand Down Expand Up @@ -1236,20 +1123,6 @@ Status CameraAVStreamMgmtServer::SetStatusLightBrightness(ThreeLevelAutoEnum aSt
return Protocols::InteractionModel::Status::Success;
}

Status CameraAVStreamMgmtServer::SetDepthSensorStatus(TriStateAutoEnum aDepthSensorStatus)
{

if (mDepthSensorStatus != aDepthSensorStatus)
{
mDepthSensorStatus = aDepthSensorStatus;

ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, mClusterId, Attributes::DepthSensorStatus::Id);
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mDepthSensorStatus);
MatterReportingAttributeChangeCallback(path);
}
return Protocols::InteractionModel::Status::Success;
}

void CameraAVStreamMgmtServer::LoadPersistentAttributes()
{
// Load HDR Mode Enabled
Expand Down Expand Up @@ -1380,6 +1253,11 @@ void CameraAVStreamMgmtServer::InvokeCommand(HandlerContext & handlerContext)
}
return;

case Commands::SetStreamPriorities::Id:
ChipLogDetail(Zcl, "CameraAVStreamMgmt: Set Stream Priorities");
// TODO
return;

case Commands::CaptureSnapshot::Id:
ChipLogDetail(Zcl, "CameraAVStreamMgmt: Capture Snapshot image");

Expand All @@ -1395,7 +1273,6 @@ void CameraAVStreamMgmtServer::InvokeCommand(HandlerContext & handlerContext)
}
return;

#TODO : Add more commands
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut

Protocols::InteractionModel::Status SetNightVisionIllum(TriStateAutoEnum aNightVisionIllum);

Protocols::InteractionModel::Status SetAWBEnabled(bool aAWBEnabled);

Protocols::InteractionModel::Status SetAutoShutterSpeedEnabled(bool aAutoShutterSpeedEnabled);

Protocols::InteractionModel::Status SetAutoISOEnabled(bool aAutoISOEnabled);

Protocols::InteractionModel::Status SetViewport(const ViewportStruct & aViewport);

Protocols::InteractionModel::Status SetSpeakerMuted(bool aSpeakerMuted);
Expand Down Expand Up @@ -262,8 +256,6 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut

Protocols::InteractionModel::Status SetStatusLightBrightness(ThreeLevelAutoEnum aStatusLightBrightness);

Protocols::InteractionModel::Status SetDepthSensorStatus(TriStateAutoEnum aDepthSensorStatus);

EndpointId GetEndpointId() { return AttributeAccessInterface::GetEndpointId().Value(); }

private:
Expand Down Expand Up @@ -293,9 +285,6 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut
bool mHardPrivacyModeOn = false;
TriStateAutoEnum mNightVision;
TriStateAutoEnum mNightVisionIllum;
bool mAWBEnabled = false;
bool mAutoShutterSpeedEnabled = false;
bool mAutoISOEnabled = false;
ViewPortStruct mViewport;
bool mSpeakerMuted = false;
uint8_t mSpeakerVolumeLevel;
Expand All @@ -313,7 +302,6 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut
bool mLocalSnapshotRecordingEnabled = false;
bool mStatusLightEnabled = false;
ThreeLevelAutoEnum mStatusLightBrightness;
TriStateAutoEnum mDepthSensorStatus;

Structs::VideoSensorParamsStruct::Type mVideoSensorParams;
CHIP_ERROR SetVideoSensorParams(const Structs::VideoSensorParamsStruct::Type & videoSensorParams)
Expand Down Expand Up @@ -371,13 +359,6 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut

void HandleCaptureSnapshot(HandlerContext & ctx, const Commands::VideoStreamModify::DecodableType & req);

/**
* @brief Handle Command: AddMoreTime.
* @param ctx Returns the Interaction Model status code which was user determined in the business logic.
* If the cook time value is out of range, returns the Interaction Model status code of CONSTRAINT_ERROR.
* If the operational state is in 'Error', returns the Interaction Model status code of INVALID_IN_STATE.
*/
void HandleAddMoreTime(HandlerContext & ctx, const Commands::AddMoreTime::DecodableType & req);
};

} // namespace CameraAVStreamMgmt
Expand Down
5 changes: 0 additions & 5 deletions src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,6 @@
"CurrentFrameRate",
"HDRModeEnabled",
"CurrentVideoCodecs",
"CurrentSnapshotConfig",
"FabricsUsingCamera",
"AllocatedVideoStreams",
"AllocatedAudioStreams",
Expand All @@ -701,9 +700,6 @@
"HardPrivacyModeOn",
"NightVision",
"NightVisionIllum",
"AWBEnabled",
"AutoShutterSpeedEnabled",
"AutoISOEnabled",
"SpeakerMuted",
"SpeakerVolumeLevel",
"SpeakerMaxLevel",
Expand All @@ -720,7 +716,6 @@
"LocalSnapshotRecordingEnabled",
"StatusLightEnabled",
"StatusLightBrightness",
"DepthSensorStatus",
"FeatureMap"
]
},
Expand Down
5 changes: 0 additions & 5 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@
"CurrentFrameRate",
"HDRModeEnabled",
"CurrentVideoCodecs",
"CurrentSnapshotConfig",
"FabricsUsingCamera",
"AllocatedVideoStreams",
"AllocatedAudioStreams",
Expand All @@ -695,9 +694,6 @@
"HardPrivacyModeOn",
"NightVision",
"NightVisionIllum",
"AWBEnabled",
"AutoShutterSpeedEnabled",
"AutoISOEnabled",
"SpeakerMuted",
"SpeakerVolumeLevel",
"SpeakerMaxLevel",
Expand All @@ -714,7 +710,6 @@
"LocalSnapshotRecordingEnabled",
"StatusLightEnabled",
"StatusLightBrightness",
"DepthSensorStatus",
"FeatureMap"
]
},
Expand Down
Loading

0 comments on commit 308df22

Please sign in to comment.