Skip to content

Commit

Permalink
Align naming in Application Launcher cluster XML with the spec. (#24594)
Browse files Browse the repository at this point in the history
* Align naming in Application Launcher cluster XML with the spec.

Also fixes some command fields that should have been optional to actually be optional.

* Auto-update ZAP files.

* Regenerate generated code.

* Fix another build issue.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Dec 17, 2023
1 parent c0f08db commit 1030062
Show file tree
Hide file tree
Showing 56 changed files with 691 additions and 523 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3583,9 +3583,9 @@ server cluster ApplicationLauncher = 1292 {
kApplicationPlatform = 0x1;
}

struct Application {
int16u catalogVendorId = 0;
char_string applicationId = 1;
struct ApplicationStruct {
int16u catalogVendorID = 0;
char_string applicationID = 1;
}

readonly attribute INT16U catalogList[] = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19181,7 +19181,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "ApplicationEP",
"type": "ApplicationEPStruct",
"included": 0,
"storageOption": "External",
"singleton": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2928,30 +2928,30 @@ server cluster ApplicationLauncher = 1292 {
kApplicationPlatform = 0x1;
}

struct Application {
int16u catalogVendorId = 0;
char_string applicationId = 1;
struct ApplicationStruct {
int16u catalogVendorID = 0;
char_string applicationID = 1;
}

readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct LaunchAppRequest {
Application application = 0;
optional ApplicationStruct application = 0;
optional OCTET_STRING data = 1;
}

request struct StopAppRequest {
Application application = 0;
optional ApplicationStruct application = 0;
}

request struct HideAppRequest {
Application application = 0;
optional ApplicationStruct application = 0;
}

response struct LauncherResponse = 3 {
ApplicationLauncherStatusEnum status = 0;
OCTET_STRING data = 1;
optional OCTET_STRING data = 1;
}

command LaunchApp(LaunchAppRequest): LauncherResponse = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18717,7 +18717,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "ApplicationEP",
"type": "ApplicationEPStruct",
"included": 0,
"storageOption": "External",
"singleton": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using chip::ByteSpan;
using chip::app::AttributeValueEncoder;
using chip::app::CommandResponseHelper;
using ApplicationLauncherDelegate = chip::app::Clusters::ApplicationLauncher::Delegate;
using ApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::Application::Type;
using ApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;

class ApplicationLauncherManager : public ApplicationLauncherDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void ApplicationLauncherManager::HandleLaunchApp(CommandResponseHelper<LauncherR
// TODO: Insert code here
LauncherResponseType response;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = ApplicationLauncherStatusEnum::kSuccess;
response.data.SetValue(ByteSpan(from_const_char(buf), strlen(buf)));
response.status = ApplicationLauncherStatusEnum::kSuccess;
helper.Success(response);
}

Expand All @@ -57,8 +57,8 @@ void ApplicationLauncherManager::HandleStopApp(CommandResponseHelper<LauncherRes
// TODO: Insert code here
LauncherResponseType response;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = ApplicationLauncherStatusEnum::kSuccess;
response.data.SetValue(ByteSpan(from_const_char(buf), strlen(buf)));
response.status = ApplicationLauncherStatusEnum::kSuccess;
helper.Success(response);
}

Expand All @@ -70,7 +70,7 @@ void ApplicationLauncherManager::HandleHideApp(CommandResponseHelper<LauncherRes
// TODO: Insert code here
LauncherResponseType response;
const char * buf = "data";
response.data = ByteSpan(from_const_char(buf), strlen(buf));
response.status = ApplicationLauncherStatusEnum::kSuccess;
response.data.SetValue(ByteSpan(from_const_char(buf), strlen(buf)));
response.status = ApplicationLauncherStatusEnum::kSuccess;
helper.Success(response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using chip::ByteSpan;
using chip::app::AttributeValueEncoder;
using chip::app::CommandResponseHelper;
using ApplicationLauncherDelegate = chip::app::Clusters::ApplicationLauncher::Delegate;
using ApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::Application::Type;
using ApplicationType = chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type;
using LauncherResponseType = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Type;

class ApplicationLauncherManager : public ApplicationLauncherDelegate
Expand Down
20 changes: 10 additions & 10 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2050,40 +2050,40 @@ server cluster ApplicationLauncher = 1292 {
kApplicationPlatform = 0x1;
}

struct ApplicationEP {
Application application = 0;
struct ApplicationEPStruct {
ApplicationStruct application = 0;
optional endpoint_no endpoint = 1;
}

struct Application {
int16u catalogVendorId = 0;
char_string applicationId = 1;
struct ApplicationStruct {
int16u catalogVendorID = 0;
char_string applicationID = 1;
}

readonly attribute INT16U catalogList[] = 0;
attribute nullable ApplicationEP currentApp = 1;
attribute nullable ApplicationEPStruct currentApp = 1;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct LaunchAppRequest {
Application application = 0;
optional ApplicationStruct application = 0;
optional OCTET_STRING data = 1;
}

request struct StopAppRequest {
Application application = 0;
optional ApplicationStruct application = 0;
}

request struct HideAppRequest {
Application application = 0;
optional ApplicationStruct application = 0;
}

response struct LauncherResponse = 3 {
ApplicationLauncherStatusEnum status = 0;
OCTET_STRING data = 1;
optional OCTET_STRING data = 1;
}

command LaunchApp(LaunchAppRequest): LauncherResponse = 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/tv-common/tv-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -9125,7 +9125,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "ApplicationEP",
"type": "ApplicationEPStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
Expand Down Expand Up @@ -11867,7 +11867,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "ApplicationEP",
"type": "ApplicationEPStruct",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,10 +1338,10 @@ JNI_METHOD(jboolean, applicationLauncher_1launchApp)

ChipLogProgress(AppServer, "JNI_METHOD applicationLauncher_launchApp called");

chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application;
application.catalogVendorId = static_cast<uint16_t>(catalogVendorId);
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application;
application.catalogVendorID = static_cast<uint16_t>(catalogVendorId);
const char * nativeApplicationId = env->GetStringUTFChars(applicationId, 0);
application.applicationId = CharSpan::fromCharString(nativeApplicationId);
application.applicationID = CharSpan::fromCharString(nativeApplicationId);
JniByteArray dataByteArray(env, data);

TargetEndpointInfo endpoint;
Expand Down Expand Up @@ -1377,10 +1377,10 @@ JNI_METHOD(jboolean, applicationLauncher_1stopApp)

ChipLogProgress(AppServer, "JNI_METHOD applicationLauncher_stopApp called");

chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application;
application.catalogVendorId = static_cast<uint16_t>(catalogVendorId);
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application;
application.catalogVendorID = static_cast<uint16_t>(catalogVendorId);
const char * nativeApplicationId = env->GetStringUTFChars(applicationId, 0);
application.applicationId = CharSpan::fromCharString(nativeApplicationId);
application.applicationID = CharSpan::fromCharString(nativeApplicationId);

TargetEndpointInfo endpoint;
CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint);
Expand Down Expand Up @@ -1415,10 +1415,10 @@ JNI_METHOD(jboolean, applicationLauncher_1hideApp)

ChipLogProgress(AppServer, "JNI_METHOD applicationLauncher_hideApp called");

chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application;
application.catalogVendorId = static_cast<uint16_t>(catalogVendorId);
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application;
application.catalogVendorID = static_cast<uint16_t>(catalogVendorId);
const char * nativeApplicationId = env->GetStringUTFChars(applicationId, 0);
application.applicationId = CharSpan::fromCharString(nativeApplicationId);
application.applicationID = CharSpan::fromCharString(nativeApplicationId);

TargetEndpointInfo endpoint;
CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1493,9 +1493,9 @@ - (void)applicationLauncher_launchApp:(ContentApp * _Nonnull)contentApp

[_commandResponseCallbacks setObject:responseCallback forKey:@"applicationLauncher_launchApp"];

chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application;
application.catalogVendorId = catalogVendorId;
application.applicationId = chip::CharSpan::fromCharString([applicationId UTF8String]);
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application;
application.catalogVendorID = catalogVendorId;
application.applicationID = chip::CharSpan::fromCharString([applicationId UTF8String]);

dispatch_async(_chipWorkQueue, ^{
TargetEndpointInfo endpoint;
Expand Down Expand Up @@ -1525,9 +1525,9 @@ - (void)applicationLauncher_stopApp:(ContentApp * _Nonnull)contentApp

[_commandResponseCallbacks setObject:responseCallback forKey:@"applicationLauncher_stopApp"];

chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application;
application.catalogVendorId = catalogVendorId;
application.applicationId = chip::CharSpan::fromCharString([applicationId UTF8String]);
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application;
application.catalogVendorID = catalogVendorId;
application.applicationID = chip::CharSpan::fromCharString([applicationId UTF8String]);

dispatch_async(_chipWorkQueue, ^{
TargetEndpointInfo endpoint;
Expand Down Expand Up @@ -1556,9 +1556,9 @@ - (void)applicationLauncher_hideApp:(ContentApp * _Nonnull)contentApp

[_commandResponseCallbacks setObject:responseCallback forKey:@"applicationLauncher_hideApp"];

chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application;
application.catalogVendorId = catalogVendorId;
application.applicationId = chip::CharSpan::fromCharString([applicationId UTF8String]);
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application;
application.catalogVendorID = catalogVendorId;
application.applicationID = chip::CharSpan::fromCharString([applicationId UTF8String]);

dispatch_async(_chipWorkQueue, ^{
TargetEndpointInfo endpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LaunchAppCommand
public:
LaunchAppCommand() : MediaCommandBase(chip::app::Clusters::ApplicationLauncher::Id) {}

CHIP_ERROR Invoke(chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
CHIP_ERROR Invoke(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
chip::Optional<chip::ByteSpan> data, std::function<void(CHIP_ERROR)> responseCallback);
};

Expand All @@ -40,7 +40,7 @@ class StopAppCommand : public MediaCommandBase<chip::app::Clusters::ApplicationL
public:
StopAppCommand() : MediaCommandBase(chip::app::Clusters::ApplicationLauncher::Id) {}

CHIP_ERROR Invoke(chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
CHIP_ERROR Invoke(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback);
};

Expand All @@ -50,7 +50,7 @@ class HideAppCommand : public MediaCommandBase<chip::app::Clusters::ApplicationL
public:
HideAppCommand() : MediaCommandBase(chip::app::Clusters::ApplicationLauncher::Id) {}

CHIP_ERROR Invoke(chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
CHIP_ERROR Invoke(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ class CastingServer
* @brief Application Launcher cluster
*/
CHIP_ERROR ApplicationLauncher_LaunchApp(TargetEndpointInfo * endpoint,
chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
chip::Optional<chip::ByteSpan> data, std::function<void(CHIP_ERROR)> responseCallback);
CHIP_ERROR ApplicationLauncher_StopApp(TargetEndpointInfo * endpoint,
chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback);
CHIP_ERROR ApplicationLauncher_HideApp(TargetEndpointInfo * endpoint,
chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback);

CHIP_ERROR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@
using namespace chip;
using namespace chip::app::Clusters;

CHIP_ERROR LaunchAppCommand::Invoke(chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
CHIP_ERROR LaunchAppCommand::Invoke(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
chip::Optional<chip::ByteSpan> data, std::function<void(CHIP_ERROR)> responseCallback)
{
ApplicationLauncher::Commands::LaunchApp::Type request;
request.application = application;
request.data = data;
request.application.SetValue(application);
request.data = data;
return MediaCommandBase::Invoke(request, responseCallback);
}

CHIP_ERROR StopAppCommand::Invoke(chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
CHIP_ERROR StopAppCommand::Invoke(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback)
{
ApplicationLauncher::Commands::StopApp::Type request;
request.application = application;
request.application.SetValue(application);
return MediaCommandBase::Invoke(request, responseCallback);
}

CHIP_ERROR HideAppCommand::Invoke(chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
CHIP_ERROR HideAppCommand::Invoke(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback)
{
ApplicationLauncher::Commands::HideApp::Type request;
request.application = application;
request.application.SetValue(application);
return MediaCommandBase::Invoke(request, responseCallback);
}
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ CHIP_ERROR CastingServer::MediaPlayback_SubscribeToSeekRangeStart(
*/
CHIP_ERROR
CastingServer::ApplicationLauncher_LaunchApp(TargetEndpointInfo * endpoint,
chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
chip::Optional<chip::ByteSpan> data, std::function<void(CHIP_ERROR)> responseCallback)
{
ReturnErrorOnFailure(mLaunchAppCommand.SetTarget(mActiveTargetVideoPlayerInfo, endpoint->GetEndpointId()));
Expand All @@ -787,7 +787,7 @@ CastingServer::ApplicationLauncher_LaunchApp(TargetEndpointInfo * endpoint,

CHIP_ERROR
CastingServer::ApplicationLauncher_StopApp(TargetEndpointInfo * endpoint,
chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback)
{
ReturnErrorOnFailure(mStopAppCommand.SetTarget(mActiveTargetVideoPlayerInfo, endpoint->GetEndpointId()));
Expand All @@ -796,7 +796,7 @@ CastingServer::ApplicationLauncher_StopApp(TargetEndpointInfo * endpoint,

CHIP_ERROR
CastingServer::ApplicationLauncher_HideApp(TargetEndpointInfo * endpoint,
chip::app::Clusters::ApplicationLauncher::Structs::Application::Type application,
chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application,
std::function<void(CHIP_ERROR)> responseCallback)
{
ReturnErrorOnFailure(mHideAppCommand.SetTarget(mActiveTargetVideoPlayerInfo, endpoint->GetEndpointId()));
Expand Down
Loading

0 comments on commit 1030062

Please sign in to comment.