Skip to content

Commit

Permalink
Restyle fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed Dec 15, 2021
1 parent facf0a5 commit 5bdba7f
Show file tree
Hide file tree
Showing 8 changed files with 3,561 additions and 70 deletions.
11 changes: 5 additions & 6 deletions examples/tv-app/android/java/ContentLauncherManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ using namespace chip;
ContentLauncherManager ContentLauncherManager::sInstance;

ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId,
const std::list<ContentLaunchParamater> & parameterList,
bool autoplay,
const chip::CharSpan & data)
const std::list<ContentLaunchParamater> & parameterList,
bool autoplay, const chip::CharSpan & data)
{
ContentLaunchResponse response;
CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -101,9 +100,9 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint
return response;
}

ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl,
const chip::CharSpan & displayString,
const ContentLaunchBrandingInformation & brandingInformation)
ContentLaunchResponse
ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<ContentLaunchBrandingInformation> & brandingInformation)
{
ContentLaunchResponse response;
CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ using namespace std;
using namespace chip::AppPlatform;

ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId,
const std::list<ContentLaunchParamater> & parameterList, bool autoplay,
const chip::CharSpan & data)
const std::list<ContentLaunchParamater> & parameterList,
bool autoplay, const chip::CharSpan & data)
{
ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchContent ");
string dataString(data.data(), data.size());
Expand All @@ -61,9 +61,9 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint
return response;
}

ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl,
const chip::CharSpan & displayString,
const std::list<ContentLaunchBrandingInformation> & brandingInformation)
ContentLaunchResponse
ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<ContentLaunchBrandingInformation> & brandingInformation)
{
ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchUrl");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ namespace ContentLauncher {
class Delegate
{
public:
virtual ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list<ContentLaunchParamater> & parameterList,
bool autoplay, const chip::CharSpan & data) = 0;
virtual ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId,
const std::list<ContentLaunchParamater> & parameterList, bool autoplay,
const chip::CharSpan & data) = 0;

virtual ContentLaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<ContentLaunchBrandingInformation> & brandingInformation) = 0;
Expand Down
57 changes: 27 additions & 30 deletions src/app/clusters/content-launch-server/content-launch-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ Delegate * GetDelegate(EndpointId endpoint)
return (ep == 0xFFFF ? NULL : gDelegateTable[ep]);
}

bool SendStatusIfDelegateNull(Delegate * delegate, EndpointId endpoint)
bool isDelegateNull(Delegate * delegate, EndpointId endpoint)
{
if (delegate == nullptr)
{
ChipLogError(Zcl, "No ContentLauncher Delegate set for ep:%" PRIu16, endpoint);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_UNSUP_COMMAND);
ChipLogError(Zcl, "Content Launcher has no delegate set for endpoint:%" PRIu16, endpoint);
return true;
}
return false;
Expand Down Expand Up @@ -129,7 +128,8 @@ CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath
{
EndpointId endpoint = aPath.mEndpointId;
Delegate * delegate = GetDelegate(endpoint);
if (SendStatusIfDelegateNull(delegate, endpoint))

if (isDelegateNull(delegate, endpoint))
{
return CHIP_NO_ERROR;
}
Expand All @@ -146,6 +146,7 @@ CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath
break;
}
}

return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -181,26 +182,25 @@ bool emberAfContentLauncherClusterLaunchContentCallback(
chip::app::Clusters::ContentLauncher::Commands::LaunchContentResponse::Type response;
EndpointId endpoint = commandPath.mEndpointId;

auto & autoplay = commandData.autoPlay;
auto & data = commandData.data;
auto & autoplay = commandData.autoPlay;
auto & data = commandData.data;
// TODO: Decode the paramater and pass it to delegate
// auto searchIterator = commandData.search.begin();
std::list<ContentLaunchParamater> parameterList;

Delegate * delegate = GetDelegate(endpoint);
if (SendStatusIfDelegateNull(delegate, endpoint))
{
return true;
}
VerifyOrExit(isDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE);

ContentLaunchResponse resp = delegate->HandleLaunchContent(emberAfCurrentEndpoint(), parameterList, autoplay, data);
VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err);
{
ContentLaunchResponse resp = delegate->HandleLaunchContent(emberAfCurrentEndpoint(), parameterList, autoplay, data);
VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err);

response.contentLaunchStatus = resp.status;
response.data = resp.data;
response.contentLaunchStatus = resp.status;
response.data = resp.data;

err = commandObj->AddResponseData(commandPath, response);
SuccessOrExit(err);
err = commandObj->AddResponseData(commandPath, response);
SuccessOrExit(err);
}

exit:
if (err != CHIP_NO_ERROR)
Expand All @@ -221,28 +221,25 @@ bool emberAfContentLauncherClusterLaunchURLCallback(
chip::app::Clusters::ContentLauncher::Commands::LaunchURLResponse::Type response;
EndpointId endpoint = commandPath.mEndpointId;


auto & contentUrl = commandData.contentURL;
auto & displayString = commandData.displayString;
auto & contentUrl = commandData.contentURL;
auto & displayString = commandData.displayString;
// TODO: Decode the paramater and pass it to delegate
// auto brandingInformationIterator = commandData.brandingInformation.begin();
std::list<ContentLaunchBrandingInformation> brandingInformationList;


Delegate * delegate = GetDelegate(endpoint);
if (SendStatusIfDelegateNull(delegate, endpoint))
{
return true;
}
VerifyOrExit(isDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE);

ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformationList);
VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err);
{
ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformationList);
VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err);

response.contentLaunchStatus = resp.status;
response.data = resp.data;
response.contentLaunchStatus = resp.status;
response.data = resp.data;

err = commandObj->AddResponseData(commandPath, response);
SuccessOrExit(err);
err = commandObj->AddResponseData(commandPath, response);
SuccessOrExit(err);
}

exit:
if (err != CHIP_NO_ERROR)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5bdba7f

Please sign in to comment.