Skip to content

Commit

Permalink
Restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
pidarped committed Nov 13, 2024
1 parent 2efcf21 commit 947f42f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ namespace CameraAVStreamMgmt {

CameraAVStreamMgmtServer::CameraAVStreamMgmtServer(CameraAVStreamMgmtDelegate & aDelegate, EndpointId aEndpointId,
ClusterId aClusterId, BitMask<Feature> aFeature,
OptionalAttributes aOptionalAttrs,
uint8_t aMaxConcurrentVideoEncoders, uint32_t aMaxEncodedPixelRate,
OptionalAttributes aOptionalAttrs, uint8_t aMaxConcurrentVideoEncoders,
uint32_t aMaxEncodedPixelRate,
const VideoSensorParamsStruct & aVideoSensorParams, bool aNightVisionCapable,
const VideoResolutionStruct & aMinViewPort, uint32_t aMaxContentBufferSize,
const AudioCapabilitiesStruct & aMicrophoneCapabilities,
const AudioCapabilitiesStruct & aSpkrCapabilities,
TwoWayTalkSupportTypeEnum aTwoWayTalkSupport, uint32_t aMaxNetworkBandwidth) :
CommandHandlerInterface(MakeOptional(aEndpointId), aClusterId),
AttributeAccessInterface(MakeOptional(aEndpointId), aClusterId), mDelegate(aDelegate), mEndpointId(aEndpointId),
mClusterId(aClusterId), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs), mMaxConcurrentVideoEncoders(aMaxConcurrentVideoEncoders),
mMaxEncodedPixelRate(aMaxEncodedPixelRate), mVideoSensorParams(aVideoSensorParams), mNightVisionCapable(aNightVisionCapable),
mMinViewPort(aMinViewPort), mMaxContentBufferSize(aMaxContentBufferSize), mMicrophoneCapabilities(aMicrophoneCapabilities),
mClusterId(aClusterId), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs),
mMaxConcurrentVideoEncoders(aMaxConcurrentVideoEncoders), mMaxEncodedPixelRate(aMaxEncodedPixelRate),
mVideoSensorParams(aVideoSensorParams), mNightVisionCapable(aNightVisionCapable), mMinViewPort(aMinViewPort),
mMaxContentBufferSize(aMaxContentBufferSize), mMicrophoneCapabilities(aMicrophoneCapabilities),
mSpeakerCapabilities(aSpeakerCapabilities), mTwoWayTalkSupport(aTwoWayTalkSupport), mMaxNetworkBandwidth(aMaxNetworkBandwidth)
{
mDelegate.SetCameraAVStreamMgmtServer(this);
Expand Down Expand Up @@ -389,37 +390,42 @@ CHIP_ERROR CameraAVStreamMgmtServer::Read(const ConcreteReadAttributePath & aPat
VerifyOrReturnError(HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get FabricsUsingCamera, feature is not supported"));
ReturnErrorOnFailure(aEncoder.EncodeList(
[this](const auto & encoder) -> CHIP_ERROR { return this->ReadAndEncodeFabricsUsingCamera(encoder); }));
[this](const auto & encoder) -> CHIP_ERROR {
return this->ReadAndEncodeFabricsUsingCamera(encoder); }));
break;
case AllocatedVideoStreams::Id:
VerifyOrReturnError(HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get AllocatedVideoStreams, feature is not supported"));

ReturnErrorOnFailure(aEncoder.EncodeList(
[this](const auto & encoder) -> CHIP_ERROR { return this->ReadAndEncodeAllocatedVideoStreams(encoder); }));
[this](const auto & encoder) -> CHIP_ERROR {
return this->ReadAndEncodeAllocatedVideoStreams(encoder); }));
break;
case AllocatedAudioStreams::Id:
VerifyOrReturnError(HasFeature(Feature::kAudio), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get AllocatedAudioStreams, feature is not supported"));

ReturnErrorOnFailure(aEncoder.EncodeList(
[this](const auto & encoder) -> CHIP_ERROR { return this->ReadAndEncodeAllocatedAudioStreams(encoder); }));
[this](const auto & encoder) -> CHIP_ERROR {
return this->ReadAndEncodeAllocatedAudioStreams(encoder); }));
break;
case AllocatedSnapshotStreams::Id:
VerifyOrReturnError(
HasFeature(Feature::kAudio), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get AllocatedSnapshotStreams, feature is not supported"));

ReturnErrorOnFailure(aEncoder.EncodeList(
[this](const auto & encoder) -> CHIP_ERROR { return this->ReadAndEncodeAllocatedSnapshotStreams(encoder); }));
[this](const auto & encoder) -> CHIP_ERROR {
return this->ReadAndEncodeAllocatedSnapshotStreams(encoder); }));
break;
case RankedVideoStreamPrioritiesList::Id:
VerifyOrReturnError(
HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not get RankedVideoStreamPrioritiesList, feature is not supported"));

ReturnErrorOnFailure(aEncoder.EncodeList(
[this](const auto & encoder) -> CHIP_ERROR { return this->ReadAndEncodeRankedVideoStreamPrioritiesList(encoder); }));
[this](const auto & encoder) -> CHIP_ERROR {
return this->ReadAndEncodeRankedVideoStreamPrioritiesList(encoder); }));
break;
case SoftRecordingPrivacyModeEnabled::Id:
VerifyOrReturnError(
Expand Down Expand Up @@ -563,7 +569,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
ReturnErrorOnFailure(SetHDRModeEnabled(hdrModeEnabled));
return CHIP_NO_ERROR;
}
case RankedVideoStreamPrioritiesList::Id: {// TODO
case RankedVideoStreamPrioritiesList::Id: { // TODO
VerifyOrReturnError(
HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set RankedVideoStreamPrioritiesList, feature is not supported"));
Expand Down Expand Up @@ -594,7 +600,8 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
}
case NightVision::Id: {
VerifyOrReturnError((HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot)) &&
SupportsOptAttr(OptionalAttributes::kSupportsNightVision), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
SupportsOptAttr(OptionalAttributes::kSupportsNightVision),
CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set NightVision, feature is not supported"));

TriStateAutoEnum nightVision;
Expand All @@ -604,7 +611,8 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
}
case NightVisionIllum::Id: {
VerifyOrReturnError((HasFeature(Feature::kVideo) || HasFeature(Feature::kSnapshot)) &&
SupportsOptAttr(OptionalAttributes::kSupportsNightVisionIllum), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
SupportsOptAttr(OptionalAttributes::kSupportsNightVisionIllum),
CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set NightVisionIllumination, feature is not supported"));

TriStateAutoEnum nightVisionIllum;
Expand All @@ -616,7 +624,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Write(const ConcreteDataAttributePath & aPa
VerifyOrReturnError(
HasFeature(Feature::kVideo), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE,
ChipLogError(Zcl, "CameraAVStreamMgmt: can not set RankedVideoStreamPrioritiesList, feature is not supported"));
ViewportStruct viewPort;
ViewportStruct viewPort;
ReturnErrorOnFailure(aDecoder.Decode(viewPort));
ReturnErrorOnFailure(SetViewport(viewPort));
return CHIP_NO_ERROR;
Expand Down Expand Up @@ -1203,7 +1211,6 @@ void CameraAVStreamMgmtServer::InvokeCommand(HandlerContext & handlerContext)
[this](HandlerContext & ctx, const auto & commandData) { HandleCaptureSnapshot(ctx, commandData); });
}
return;

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut
* @param aFeature The bitmask value that identifies which features are supported by this instance.
*/
CameraAVStreamMgmtServer(CameraAVStreamMgmtDelegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId,
BitMask<CameraAVStreamMgmt::Feature> aFeature, OptionalAttributes aOptionalAttrs, uint8_t aMaxConVideoEncoders,
uint32_t aMaxEncodedPixelRate, VideoSensorParamsStruct aVideoSensorParams, bool aNightVisionCapable,
BitMask<CameraAVStreamMgmt::Feature> aFeature, OptionalAttributes aOptionalAttrs,
uint8_t aMaxConVideoEncoders, uint32_t aMaxEncodedPixelRate,
VideoSensorParamsStruct aVideoSensorParams, bool aNightVisionCapable,
VideoResolutionStruct minViewPort, uint32_t aMaxContentBufferSize,
AudioCapabilitiesStruct aMicCapabilities, AudioCapabilitiesStruct aSpkrCapabilities,
TwoWayTalkSupportTypeEnum aTwoWayTalkSupport, uint32_t aMaxNetworkBandwidth);
Expand Down Expand Up @@ -270,7 +271,7 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut
const uint32_t mMaxNetworkBandwidth;

uint16_t mCurrentFrameRate;
bool mHDRModeEnabled = false;
bool mHDRModeEnabled = false;
bool mSoftRecordingPrivacyModeEnabled = false;
bool mSoftLivestreamPrivacyModeEnabled = false;
bool mHardPrivacyModeOn = false;
Expand Down Expand Up @@ -348,7 +349,6 @@ class CameraAVStreamMgmtServer : public CommandHandlerInterface, public Attribut
void HandleSnapshotStreamDeallocate(HandlerContext & ctx, const Commands::VideoStreamModify::DecodableType & req);

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

};

} // namespace CameraAVStreamMgmt
Expand Down

0 comments on commit 947f42f

Please sign in to comment.