Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command line support in linux tv-casting-app #24215

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/tv-casting-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ int main(int argc, char * argv[])
VerifyOrDie(CHIP_NO_ERROR == initParams.InitializeStaticResourcesBeforeServerInit());
VerifyOrDie(CHIP_NO_ERROR == chip::Server::GetInstance().Init(initParams));

if (ConnectToCachedVideoPlayer() == CHIP_NO_ERROR)
if (argc > 1)
{
ChipLogProgress(AppServer, "Command line parameters detected. Skipping auto-start.");
}
else if (ConnectToCachedVideoPlayer() == CHIP_NO_ERROR)
{
ChipLogProgress(AppServer, "Skipping commissioner discovery / User directed commissioning flow.");
}
Expand Down
16 changes: 16 additions & 0 deletions examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ CastingServer::GetDiscoveredCommissioner(int index, chip::Optional<TargetVideoPl
void CastingServer::ReadServerClustersForNode(NodeId nodeId)
{
ChipLogProgress(NotSpecified, "ReadServerClustersForNode nodeId=0x" ChipLogFormatX64, ChipLogValueX64(nodeId));
CHIP_ERROR err = Init();
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "Init error: %" CHIP_ERROR_FORMAT, err.Format());
}

for (const auto & binding : BindingTable::GetInstance())
{
ChipLogProgress(NotSpecified,
Expand Down Expand Up @@ -471,6 +477,11 @@ void CastingServer::DeviceEventCallback(const DeviceLayer::ChipDeviceEvent * eve
// given a fabric index, try to determine the video-player nodeId by searching the binding table
NodeId CastingServer::GetVideoPlayerNodeForFabricIndex(FabricIndex fabricIndex)
{
CHIP_ERROR err = Init();
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "GetVideoPlayerNodeForFabricIndex Init error: %" CHIP_ERROR_FORMAT, err.Format());
}
for (const auto & binding : BindingTable::GetInstance())
{
ChipLogProgress(NotSpecified,
Expand All @@ -492,6 +503,11 @@ NodeId CastingServer::GetVideoPlayerNodeForFabricIndex(FabricIndex fabricIndex)
// given a nodeId, try to determine the video-player fabric index by searching the binding table
FabricIndex CastingServer::GetVideoPlayerFabricIndexForNode(NodeId nodeId)
{
CHIP_ERROR err = Init();
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "GetVideoPlayerFabricIndexForNode Init error: %" CHIP_ERROR_FORMAT, err.Format());
}
for (const auto & binding : BindingTable::GetInstance())
{
ChipLogProgress(NotSpecified,
Expand Down