Skip to content

Commit

Permalink
Failure handling and fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
amitnj committed Jun 28, 2022
1 parent 3f4303d commit 75f1528
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,19 @@ CHIP_ERROR AppContentLauncherManager::HandleGetAcceptHeaderList(AttributeValueEn
{
Json::Reader reader;
Json::Value value;
reader.parse(resStr, value);
std::string attrId = to_string(chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id).c_str();
ChipLogProgress(Zcl,
"AppContentLauncherManager::HandleGetSupportedStreamingProtocols response parsing done. reading attr %s",
attrId.c_str());
if (value[attrId].isArray())
if (reader.parse(resStr, value))
{
mAcceptHeaderList.clear();
for (Json::Value & entry : value[attrId])
std::string attrId = to_string(chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id);
ChipLogProgress(Zcl,
"AppContentLauncherManager::HandleGetSupportedStreamingProtocols response parsing done. reading attr %s",
attrId.c_str());
if (value[attrId].isArray())
{
mAcceptHeaderList.push_back(entry.asString());
mAcceptHeaderList.clear();
for (Json::Value & entry : value[attrId])
{
mAcceptHeaderList.push_back(entry.asString());
}
}
}
}
Expand Down Expand Up @@ -132,7 +134,10 @@ uint32_t AppContentLauncherManager::HandleGetSupportedStreamingProtocols()

Json::Reader reader;
Json::Value value;
reader.parse(resStr, value);
if (!reader.parse(resStr, value))
{
return mSupportedStreamingProtocols;
}
std::string attrId = to_string(chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id);
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetSupportedStreamingProtocols response parsing done. reading attr %s",
attrId.c_str());
Expand Down
6 changes: 5 additions & 1 deletion examples/tv-app/android/java/ContentAppCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand
{
Json::Reader reader;
Json::Value value;
reader.parse(response, value);
if (!reader.parse(response, value))
{
handlerContext.SetCommandNotHandled();
return;
}

switch (handlerContext.mRequestPath.mClusterId)
{
Expand Down

0 comments on commit 75f1528

Please sign in to comment.