Skip to content

Commit

Permalink
Making request a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadb-amazon committed Dec 15, 2023
1 parent 8ef97f2 commit e281922
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
15 changes: 7 additions & 8 deletions examples/tv-casting-app/linux/simple-app-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ void ConnectionHandler(CHIP_ERROR err, matter::casting::core::CastingPlayer * ca
if (it != endpoints.end())
{
unsigned index = (unsigned int) std::distance(endpoints.begin(), it);
matter::casting::memory::Strong<matter::casting::clusters::ContentLauncherCluster> cluster =
endpoints[index]->GetCluster<matter::casting::clusters::ContentLauncherCluster>();
matter::casting::memory::Strong<matter::casting::clusters::content_launcher::ContentLauncherCluster> cluster =
endpoints[index]->GetCluster<matter::casting::clusters::content_launcher::ContentLauncherCluster>();
if (cluster != nullptr)
{
chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type * request =
new chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type();
request->contentURL = chip::CharSpan::fromCharString("https://www.test.com/videoid");
request->displayString = chip::Optional<chip::CharSpan>(chip::CharSpan::fromCharString("Test video"));
request->brandingInformation =
chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type request;
request.contentURL = chip::CharSpan::fromCharString("https://www.test.com/videoid");
request.displayString = chip::Optional<chip::CharSpan>(chip::CharSpan::fromCharString("Test video"));
request.brandingInformation =
chip::MakeOptional(chip::app::Clusters::ContentLauncher::Structs::BrandingInformationStruct::Type());
cluster->LaunchURL(*request, nullptr, OnLaunchURLSuccess, OnLaunchURLFailure,
cluster->LaunchURL(request, nullptr, OnLaunchURLSuccess, OnLaunchURLFailure,
chip::MakeOptional(static_cast<unsigned short>(5 * 1000)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace matter {
namespace casting {
namespace clusters {
namespace content_launcher {

void ContentLauncherCluster::LaunchURL(
chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type request, void * context,
Expand All @@ -31,6 +32,7 @@ void ContentLauncherCluster::LaunchURL(
command.Invoke(request, context, successCb, failureCb, timedInvokeTimeoutMs);
}

}; // namespace content_launcher
}; // namespace clusters
}; // namespace casting
}; // namespace matter
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace matter {
namespace casting {
namespace clusters {
namespace content_launcher {

class ContentLauncherCluster : public core::BaseCluster
{
Expand Down Expand Up @@ -54,6 +55,7 @@ class LaunchURLCommand : public Command<chip::app::Clusters::ContentLauncher::Co
LaunchURLCommand(memory::Weak<core::Endpoint> endpoint) : Command(endpoint) {}
};

}; // namespace content_launcher
}; // namespace clusters
}; // namespace casting
}; // namespace matter
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void EndpointListLoader::Complete()
switch (clusterId)
{
case chip::app::Clusters::ContentLauncher::Id:
endpoint->RegisterCluster<clusters::ContentLauncherCluster>(clusterId);
endpoint->RegisterCluster<clusters::content_launcher::ContentLauncherCluster>(clusterId);
break;

case chip::app::Clusters::MediaPlayback::Id:
Expand Down

0 comments on commit e281922

Please sign in to comment.