Skip to content

Commit 0968da0

Browse files
Apply suggestions from code review
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent ba0a467 commit 0968da0

File tree

2 files changed

+61
-92
lines changed

2 files changed

+61
-92
lines changed

src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp

+25-25
Original file line numberDiff line numberDiff line change
@@ -98,32 +98,32 @@ CHIP_ERROR CameraAVStreamMgmtServer::Init()
9898
}
9999

100100
// Ensure Optional attribute bits have been correctly passed.
101-
if (SupportsOptAttr(OptionalAttribute::kSupportsHDRModeEnabled))
101+
if (SupportsOptAttr(OptionalAttribute::kHDRModeEnabled))
102102
{
103103
VerifyOrReturnError(
104104
HasFeature(Feature::kVideo), CHIP_ERROR_INVALID_ARGUMENT,
105105
ChipLogError(Zcl, "CameraAVStreamMgmt: Feature configuration error. if HDRModeEnabled, then Video feature required"));
106106
}
107107

108-
if (SupportsOptAttr(OptionalAttribute::kSupportsNightVision) || SupportsOptAttr(OptionalAttribute::kSupportsNightVisionIllum))
108+
if (SupportsOptAttr(OptionalAttribute::kNightVision) || SupportsOptAttr(OptionalAttribute::kNightVisionIllum))
109109
{
110110
VerifyOrReturnError(HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot), CHIP_ERROR_INVALID_ARGUMENT,
111111
ChipLogError(Zcl,
112112
"CameraAVStreamMgmt: Feature configuration error. if NIghtVision is enabled, then "
113113
"Video|Snapshot feature required"));
114114
}
115115

116-
if (SupportsOptAttr(OptionalAttribute::kSupportsMicrophoneAGCEnabled))
116+
if (SupportsOptAttr(OptionalAttribute::kMicrophoneAGCEnabled))
117117
{
118118
VerifyOrReturnError(
119119
HasFeature(Feature::kAudio), CHIP_ERROR_INVALID_ARGUMENT,
120120
ChipLogError(Zcl,
121121
"CameraAVStreamMgmt: Feature configuration error. if MicrophoneAGCEnabled, then Audio feature required"));
122122
}
123123

124-
if (SupportsOptAttr(OptionalAttribute::kSupportsImageFlipHorizontal) ||
125-
SupportsOptAttr(OptionalAttribute::kSupportsImageFlipVertical) ||
126-
SupportsOptAttr(OptionalAttribute::kSupportsImageRotation))
124+
if (SupportsOptAttr(OptionalAttribute::kImageFlipHorizontal) ||
125+
SupportsOptAttr(OptionalAttribute::kImageFlipVertical) ||
126+
SupportsOptAttr(OptionalAttribute::kImageRotation))
127127
{
128128
VerifyOrReturnError(HasFeature(Feature::kImageControl), CHIP_ERROR_INVALID_ARGUMENT,
129129
ChipLogError(Zcl,
@@ -412,7 +412,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
412412
ReturnErrorOnFailure(aEncoder.Encode(mCurrentFrameRate));
413413
break;
414414
case HDRModeEnabled::Id:
415-
VerifyOrReturnError(HasFeature(Feature::kVideo) && SupportsOptAttr(OptionalAttribute::kSupportsHDRModeEnabled),
415+
VerifyOrReturnError(HasFeature(Feature::kVideo) && SupportsOptAttr(OptionalAttribute::kHDRModeEnabled),
416416
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
417417
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get HDRModeEnabled, feature is not supported"));
418418
ReturnErrorOnFailure(aEncoder.Encode(mHDRModeEnabled));
@@ -466,21 +466,21 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
466466
ReturnErrorOnFailure(aEncoder.Encode(mSoftLivestreamPrivacyModeEnabled));
467467
break;
468468
case HardPrivacyModeOn::Id:
469-
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kSupportsHardPrivacyModeOn),
469+
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kHardPrivacyModeOn),
470470
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
471471
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get HardPrivacyModeOn, feature is not supported"));
472472
ReturnErrorOnFailure(aEncoder.Encode(mHardPrivacyModeOn));
473473
break;
474474
case NightVision::Id:
475475
VerifyOrReturnError((HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot)) &&
476-
SupportsOptAttr(OptionalAttribute::kSupportsNightVision),
476+
SupportsOptAttr(OptionalAttribute::kNightVision),
477477
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
478478
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get NightVision, feature is not supported"));
479479
ReturnErrorOnFailure(aEncoder.Encode(mNightVision));
480480
break;
481481
case NightVisionIllum::Id:
482482
VerifyOrReturnError((HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot)) &&
483-
SupportsOptAttr(OptionalAttribute::kSupportsNightVisionIllum),
483+
SupportsOptAttr(OptionalAttribute::kNightVisionIllum),
484484
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
485485
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get NightVisionIllumination, feature is not supported"));
486486
ReturnErrorOnFailure(aEncoder.Encode(mNightVisionIllum));
@@ -535,25 +535,25 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
535535
ReturnErrorOnFailure(aEncoder.Encode(mMicrophoneMinLevel));
536536
break;
537537
case MicrophoneAGCEnabled::Id:
538-
VerifyOrReturnError(HasFeature(Feature::kAudio) && SupportsOptAttr(OptionalAttribute::kSupportsMicrophoneAGCEnabled),
538+
VerifyOrReturnError(HasFeature(Feature::kAudio) && SupportsOptAttr(OptionalAttribute::kMicrophoneAGCEnabled),
539539
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
540540
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get MicrophoneAGCEnabled, feature is not supported"));
541541
ReturnErrorOnFailure(aEncoder.Encode(mMicrophoneAGCEnabled));
542542
break;
543543
case ImageRotation::Id:
544-
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kSupportsImageRotation),
544+
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kImageRotation),
545545
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
546546
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get ImageRotation, feature is not supported"));
547547
ReturnErrorOnFailure(aEncoder.Encode(mImageRotation));
548548
break;
549549
case ImageFlipHorizontal::Id:
550-
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kSupportsImageFlipHorizontal),
550+
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kImageFlipHorizontal),
551551
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
552552
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get ImageFlipHorizontal, feature is not supported"));
553553
ReturnErrorOnFailure(aEncoder.Encode(mImageFlipHorizontal));
554554
break;
555555
case ImageFlipVertical::Id:
556-
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kSupportsImageFlipVertical),
556+
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kImageFlipVertical),
557557
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
558558
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get ImageFlipHorizontal, feature is not supported"));
559559
ReturnErrorOnFailure(aEncoder.Encode(mImageFlipVertical));
@@ -571,13 +571,13 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
571571
ReturnErrorOnFailure(aEncoder.Encode(mLocalSnapshotRecordingEnabled));
572572
break;
573573
case StatusLightEnabled::Id:
574-
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kSupportsStatusLightEnabled),
574+
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kStatusLightEnabled),
575575
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
576576
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get StatusLightEnabled, feature is not supported"));
577577
ReturnErrorOnFailure(aEncoder.Encode(mStatusLightEnabled));
578578
break;
579579
case StatusLightBrightness::Id:
580-
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kSupportsStatusLightBrightness),
580+
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kStatusLightBrightness),
581581
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
582582
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get StatusLightBrightness, feature is not supported"));
583583
ReturnErrorOnFailure(aEncoder.Encode(mStatusLightBrightness));
@@ -595,7 +595,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
595595
{
596596
case HDRModeEnabled::Id: {
597597
// Optional Attribute if Video is supported
598-
VerifyOrReturnError(HasFeature(Feature::kVideo) && SupportsOptAttr(OptionalAttribute::kSupportsHDRModeEnabled),
598+
VerifyOrReturnError(HasFeature(Feature::kVideo) && SupportsOptAttr(OptionalAttribute::kHDRModeEnabled),
599599
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
600600
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set HDRModeEnabled, feature is not supported"));
601601

@@ -623,7 +623,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
623623
}
624624
case NightVision::Id: {
625625
VerifyOrReturnError((HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot)) &&
626-
SupportsOptAttr(OptionalAttribute::kSupportsNightVision),
626+
SupportsOptAttr(OptionalAttribute::kNightVision),
627627
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
628628
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set NightVision, feature is not supported"));
629629

@@ -633,7 +633,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
633633
}
634634
case NightVisionIllum::Id: {
635635
VerifyOrReturnError((HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot)) &&
636-
SupportsOptAttr(OptionalAttribute::kSupportsNightVisionIllum),
636+
SupportsOptAttr(OptionalAttribute::kNightVisionIllum),
637637
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
638638
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set NightVisionIllumination, feature is not supported"));
639639

@@ -679,31 +679,31 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
679679
return SetMicrophoneVolumeLevel(micVolLevel);
680680
}
681681
case MicrophoneAGCEnabled::Id: {
682-
VerifyOrReturnError(HasFeature(Feature::kAudio) && SupportsOptAttr(OptionalAttribute::kSupportsMicrophoneAGCEnabled),
682+
VerifyOrReturnError(HasFeature(Feature::kAudio) && SupportsOptAttr(OptionalAttribute::kMicrophoneAGCEnabled),
683683
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
684684
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set MicrophoneAGCEnabled, feature is not supported"));
685685
bool micAGCEnabled;
686686
ReturnErrorOnFailure(aDecoder.Decode(micAGCEnabled));
687687
return SetMicrophoneAGCEnabled(micAGCEnabled);
688688
}
689689
case ImageRotation::Id: {
690-
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kSupportsImageRotation),
690+
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kImageRotation),
691691
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
692692
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set ImageRotation, feature is not supported"));
693693
uint16_t imageRotation;
694694
ReturnErrorOnFailure(aDecoder.Decode(imageRotation));
695695
return SetImageRotation(imageRotation);
696696
}
697697
case ImageFlipHorizontal::Id: {
698-
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kSupportsImageFlipHorizontal),
698+
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kImageFlipHorizontal),
699699
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
700700
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set ImageFlipHorizontal, feature is not supported"));
701701
bool imageFlipHorizontal;
702702
ReturnErrorOnFailure(aDecoder.Decode(imageFlipHorizontal));
703703
return SetImageFlipHorizontal(imageFlipHorizontal);
704704
}
705705
case ImageFlipVertical::Id: {
706-
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kSupportsImageFlipVertical),
706+
VerifyOrReturnError(HasFeature(Feature::kImageControl) && SupportsOptAttr(OptionalAttribute::kImageFlipVertical),
707707
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
708708
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set ImageFlipVertical, feature is not supported"));
709709
bool imageFlipVertical;
@@ -727,15 +727,15 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
727727
return SetLocalSnapshotRecordingEnabled(localSnapshotRecEnabled);
728728
}
729729
case StatusLightEnabled::Id: {
730-
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kSupportsStatusLightEnabled),
730+
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kStatusLightEnabled),
731731
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
732732
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set StatusLightEnabled, feature is not supported"));
733733
bool statusLightEnabled;
734734
ReturnErrorOnFailure(aDecoder.Decode(statusLightEnabled));
735735
return SetStatusLightEnabled(statusLightEnabled);
736736
}
737737
case StatusLightBrightness::Id: {
738-
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kSupportsStatusLightBrightness),
738+
VerifyOrReturnError(SupportsOptAttr(OptionalAttribute::kStatusLightBrightness),
739739
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute),
740740
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set StatusLightBrightness, feature is not supported"));
741741
Globals::ThreeLevelAutoEnum statusLightBrightness;

0 commit comments

Comments
 (0)