Skip to content

Commit

Permalink
Remove non-namespaced command ids.
Browse files Browse the repository at this point in the history
Those fail to compile when two clusters have a command with the same name,
which is preventing us from aligning XML to the spec.
  • Loading branch information
bzbarsky-apple committed Jan 19, 2023
1 parent 57de760 commit c19539d
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 433 deletions.
1 change: 0 additions & 1 deletion examples/chef/common/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/command-id.h>

// Include door lock callbacks only when the server is enabled
#ifdef EMBER_AF_PLUGIN_DOOR_LOCK_SERVER
Expand Down
1 change: 0 additions & 1 deletion examples/chef/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app/server/Dnssd.h>
#include <app/util/af-event.h>
#include <app/util/af.h>
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/ameba/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/util/af-types.h>
#include <app/util/attribute-storage.h>
Expand Down
1 change: 0 additions & 1 deletion examples/thermostat/silabs/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/callback.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-common/zap-generated/ids/Attributes.h>
#include <app/server/OnboardingCodesUtil.h>
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/linux/include/level-control/LevelControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <app-common/zap-generated/af-structs.h>
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app-common/zap-generated/ids/Clusters.h>

using namespace chip;
Expand Down Expand Up @@ -128,7 +128,7 @@ bool emberAfLevelControlClusterStepCallback(uint8_t stepMode, uint8_t stepSize,
BitMask<LevelControl::LevelControlOptions> optionMask,
BitMask<LevelControl::LevelControlOptions> optionOverride)
{
stepHandler(ZCL_STEP_COMMAND_ID, stepMode, stepSize, transitionTime, optionMask, optionOverride);
stepHandler(LevelControl::Commands::Step:Id, stepMode, stepSize, transitionTime, optionMask, optionOverride);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "door-lock-server.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/command-id.h>
#include <app/EventLogging.h>
#include <app/server/Server.h>
#include <app/util/af-event.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app/AttributeAccessInterface.h>
#include <app/CommandHandler.h>
#include <app/server/Server.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/groups-server/groups-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/util/af.h>
Expand Down
4 changes: 3 additions & 1 deletion src/app/clusters/ias-zone-client/ias-zone-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/util/af.h>
#include <app-common/zap-generated/ids/Commands.h>

using namespace chip;
using namespace chip::app::Clusters::IasZone::Commands;

//-----------------------------------------------------------------------------
// Globals
Expand Down Expand Up @@ -282,7 +284,7 @@ bool emberAfIasZoneClusterZoneEnrollRequestCallback(app::CommandHandler * comman
setServerZoneId(serverIndex, zoneId);
}
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_CLIENT_TO_SERVER), app::Clusters::IasZone::Id,
ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID, "uu", responseCode, zoneId);
ZoneEnrollResponse::Id, "uu", responseCode, zoneId);
// Need to send this command with our source EUI because the server will
// check our EUI64 against his CIE Address to see if we're his CIE.
emberAfGetCommandApsFrame()->options |= EMBER_APS_OPTION_SOURCE_EUI64;
Expand Down
9 changes: 5 additions & 4 deletions src/app/clusters/ias-zone-server/ias-zone-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
Expand All @@ -34,6 +34,7 @@
using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::IasZone;
using namespace chip::app::Clusters::IasZone::Commands;

#define UNDEFINED_ZONE_ID 0xFF
#define DELAY_TIMER_MS (1 * MILLISECOND_TICKS_PER_SECOND)
Expand Down Expand Up @@ -171,7 +172,7 @@ static void enrollWithClient(EndpointId endpoint)
{
EmberStatus status;
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), IasZone::Id,
ZCL_ZONE_ENROLL_REQUEST_COMMAND_ID, "vv", EMBER_AF_PLUGIN_IAS_ZONE_SERVER_ZONE_TYPE,
ZoneEnrollRequest::Id, "vv", EMBER_AF_PLUGIN_IAS_ZONE_SERVER_ZONE_TYPE,
EMBER_AF_MANUFACTURER_CODE);
status = sendToClient(endpoint);
if (status == EMBER_SUCCESS)
Expand Down Expand Up @@ -354,7 +355,7 @@ static EmberStatus sendZoneUpdate(uint16_t zoneStatus, uint16_t timeSinceStatusO
return EMBER_INVALID_CALL;
}
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), IasZone::Id,
ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID, "vuuv", zoneStatus,
ZoneStatusChangeNotification::Id, "vuuv", zoneStatus,
0 /*extended status, must be zero per spec*/, emberAfPluginIasZoneServerGetZoneId(endpoint),
timeSinceStatusOccurredQs /* called "delay" in the spec */);
status = sendToClient(endpoint);
Expand Down Expand Up @@ -728,7 +729,7 @@ void emberAfIasZoneClusterServerMessageSentCallback(const MessageSendDestination
}

commandId = message[IAS_ZONE_SERVER_PAYLOAD_COMMAND_IDX];
if (commandId != ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID)
if (commandId != ZoneStatusChangeNotification::Id)
{
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/identify-server/identify-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Commands.h>
Expand Down
7 changes: 4 additions & 3 deletions src/app/clusters/scenes-client/scenes-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include <app/CommandHandler.h>
#include <app/util/af.h>

#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Commands.h>

using namespace chip;
using namespace chip::app::Clusters::Scenes::Commands;

bool emberAfScenesClusterAddSceneResponseCallback(app::CommandHandler * commandObj, uint8_t status, GroupId groupId,
uint8_t sceneId)
Expand Down Expand Up @@ -85,7 +86,7 @@ bool emberAfScenesClusterGetSceneMembershipResponseCallback(app::CommandHandler
bool emberAfPluginScenesClientParseAddSceneResponse(const EmberAfClusterCommand * cmd, uint8_t status, GroupId groupId,
uint8_t sceneId)
{
bool enhanced = (cmd->commandId == ZCL_ENHANCED_ADD_SCENE_COMMAND_ID);
bool enhanced = (cmd->commandId == EnhancedAddScene::Id);
emberAfScenesClusterPrintln("RX: %pAddSceneResponse 0x%x, 0x%2x, 0x%x", (enhanced ? "Enhanced" : ""), status, groupId, sceneId);
emberAfSendDefaultResponse(cmd, EMBER_ZCL_STATUS_SUCCESS);
return true;
Expand All @@ -95,7 +96,7 @@ bool emberAfPluginScenesClientParseViewSceneResponse(const EmberAfClusterCommand
uint8_t sceneId, uint16_t transitionTime, const uint8_t * sceneName,
const uint8_t * extensionFieldSets)
{
bool enhanced = (cmd->commandId == ZCL_ENHANCED_VIEW_SCENE_COMMAND_ID);
bool enhanced = (cmd->commandId == EnhancedViewScene::Id);

emberAfScenesClusterPrint("RX: %pViewSceneResponse 0x%x, 0x%2x, 0x%x", (enhanced ? "Enhanced" : ""), status, groupId, sceneId);

Expand Down
23 changes: 12 additions & 11 deletions src/app/clusters/scenes/scenes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
Expand All @@ -37,6 +37,7 @@
using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::Scenes;
using namespace chip::app::Clusters::Scenes::Commands;

uint8_t emberAfPluginScenesServerEntriesInUse = 0;
#if !defined(EMBER_AF_PLUGIN_SCENES_USE_TOKENS) || defined(EZSP_HOST)
Expand Down Expand Up @@ -260,7 +261,7 @@ bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, c
if (emberAfCurrentCommand()->type == EMBER_INCOMING_UNICAST || emberAfCurrentCommand()->type == EMBER_INCOMING_UNICAST_REPLY)
{
{
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_REMOVE_SCENE_RESPONSE_COMMAND_ID };
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, RemoveSceneResponse::Id };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = commandObj->PrepareCommand(path));
VerifyOrExit((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -312,7 +313,7 @@ bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandOb
if (emberAfCurrentCommand()->type == EMBER_INCOMING_UNICAST || emberAfCurrentCommand()->type == EMBER_INCOMING_UNICAST_REPLY)
{
{
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_REMOVE_ALL_SCENES_RESPONSE_COMMAND_ID };
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, RemoveAllScenesResponse::Id };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = commandObj->PrepareCommand(path));
VerifyOrExit((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -346,7 +347,7 @@ bool emberAfScenesClusterStoreSceneCallback(app::CommandHandler * commandObj, co
if (emberAfCurrentCommand()->type == EMBER_INCOMING_UNICAST || emberAfCurrentCommand()->type == EMBER_INCOMING_UNICAST_REPLY)
{
{
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_STORE_SCENE_RESPONSE_COMMAND_ID };
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, StoreSceneResponse::Id };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = commandObj->PrepareCommand(path));
VerifyOrExit((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -441,7 +442,7 @@ bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * comman
}

{
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_GET_SCENE_MEMBERSHIP_RESPONSE_COMMAND_ID };
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, GetSceneMembershipResponse::Id };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = commandObj->PrepareCommand(path));
VerifyOrExit((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -724,7 +725,7 @@ bool emberAfPluginScenesServerParseAddScene(
CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfSceneTableEntry entry;
EmberAfStatus status;
bool enhanced = (cmd->commandId == ZCL_ENHANCED_ADD_SCENE_COMMAND_ID);
bool enhanced = (cmd->commandId == EnhancedAddScene::Id);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
EndpointId endpoint = cmd->apsFrame->destinationEndpoint;
uint8_t i, index = EMBER_AF_SCENE_TABLE_NULL_INDEX;
Expand Down Expand Up @@ -1033,10 +1034,10 @@ bool emberAfPluginScenesServerParseAddScene(
return true;
}
{
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_ADD_SCENE_RESPONSE_COMMAND_ID };
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, AddSceneResponse::Id };
if (enhanced)
{
path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_ENHANCED_ADD_SCENE_RESPONSE_COMMAND_ID };
path = { emberAfCurrentEndpoint(), Scenes::Id, EnhancedAddSceneResponse::Id };
}
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = commandObj->PrepareCommand(path));
Expand All @@ -1061,7 +1062,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c
CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfSceneTableEntry entry = {};
EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND;
bool enhanced = (cmd->commandId == ZCL_ENHANCED_VIEW_SCENE_COMMAND_ID);
bool enhanced = (cmd->commandId == EnhancedViewScene::Id);
FabricIndex fabricIndex = commandObj->GetAccessingFabricIndex();
EndpointId endpoint = cmd->apsFrame->destinationEndpoint;

Expand Down Expand Up @@ -1089,10 +1090,10 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c
// The status, group id, and scene id are always included in the response, but
// the transition time, name, and extension fields are only included if the
// scene was found.
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_VIEW_SCENE_RESPONSE_COMMAND_ID };
app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), Scenes::Id, ViewSceneResponse::Id };
if (enhanced)
{
path = { emberAfCurrentEndpoint(), Scenes::Id, ZCL_ENHANCED_VIEW_SCENE_RESPONSE_COMMAND_ID };
path = { emberAfCurrentEndpoint(), Scenes::Id, EnhancedViewSceneResponse::Id };
}
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = commandObj->PrepareCommand(path));
Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/thermostat-server/thermostat-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/callback.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-common/zap-generated/ids/Attributes.h>
#include <app/CommandHandler.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/callback.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-common/zap-generated/ids/Attributes.h>
#include <app/CommandHandler.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
#include <app/reporting/reporting.h>
Expand Down
5 changes: 0 additions & 5 deletions src/app/common/templates/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
"name": "ZCL callback header",
"output": "callback.h"
},
{
"path": "../../zap-templates/templates/app/command-id.zapt",
"name": "ZCL command-id header",
"output": "command-id.h"
},
{
"path": "../../zap-templates/templates/app/enums.zapt",
"name": "ZCL enums header",
Expand Down
1 change: 0 additions & 1 deletion src/app/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "app/util/common.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/print-cluster.h>
#include <app/util/af-event.h>
Expand Down
13 changes: 0 additions & 13 deletions src/app/zap-templates/templates/app/cluster-id.zapt

This file was deleted.

19 changes: 0 additions & 19 deletions src/app/zap-templates/templates/app/command-id.zapt

This file was deleted.

Loading

0 comments on commit c19539d

Please sign in to comment.