Skip to content

Commit

Permalink
Media clusters & TV app minor attributes update (#14808)
Browse files Browse the repository at this point in the history
* Update attributes in xml and in code

* Update code

* Run zap regen code

* Restyle fix

* Fix tv android app
  • Loading branch information
lazarkov authored Feb 7, 2022
1 parent 4d36551 commit d5d9dc7
Show file tree
Hide file tree
Showing 38 changed files with 259 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ server cluster ApplicationLauncher = 1292 {
kLineupInfo = 0x2;
}

struct ApplicationLauncherApplication {
struct Application {
INT16U catalogVendorId = 0;
CHAR_STRING applicationId = 1;
}
Expand Down Expand Up @@ -2815,8 +2815,8 @@ server cluster Switch = 59 {
server cluster TargetNavigator = 1285 {
enum StatusEnum : ENUM8 {
kSuccess = 0;
kAppNotAvailable = 1;
kSystemBusy = 2;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using namespace std;
using namespace chip::app;
using namespace chip::app::Clusters::ApplicationLauncher;
using namespace chip::Uint8;

CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncoder & aEncoder)
{
Expand All @@ -34,32 +35,35 @@ CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncode
});
}

void ApplicationLauncherManager::HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const CharSpan & data,
const ApplicationLauncherApplicationType & application)
void ApplicationLauncherManager::HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const ByteSpan & data,
const ApplicationType & application)
{
// TODO: Insert code here
Commands::LauncherResponse::Type response;
response.data = chip::CharSpan::fromCharString("data");
response.status = StatusEnum::kSuccess;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}

void ApplicationLauncherManager::HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application)
const ApplicationType & application)
{
// TODO: Insert code here
Commands::LauncherResponse::Type response;
response.data = chip::CharSpan::fromCharString("data");
response.status = StatusEnum::kSuccess;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}

void ApplicationLauncherManager::HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application)
const ApplicationType & application)
{
// TODO: Insert code here
Commands::LauncherResponse::Type response;
response.data = chip::CharSpan::fromCharString("data");
response.status = StatusEnum::kSuccess;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@
#include <app/clusters/application-launcher-server/application-launcher-server.h>
#include <list>

using chip::CharSpan;
using chip::ByteSpan;
using chip::app::AttributeValueEncoder;
using chip::app::CommandResponseHelper;
using ApplicationLauncherDelegate = chip::app::Clusters::ApplicationLauncher::Delegate;
using ApplicationLauncherApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;
using ApplicationLauncherDelegate = chip::app::Clusters::ApplicationLauncher::Delegate;
using ApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::Application::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;

class ApplicationLauncherManager : public ApplicationLauncherDelegate
{
public:
CHIP_ERROR HandleGetCatalogList(AttributeValueEncoder & aEncoder) override;

void HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const CharSpan & data,
const ApplicationLauncherApplicationType & application) override;
void HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application) override;
void HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application) override;
void HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const ByteSpan & data,
const ApplicationType & application) override;
void HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper, const ApplicationType & application) override;
void HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper, const ApplicationType & application) override;
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ using namespace std;
using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::ApplicationLauncher;
using namespace chip::Uint8;

CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncoder & aEncoder)
{
Expand All @@ -35,38 +36,41 @@ CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncode
});
}

void ApplicationLauncherManager::HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const CharSpan & data,
const ApplicationLauncherApplicationType & application)
void ApplicationLauncherManager::HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const ByteSpan & data,
const ApplicationType & application)
{
ChipLogError(Zcl, "ApplicationLauncherManager::HandleLaunchApp");

// TODO: Insert code here
LauncherResponseType response;
response.data = CharSpan::fromCharString("data");
response.status = StatusEnum::kSuccess;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}

void ApplicationLauncherManager::HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application)
const ApplicationType & application)
{
ChipLogError(Zcl, "ApplicationLauncherManager::HandleStopApp");

// TODO: Insert code here
LauncherResponseType response;
response.data = CharSpan::fromCharString("data");
response.status = StatusEnum::kSuccess;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}

void ApplicationLauncherManager::HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application)
const ApplicationType & application)
{
ChipLogError(Zcl, "ApplicationLauncherManager::HandleHideApp");

// TODO: Insert code here
LauncherResponseType response;
response.data = CharSpan::fromCharString("data");
response.status = StatusEnum::kSuccess;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include <app/clusters/application-launcher-server/application-launcher-server.h>
#include <list>

using chip::CharSpan;
using chip::ByteSpan;
using chip::app::AttributeValueEncoder;
using chip::app::CommandResponseHelper;
using ApplicationLauncherDelegate = chip::app::Clusters::ApplicationLauncher::Delegate;
using ApplicationLauncherApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;
using ApplicationLauncherDelegate = chip::app::Clusters::ApplicationLauncher::Delegate;
using ApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::Application::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;

class ApplicationLauncherManager : public ApplicationLauncherDelegate
{
Expand All @@ -36,10 +36,8 @@ class ApplicationLauncherManager : public ApplicationLauncherDelegate

CHIP_ERROR HandleGetCatalogList(AttributeValueEncoder & aEncoder) override;

void HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const CharSpan & data,
const ApplicationLauncherApplicationType & application) override;
void HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application) override;
void HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application) override;
void HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const ByteSpan & data,
const ApplicationType & application) override;
void HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper, const ApplicationType & application) override;
void HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper, const ApplicationType & application) override;
};
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
NavigateTargetResponseType response;
if (target == kNoCurrentTarget || target > mTargets.size())
{
response.data = CharSpan::fromCharString("error");
// TODO: should be TARGET_NOT_FOUND
response.status = StatusEnum::kAppNotAvailable;
response.data = CharSpan::fromCharString("error");
response.status = StatusEnum::kTargetNotFound;
helper.Success(response);
return;
}
Expand Down
18 changes: 9 additions & 9 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ server cluster ApplicationLauncher = 1292 {
}

struct ApplicationEP {
ApplicationLauncherApplication application = 0;
Application application = 0;
CHAR_STRING endpoint = 1;
}

struct ApplicationLauncherApplication {
struct Application {
INT16U catalogVendorId = 0;
CHAR_STRING applicationId = 1;
}
Expand All @@ -180,21 +180,21 @@ server cluster ApplicationLauncher = 1292 {
readonly global attribute int16u clusterRevision = 65533;

request struct HideAppRequestRequest {
ApplicationLauncherApplication application = 0;
Application application = 0;
}

request struct LaunchAppRequestRequest {
CHAR_STRING data = 0;
ApplicationLauncherApplication application = 1;
Application application = 0;
OCTET_STRING data = 1;
}

request struct StopAppRequestRequest {
ApplicationLauncherApplication application = 0;
Application application = 0;
}

response struct LauncherResponse {
StatusEnum status = 0;
CHAR_STRING data = 1;
OCTET_STRING data = 1;
}

command HideAppRequest(HideAppRequestRequest): LauncherResponse = 2;
Expand Down Expand Up @@ -1671,8 +1671,8 @@ server cluster SoftwareDiagnostics = 52 {
server cluster TargetNavigator = 1285 {
enum StatusEnum : ENUM8 {
kSuccess = 0;
kAppNotAvailable = 1;
kSystemBusy = 2;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfo {
Expand Down
14 changes: 7 additions & 7 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ client cluster ApplicationLauncher = 1292 {
kLineupInfo = 0x2;
}

struct ApplicationLauncherApplication {
struct Application {
INT16U catalogVendorId = 0;
CHAR_STRING applicationId = 1;
}
Expand All @@ -163,16 +163,16 @@ client cluster ApplicationLauncher = 1292 {
readonly global attribute int16u clusterRevision = 65533;

request struct HideAppRequestRequest {
ApplicationLauncherApplication application = 0;
Application application = 0;
}

request struct LaunchAppRequestRequest {
CHAR_STRING data = 0;
ApplicationLauncherApplication application = 1;
Application application = 0;
OCTET_STRING data = 1;
}

request struct StopAppRequestRequest {
ApplicationLauncherApplication application = 0;
Application application = 0;
}

command HideAppRequest(HideAppRequestRequest): LauncherResponse = 2;
Expand Down Expand Up @@ -2409,8 +2409,8 @@ server cluster Switch = 59 {
client cluster TargetNavigator = 1285 {
enum StatusEnum : ENUM8 {
kSuccess = 0;
kAppNotAvailable = 1;
kSystemBusy = 2;
kTargetNotFound = 1;
kNotAllowed = 2;
}

struct TargetInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace app {
namespace Clusters {
namespace ApplicationLauncher {

using ApplicationLauncherApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type;
using ApplicationEPType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;
using Application = chip::app::Clusters::ApplicationLauncher::Structs::Application::Type;
using ApplicationEPType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;

/** @brief
* Defines methods for implementing application-specific logic for the Application Launcher Cluster.
Expand All @@ -57,12 +57,10 @@ class Delegate

virtual CHIP_ERROR HandleGetCatalogList(app::AttributeValueEncoder & aEncoder) = 0;

virtual void HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const CharSpan & data,
const ApplicationLauncherApplicationType & application) = 0;
virtual void HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application) = 0;
virtual void HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper,
const ApplicationLauncherApplicationType & application) = 0;
virtual void HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const ByteSpan & data,
const Application & application) = 0;
virtual void HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper, const Application & application) = 0;
virtual void HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper, const Application & application) = 0;

virtual ~Delegate() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ using namespace chip::app::Clusters::ApplicationLauncher;
#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
using namespace chip::AppPlatform;
#endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
using namespace chip::Uint8;

// -----------------------------------------------------------------------------
// Delegate Implementation
Expand Down Expand Up @@ -217,7 +218,7 @@ bool emberAfApplicationLauncherClusterLaunchAppRequestCallback(app::CommandHandl
// chip-tool can't send structs from command line so treat data value as appid if appid is blank
// TODO: fix this once chip-tool support sending structs from command line
ChipLogError(Zcl, "ApplicationLauncher blank content id, taking data as appid");
appId = std::string(data.data(), data.size());
appId = std::string((char *) data.data(), data.size());
}
CatalogVendorApp vendorApp(application.catalogVendorId, appId.c_str());

Expand All @@ -239,8 +240,9 @@ bool emberAfApplicationLauncherClusterLaunchAppRequestCallback(app::CommandHandl
{
ChipLogError(Zcl, "ApplicationLauncher target app not found");
LauncherResponseType response;
response.data = CharSpan("data", strlen("data"));
response.status = StatusEnum::kAppNotAvailable;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kAppNotAvailable;
responder.Success(response);
return true;
}
Expand Down Expand Up @@ -319,8 +321,9 @@ bool emberAfApplicationLauncherClusterStopAppRequestCallback(app::CommandHandler
{
ChipLogError(Zcl, "ApplicationLauncher target app not loaded");
LauncherResponseType response;
response.data = CharSpan("data", strlen("data"));
response.status = StatusEnum::kAppNotAvailable;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kAppNotAvailable;
responder.Success(response);
return true;
}
Expand Down Expand Up @@ -402,8 +405,9 @@ bool emberAfApplicationLauncherClusterHideAppRequestCallback(app::CommandHandler
{
ChipLogError(Zcl, "ApplicationLauncher target app not loaded");
LauncherResponseType response;
response.data = CharSpan("data", strlen("data"));
response.status = StatusEnum::kAppNotAvailable;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = StatusEnum::kAppNotAvailable;
responder.Success(response);
return true;
}
Expand Down
Loading

0 comments on commit d5d9dc7

Please sign in to comment.