Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ApplicationBasicStatus to an enum class. #12500

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@

#pragma once

#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/cluster-objects.h>

struct Application
{
char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t catalogVendorId = 0;
EmberAfApplicationBasicStatus status = EMBER_ZCL_APPLICATION_BASIC_STATUS_STOPPED;
using ApplicationBasicStatus = chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus;
char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t catalogVendorId = 0;
ApplicationBasicStatus status = ApplicationBasicStatus::kStopped;
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/enums.h>
#include <app/Command.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <lib/support/TypeTraits.h>
#include <lib/support/ZclString.h>

#include <inipp/inipp.h>
Expand Down Expand Up @@ -153,9 +154,10 @@ Application ApplicationBasicManager::getApplicationForEndpoint(chip::EndpointId
return app;
}

bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, chip::EndpointId endpoint)
bool applicationBasicClusterChangeApplicationStatus(app::Clusters::ApplicationBasic::ApplicationBasicStatus status,
chip::EndpointId endpoint)
{
// TODO: Insert code here
ChipLogProgress(Zcl, "Sent an application status change request %d for endpoint %d", status, endpoint);
ChipLogProgress(Zcl, "Sent an application status change request %d for endpoint %d", to_underlying(status), endpoint);
return true;
}
18 changes: 10 additions & 8 deletions examples/tv-app/linux/include/application-basic/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@

#pragma once

#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/cluster-objects.h>

struct Application
{
char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t catalogVendorId = 0;
EmberAfApplicationBasicStatus status = EMBER_ZCL_APPLICATION_BASIC_STATUS_STOPPED;
using ApplicationBasicStatus = chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus;

char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t catalogVendorId = 0;
ApplicationBasicStatus status = ApplicationBasicStatus::kStopped;
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/enums.h>
#include <app/Command.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <lib/support/TypeTraits.h>
#include <lib/support/ZclString.h>

#include <inipp/inipp.h>
Expand Down Expand Up @@ -153,9 +154,10 @@ Application ApplicationBasicManager::getApplicationForEndpoint(chip::EndpointId
return app;
}

bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, chip::EndpointId endpoint)
bool applicationBasicClusterChangeApplicationStatus(app::Clusters::ApplicationBasic::ApplicationBasicStatus status,
chip::EndpointId endpoint)
{
// TODO: Insert code here
ChipLogProgress(Zcl, "Sent an application status change request %d for endpoint %d", status, endpoint);
ChipLogProgress(Zcl, "Sent an application status change request %d for endpoint %d", to_underlying(status), endpoint);
return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@
using namespace chip;
using namespace chip::app::Clusters::ApplicationBasic;

bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, EndpointId endpoint);
bool applicationBasicClusterChangeApplicationStatus(ApplicationBasicStatus status, EndpointId endpoint);

bool emberAfApplicationBasicClusterChangeStatusCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath,
const Commands::ChangeStatus::DecodableType & commandData)
{
auto & newApplicationStatus = commandData.status;

bool success = applicationBasicClusterChangeApplicationStatus(static_cast<EmberAfApplicationBasicStatus>(newApplicationStatus),
emberAfCurrentEndpoint());
bool success = applicationBasicClusterChangeApplicationStatus(newApplicationStatus, emberAfCurrentEndpoint());
EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE;
emberAfSendImmediateDefaultResponse(status);
return true;
Expand Down
1 change: 0 additions & 1 deletion src/app/zap-templates/templates/app/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ async function getResponseCommandName(responseRef, options)
function isWeaklyTypedEnum(label)
{
return [
"ApplicationBasicStatus",
"ApplicationLauncherStatus",
"AttributeWritePermission",
"AudioOutputType",
Expand Down

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

9 changes: 0 additions & 9 deletions zzz_generated/app-common/app-common/zap-generated/enums.h

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