Skip to content

Commit

Permalink
Added missing checks on feature map for name support attribute in init
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Oct 27, 2023
1 parent 41aaf74 commit 0264270
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 946 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down Expand Up @@ -209,7 +209,7 @@ server cluster Scenes = 5 {
}

request struct CopySceneRequest {
ScenesCopyMode mode = 0;
CopyModeBitmap mode = 0;
group_id groupIdentifierFrom = 1;
INT8U sceneIdentifierFrom = 2;
group_id groupIdentifierTo = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
client cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -177,10 +181,6 @@ client cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down Expand Up @@ -311,7 +311,7 @@ client cluster Scenes = 5 {
}

request struct CopySceneRequest {
ScenesCopyMode mode = 0;
CopyModeBitmap mode = 0;
group_id groupIdentifierFrom = 1;
INT8U sceneIdentifierFrom = 2;
group_id groupIdentifierTo = 3;
Expand Down
10 changes: 5 additions & 5 deletions examples/lighting-app/lighting-common/lighting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down Expand Up @@ -209,7 +209,7 @@ server cluster Scenes = 5 {
}

request struct CopySceneRequest {
ScenesCopyMode mode = 0;
CopyModeBitmap mode = 0;
group_id groupIdentifierFrom = 1;
INT8U sceneIdentifierFrom = 2;
group_id groupIdentifierTo = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down Expand Up @@ -209,7 +209,7 @@ server cluster Scenes = 5 {
}

request struct CopySceneRequest {
ScenesCopyMode mode = 0;
CopyModeBitmap mode = 0;
group_id groupIdentifierFrom = 1;
INT8U sceneIdentifierFrom = 2;
group_id groupIdentifierTo = 3;
Expand Down
10 changes: 5 additions & 5 deletions examples/lighting-app/silabs/data_model/lighting-wifi-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down Expand Up @@ -209,7 +209,7 @@ server cluster Scenes = 5 {
}

request struct CopySceneRequest {
ScenesCopyMode mode = 0;
CopyModeBitmap mode = 0;
group_id groupIdentifierFrom = 1;
INT8U sceneIdentifierFrom = 2;
group_id groupIdentifierTo = 3;
Expand Down
8 changes: 4 additions & 4 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -177,10 +181,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down
8 changes: 4 additions & 4 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -177,10 +181,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ server cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
server cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -129,10 +133,6 @@ server cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3058,9 +3058,9 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE,
// Array of device types
#define FIXED_DEVICE_TYPES \
{ \
{ 0x0011, 1 }, { 0x0016, 1 }, { 0x0100, 1 }, { 0x0011, 1 }, { 0x0100, 1 }, { 0x0011, 1 }, \
{ 0x00000011, 1 }, { 0x00000016, 1 }, { 0x00000100, 1 }, { 0x00000011, 1 }, { 0x00000100, 1 }, { 0x00000011, 1 }, \
{ \
0xF002, 1 \
0x0000F002, 1 \
} \
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1186,9 +1186,9 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE,
// Array of device types
#define FIXED_DEVICE_TYPES \
{ \
{ 0x0016, 1 }, \
{ 0x00000016, 1 }, \
{ \
0x0101, 1 \
0x00000101, 1 \
} \
}

Expand Down
7 changes: 5 additions & 2 deletions src/app/clusters/scenes-server/scenes-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ CHIP_ERROR ScenesServer::Init()
if (EMBER_ZCL_STATUS_SUCCESS == status)
{
// According to spec, bit 7 MUST match feature bit 0 (SceneNames)
status = Attributes::NameSupport::Set(endpoint, NameSupportBitmap::kSceneNames);
BitMask<NameSupportBitmap> nameSupport = (featureMap & to_underlying(Feature::kSceneNames))
? BitMask<NameSupportBitmap>(NameSupportBitmap::kSceneNames)
: BitMask<NameSupportBitmap>();
status = Attributes::NameSupport::Set(endpoint, nameSupport);
if (EMBER_ZCL_STATUS_SUCCESS != status)
{
ChipLogDetail(Zcl, "ERR: setting NameSupport on Endpoint %hu Status: %x", endpoint, status);
Expand Down Expand Up @@ -846,7 +849,7 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce
sceneTable->GetRemainingCapacity(ctx.mCommandHandler.GetAccessingFabricIndex(), capacity)));

// Checks if we copy a single scene or all of them
if (req.mode.GetField(app::Clusters::Scenes::ScenesCopyMode::kCopyAllScenes))
if (req.mode.GetField(app::Clusters::Scenes::CopyModeBitmap::kCopyAllScenes))
{
// Scene Table interface data
SceneId scenesInGroup[scenes::kMaxScenesPerFabric];
Expand Down
4 changes: 2 additions & 2 deletions src/app/zap-templates/zcl/data-model/chip/scene.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
<field name="SceneNames" mask="0x80"/>
</bitmap>

<bitmap name="ScenesCopyMode" type="BITMAP8">
<bitmap name="CopyModeBitmap" type="BITMAP8">
<cluster code="0x0005"/>
<field name="CopyAllScenes" mask="0x01"/>
</bitmap>
Expand Down Expand Up @@ -139,7 +139,7 @@ limitations under the License.
<description>
Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene identifier pair.
</description>
<arg name="Mode" type="ScenesCopyMode"/>
<arg name="Mode" type="CopyModeBitmap"/>
<arg name="GroupIdentifierFrom" type="group_id"/>
<arg name="SceneIdentifierFrom" type="INT8U"/>
<arg name="GroupIdentifierTo" type="group_id"/>
Expand Down
10 changes: 5 additions & 5 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ client cluster Groups = 4 {

/** Attributes and commands for scene configuration and manipulation. */
client cluster Scenes = 5 {
bitmap CopyModeBitmap : BITMAP8 {
kCopyAllScenes = 0x1;
}

bitmap Feature : BITMAP32 {
kSceneNames = 0x1;
kExplicit = 0x2;
Expand All @@ -137,10 +141,6 @@ client cluster Scenes = 5 {
kSceneNames = 0x80;
}

bitmap ScenesCopyMode : BITMAP8 {
kCopyAllScenes = 0x1;
}

struct AttributeValuePair {
attrib_id attributeID = 0;
int32u attributeValue = 1;
Expand Down Expand Up @@ -271,7 +271,7 @@ client cluster Scenes = 5 {
}

request struct CopySceneRequest {
ScenesCopyMode mode = 0;
CopyModeBitmap mode = 0;
group_id groupIdentifierFrom = 1;
INT8U sceneIdentifierFrom = 2;
group_id groupIdentifierTo = 3;
Expand Down
6 changes: 3 additions & 3 deletions src/controller/python/chip/clusters/Objects.py

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

Loading

0 comments on commit 0264270

Please sign in to comment.