Skip to content

Commit

Permalink
Add handler for the SetStreamPriorities command.
Browse files Browse the repository at this point in the history
  • Loading branch information
pidarped committed Nov 16, 2024
1 parent 339fa18 commit d6f2f08
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,9 @@ void CameraAVStreamMgmtServer::InvokeCommand(HandlerContext & handlerContext)
case Commands::SetStreamPriorities::Id:
ChipLogDetail(Zcl, "CameraAVStreamMgmt: Set Stream Priorities");
// TODO
HandleCommand<Commands::SetStreamPriorities::DecodableType>(
handlerContext,
[this](HandlerContext & ctx, const auto & commandData) { HandleSetStreamPriorities(ctx, commandData); });
return;

case Commands::CaptureSnapshot::Id:
Expand Down Expand Up @@ -1387,6 +1390,24 @@ void CameraAVStreamMgmtServer::HandleSnapshotStreamDeallocate(HandlerContext & c
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::Success);
}

void CameraAVStreamMgmtServer::HandleSetStreamPriorities(HandlerContext & ctx,
const Commands::SnapshotStreamAllocate::DecodableType & commandData)
{

auto & streamPriorities = commandData.streamPriorities;

// Call the delegate
Status status = mDelegate.SetStreamPriorities(streamPriorities);

if (status != Status::Success)
{
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
return;
}

ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::Success);
}

void CameraAVStreamMgmtServer::HandleCaptureSnapshot(HandlerContext & ctx,
const Commands::VideoStreamAllocate::DecodableType & commandData)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ class CameraAVStreamMgmtDelegate
virtual uint32_t GetMaxEncodedPixelRate() = 0;

virtual CHIP_ERROR StartAllocatedVideoStreamsRead() = 0;
virtual CHIP_ERROR GetAllocatedVideoStreamByIndex(uint8_t, Structs::VideoStreamSturct::Type &) = 0;
virtual CHIP_ERROR GetAllocatedVideoStreamByIndex(uint8_t, Structs::VideoStreamStruct::Type &) = 0;
virtual CHIP_ERROR EndAllocatedVideoStreamsRead() = 0;

virtual CHIP_ERROR StartAllocatedAudioStreamsRead() = 0;
virtual CHIP_ERROR GetAllocatedAudioStreamByIndex(uint8_t, Structs::AudioStreamSturct::Type &) = 0;
virtual CHIP_ERROR GetAllocatedAudioStreamByIndex(uint8_t, Structs::AudioStreamStruct::Type &) = 0;
virtual CHIP_ERROR EndAllocatedAudioStreamsRead() = 0;

virtual CHIP_ERROR StartAllocatedSnapshotStreamsRead() = 0;
virtual CHIP_ERROR GetAllocatedSnapshotStreamByIndex(uint8_t, Structs::SnapshotStreamSturct::Type &) = 0;
virtual CHIP_ERROR GetAllocatedSnapshotStreamByIndex(uint8_t, Structs::SnapshotStreamStruct::Type &) = 0;
virtual CHIP_ERROR EndAllocatedSnapshotStreamsRead() = 0;

virtual CHIP_ERROR StartRateDistortionTradeOffPointsRead() = 0;
Expand All @@ -132,9 +132,11 @@ class CameraAVStreamMgmtDelegate
virtual CHIP_ERROR GetFabricUsingCameraByIndex(uint8_t, chip::FabricIndex) = 0;
virtual CHIP_ERROR EndFabricsUsingCameraRead() = 0;

virtual CHIP_ERROR StartRankedVideoStreamPrioritiesListRead = 0;
virtual CHIP_ERROR GetRankedVideoStreamPrioritiesListByIndex(uint8_t, StreamTypeEnumType) = 0;
virtual CHIP_ERROR EndRankedVideoStreamPrioritiesListRead = 0;
virtual CHIP_ERROR StartRankedVideoStreamPrioritiesListRead = 0;
virtual CHIP_ERROR GetRankedVideoStreamPrioritiesListByIndex(uint8_t, StreamTypeEnum) = 0;
virtual CHIP_ERROR EndRankedVideoStreamPrioritiesListRead = 0;

virtual CHIP_ERROR SetStreamPriorities(DataModel::List<const StreamTypeEnum> streamPriorities) = 0;

protected:
friend class CameraAVStreamMgmtServer;
Expand Down

0 comments on commit d6f2f08

Please sign in to comment.