diff --git a/src/app/clusters/scenes/scenes-tokens.h b/src/app/clusters/scenes/scenes-tokens.h index 40c609af301d94..d29b8208950e9c 100644 --- a/src/app/clusters/scenes/scenes-tokens.h +++ b/src/app/clusters/scenes/scenes-tokens.h @@ -55,8 +55,7 @@ // Define the actual token storage information here DEFINE_BASIC_TOKEN(SCENES_NUM_ENTRIES, uint8_t, 0x00) -DEFINE_INDEXED_TOKEN(SCENES_TABLE, EmberAfSceneTableEntry, EMBER_AF_PLUGIN_SCENES_TABLE_SIZE, - { EMBER_AF_SCENE_TABLE_UNUSED_ENDPOINT_ID }) +DEFINE_INDEXED_TOKEN(SCENES_TABLE, EmberAfSceneTableEntry, MATTER_SCENES_TABLE_SIZE, { EMBER_AF_SCENE_TABLE_UNUSED_ENDPOINT_ID }) #endif // DEFINETOKENS #endif // EMBER_AF_PLUGIN_SCENES_USE_TOKENS diff --git a/src/app/clusters/scenes/scenes.cpp b/src/app/clusters/scenes/scenes.cpp index 3a0d3324da9ec1..64c0fdfcd0a375 100644 --- a/src/app/clusters/scenes/scenes.cpp +++ b/src/app/clusters/scenes/scenes.cpp @@ -62,7 +62,7 @@ using namespace chip::app::Clusters::Scenes; uint8_t emberAfPluginScenesServerEntriesInUse = 0; #if !defined(EMBER_AF_PLUGIN_SCENES_USE_TOKENS) || defined(EZSP_HOST) -EmberAfSceneTableEntry emberAfPluginScenesServerSceneTable[EMBER_AF_PLUGIN_SCENES_TABLE_SIZE]; +EmberAfSceneTableEntry emberAfPluginScenesServerSceneTable[MATTER_SCENES_TABLE_SIZE]; #endif static bool readServerAttribute(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, const char * name, @@ -107,7 +107,7 @@ bool isEndpointInGroup(chip::FabricIndex fabricIndex, EndpointId endpoint, Group void emberAfScenesClusterServerInitCallback(EndpointId endpoint) { -#ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT +#if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT { // The high bit of Name Support indicates whether scene names are supported. uint8_t nameSupport = EMBER_BIT(7); @@ -118,7 +118,7 @@ void emberAfScenesClusterServerInitCallback(EndpointId endpoint) #if !defined(EMBER_AF_PLUGIN_SCENES_USE_TOKENS) || defined(EZSP_HOST) { uint8_t i; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { EmberAfSceneTableEntry entry; emberAfPluginScenesServerRetrieveSceneEntry(entry, i); @@ -175,8 +175,8 @@ void emAfPluginScenesServerPrintInfo(void) uint8_t i; EmberAfSceneTableEntry entry; emberAfCorePrintln("using 0x%x out of 0x%x table slots", emberAfPluginScenesServerNumSceneEntriesInUse(), - EMBER_AF_PLUGIN_SCENES_TABLE_SIZE); - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + MATTER_SCENES_TABLE_SIZE); + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { emberAfPluginScenesServerRetrieveSceneEntry(entry, i); emberAfCorePrint("%x: ", i); @@ -184,7 +184,7 @@ void emAfPluginScenesServerPrintInfo(void) { emberAfCorePrint("ep %x grp %2x scene %x tt %d", entry.endpoint, entry.groupId, entry.sceneId, entry.transitionTime); emberAfCorePrint(".%d", entry.transitionTime100ms); -#ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT +#if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT emberAfCorePrint(" name(%x)\"", emberAfStringLength(entry.name)); emberAfCorePrintString(entry.name); emberAfCorePrint("\""); @@ -261,7 +261,7 @@ bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, c else { uint8_t i; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { EmberAfSceneTableEntry entry; emberAfPluginScenesServerRetrieveSceneEntry(entry, i); @@ -316,7 +316,7 @@ bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandOb { uint8_t i; status = EMBER_ZCL_STATUS_SUCCESS; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { EmberAfSceneTableEntry entry; emberAfPluginScenesServerRetrieveSceneEntry(entry, i); @@ -436,7 +436,7 @@ bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * comman CHIP_ERROR err = CHIP_NO_ERROR; EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; uint8_t sceneCount = 0; - uint8_t sceneList[EMBER_AF_PLUGIN_SCENES_TABLE_SIZE]; + uint8_t sceneList[MATTER_SCENES_TABLE_SIZE]; emberAfScenesClusterPrintln("RX: GetSceneMembership 0x%2x", groupId); @@ -448,7 +448,7 @@ bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * comman if (status == EMBER_ZCL_STATUS_SUCCESS) { uint8_t i; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { EmberAfSceneTableEntry entry; emberAfPluginScenesServerRetrieveSceneEntry(entry, i); @@ -472,9 +472,9 @@ bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * comman SuccessOrExit(err = commandObj->PrepareCommand(path)); VerifyOrExit((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); SuccessOrExit(err = writer->Put(TLV::ContextTag(0), status)); - SuccessOrExit(err = writer->Put(TLV::ContextTag(1), - static_cast(EMBER_AF_PLUGIN_SCENES_TABLE_SIZE - - emberAfPluginScenesServerNumSceneEntriesInUse()))); + SuccessOrExit( + err = writer->Put(TLV::ContextTag(1), + static_cast(MATTER_SCENES_TABLE_SIZE - emberAfPluginScenesServerNumSceneEntriesInUse()))); SuccessOrExit(err = writer->Put(TLV::ContextTag(2), groupId)); SuccessOrExit(err = writer->Put(TLV::ContextTag(3), sceneCount)); SuccessOrExit(err = writer->Put(TLV::ContextTag(4), ByteSpan(sceneList, sceneCount))); @@ -500,7 +500,7 @@ EmberAfStatus emberAfScenesClusterStoreCurrentSceneCallback(chip::FabricIndex fa return EMBER_ZCL_STATUS_INVALID_FIELD; } - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { emberAfPluginScenesServerRetrieveSceneEntry(entry, i); if (entry.endpoint == endpoint && entry.groupId == groupId && entry.sceneId == sceneId) @@ -599,7 +599,7 @@ EmberAfStatus emberAfScenesClusterStoreCurrentSceneCallback(chip::FabricIndex fa entry.endpoint = endpoint; entry.groupId = groupId; entry.sceneId = sceneId; -#ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT +#if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT entry.name[0] = 0; #endif entry.transitionTime = 0; @@ -624,7 +624,7 @@ EmberAfStatus emberAfScenesClusterRecallSavedSceneCallback(chip::FabricIndex fab } uint8_t i; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { EmberAfSceneTableEntry entry; emberAfPluginScenesServerRetrieveSceneEntry(entry, i); @@ -772,7 +772,7 @@ bool emberAfPluginScenesServerParseAddScene( goto kickout; } - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { emberAfPluginScenesServerRetrieveSceneEntry(entry, i); if (entry.endpoint == endpoint && entry.groupId == groupId && entry.sceneId == sceneId) @@ -808,7 +808,7 @@ bool emberAfPluginScenesServerParseAddScene( entry.transitionTime100ms = 0; } -#ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT +#if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT emberAfCopyString(entry.name, sceneName, ZCL_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH); #endif @@ -1106,7 +1106,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c else { uint8_t i; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { emberAfPluginScenesServerRetrieveSceneEntry(entry, i); if (entry.endpoint == endpoint && entry.groupId == groupId && entry.sceneId == sceneId) @@ -1134,7 +1134,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c SuccessOrExit(err = writer->Put(TLV::ContextTag(3), static_cast(enhanced ? entry.transitionTime * 10 + entry.transitionTime100ms : entry.transitionTime))); -#ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT +#if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT SuccessOrExit(err = writer->Put(TLV::ContextTag(4), entry.name)); #else SuccessOrExit(err = writer->PutString(TLV::ContextTag(4), "")); @@ -1150,7 +1150,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c // command and tenths of a second in the enhanced version. emberAfPutInt16uInResp( static_cast(enhanced ? entry.transitionTime * 10 + entry.transitionTime100ms : entry.transitionTime)); - #ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT + #if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT emberAfPutStringInResp(entry.name); #else emberAfPutInt8uInResp(0); // name length @@ -1301,7 +1301,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c void emberAfScenesClusterRemoveScenesInGroupCallback(EndpointId endpoint, GroupId groupId) { uint8_t i; - for (i = 0; i < EMBER_AF_PLUGIN_SCENES_TABLE_SIZE; i++) + for (i = 0; i < MATTER_SCENES_TABLE_SIZE; i++) { EmberAfSceneTableEntry entry; emberAfPluginScenesServerRetrieveSceneEntry(entry, i); diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index 7bae467385e664..5b6f8fad769593 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -747,7 +747,7 @@ typedef struct chip::EndpointId endpoint; // 0x00 when this record is not in use chip::GroupId groupId; // 0x0000 if not associated with a group uint8_t sceneId; -#ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT +#if defined(MATTER_CLUSTER_SCENE_NAME_SUPPORT) && MATTER_CLUSTER_SCENE_NAME_SUPPORT uint8_t name[ZCL_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH + 1]; #endif uint16_t transitionTime; // in seconds diff --git a/src/app/zap-templates/templates/app/gen_config.zapt b/src/app/zap-templates/templates/app/gen_config.zapt index 6a88ddc37da67a..0e477d46dcfe8c 100644 --- a/src/app/zap-templates/templates/app/gen_config.zapt +++ b/src/app/zap-templates/templates/app/gen_config.zapt @@ -50,7 +50,24 @@ {{else if (isStrEqual name "Scenes")}} {{#if (isServer side)}} // User options for {{side}} plugin {{name}} -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif +{{/if}} +{{#all_user_cluster_generated_attributes}} +{{#if (isStrEqual ../name clusterName)}} +{{#if (isStrEqual name "FeatureMap")}} + +// Scenes FeatureMap Attribute Toggle Scenes Name feature +// App cluster specs 1.4.4 +#define MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK 0x0001 +#define MATTER_CLUSTER_SCENE_NAME_SUPPORT ({{asHex defaultValue 4}} & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) {{/if}} {{/if}} +{{/all_user_cluster_generated_attributes}} +{{/if}} + {{/all_user_clusters}} diff --git a/zzz_generated/all-clusters-app/zap-generated/gen_config.h b/zzz_generated/all-clusters-app/zap-generated/gen_config.h index 0304dba6db70c8..f35a7cf62e0b04 100644 --- a/zzz_generated/all-clusters-app/zap-generated/gen_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/gen_config.h @@ -355,7 +355,12 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif // Use this macro to check if the server side of the Software Diagnostics cluster is included #define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER diff --git a/zzz_generated/placeholder/app1/zap-generated/gen_config.h b/zzz_generated/placeholder/app1/zap-generated/gen_config.h index 86cfb87b604a93..52a903e948f539 100644 --- a/zzz_generated/placeholder/app1/zap-generated/gen_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/gen_config.h @@ -254,7 +254,12 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif // Use this macro to check if the server side of the Software Diagnostics cluster is included #define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER diff --git a/zzz_generated/placeholder/app2/zap-generated/gen_config.h b/zzz_generated/placeholder/app2/zap-generated/gen_config.h index 86cfb87b604a93..52a903e948f539 100644 --- a/zzz_generated/placeholder/app2/zap-generated/gen_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/gen_config.h @@ -254,7 +254,12 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif // Use this macro to check if the server side of the Software Diagnostics cluster is included #define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER diff --git a/zzz_generated/pump-app/zap-generated/gen_config.h b/zzz_generated/pump-app/zap-generated/gen_config.h index b1c07eb3d27686..d516a0c2ed2b06 100644 --- a/zzz_generated/pump-app/zap-generated/gen_config.h +++ b/zzz_generated/pump-app/zap-generated/gen_config.h @@ -189,7 +189,17 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif + +// Scenes FeatureMap Attribute Toggle Scenes Name feature +// App cluster specs 1.4.4 +#define MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK 0x0001 +#define MATTER_CLUSTER_SCENE_NAME_SUPPORT (0x0000 & MATTER_CLUSTER_SCENE_NAME_SUPPORT_MASK) // Use this macro to check if the server side of the Software Diagnostics cluster is included #define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER diff --git a/zzz_generated/thermostat/zap-generated/gen_config.h b/zzz_generated/thermostat/zap-generated/gen_config.h index 5787ab1505c223..6b9d78fc87b922 100644 --- a/zzz_generated/thermostat/zap-generated/gen_config.h +++ b/zzz_generated/thermostat/zap-generated/gen_config.h @@ -152,7 +152,12 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif // Use this macro to check if the server side of the Software Diagnostics cluster is included #define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER diff --git a/zzz_generated/tv-casting-app/zap-generated/gen_config.h b/zzz_generated/tv-casting-app/zap-generated/gen_config.h index 634ea86623e958..57308fdecd9ed6 100644 --- a/zzz_generated/tv-casting-app/zap-generated/gen_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/gen_config.h @@ -246,7 +246,12 @@ #define EMBER_AF_PLUGIN_SCENES_SERVER #define EMBER_AF_PLUGIN_SCENES // User options for server plugin Scenes -#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Cluster spec 1.4.8.2 +#ifdef CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#define MATTER_SCENES_TABLE_SIZE CHIP_CONFIG_MAX_SCENES_PER_FABRIC +#else +#define MATTER_SCENES_TABLE_SIZE 16 +#endif // Use this macro to check if the server side of the Software Diagnostics cluster is included #define ZCL_USING_SOFTWARE_DIAGNOSTICS_CLUSTER_SERVER