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

[Scenes] Removal of Optional for AttributeId #27509

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 @@ -159,7 +159,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ client cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/lighting-common/lighting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/thermostat/thermostat-common/thermostat.matter
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ server cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
10 changes: 3 additions & 7 deletions src/app/clusters/on-off-server/on-off-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl

AttributeValuePair pairs[scenableAttributeCount];

pairs[0].attributeID.SetValue(Attributes::OnOff::Id);
pairs[0].attributeID = Attributes::OnOff::Id;
pairs[0].attributeValue = currentValue;

app::DataModel::List<AttributeValuePair> attributeValueList(pairs);
Expand Down Expand Up @@ -230,11 +230,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl
while (pair_iterator.Next())
{
auto & decodePair = pair_iterator.GetValue();
if (decodePair.attributeID.HasValue())
{
// If attribute ID was encoded, verify it is the proper ID for the OnOff attribute
VerifyOrReturnError(decodePair.attributeID.Value() == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT);
}
VerifyOrReturnError(decodePair.attributeID == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT);
ReturnErrorOnFailure(
mSceneEndpointStatePairs.InsertPair(EndpointStatePair(endpoint, static_cast<bool>(decodePair.attributeValue))));
}
Expand Down Expand Up @@ -545,7 +541,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint)

#ifdef EMBER_AF_PLUGIN_SCENES
// Registers Scene handlers for the On/Off cluster on the server
// app::Clusters::Scenes::ScenesServer::Instance().RegisterSceneHandler(OnOffServer::Instance().GetSceneHandler());
app::Clusters::Scenes::ScenesServer::Instance().RegisterSceneHandler(OnOffServer::Instance().GetSceneHandler());
#endif

#ifdef EMBER_AF_PLUGIN_MODE_SELECT
Expand Down
26 changes: 13 additions & 13 deletions src/app/tests/TestSceneTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,29 +494,29 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext)
static const uint16_t LC_av_payload[2] = { 0x64, 0x01F0 };
static const uint16_t CC_av_payload[8] = { 0 };

OOPairs[0].attributeID.SetValue(kOnOffAttId);
OOPairs[0].attributeID = kOnOffAttId;
OOPairs[0].attributeValue = OO_av_payload;

LCPairs[0].attributeID.SetValue(kCurrentLevelId);
LCPairs[0].attributeID = kCurrentLevelId;
LCPairs[0].attributeValue = LC_av_payload[0];
LCPairs[1].attributeID.SetValue(kCurrentFrequencyId);
LCPairs[1].attributeID = kCurrentFrequencyId;
LCPairs[1].attributeValue = LC_av_payload[1];

CCPairs[0].attributeID.SetValue(kCurrentSaturationId);
CCPairs[0].attributeID = kCurrentSaturationId;
CCPairs[0].attributeValue = CC_av_payload[0];
CCPairs[1].attributeID.SetValue(kCurrentXId);
CCPairs[1].attributeID = kCurrentXId;
CCPairs[1].attributeValue = CC_av_payload[1];
CCPairs[2].attributeID.SetValue(kCurrentYId);
CCPairs[2].attributeID = kCurrentYId;
CCPairs[2].attributeValue = CC_av_payload[2];
CCPairs[3].attributeID.SetValue(kColorTemperatureMiredsId);
CCPairs[3].attributeID = kColorTemperatureMiredsId;
CCPairs[3].attributeValue = CC_av_payload[3];
CCPairs[4].attributeID.SetValue(kEnhancedCurrentHueId);
CCPairs[4].attributeID = kEnhancedCurrentHueId;
CCPairs[4].attributeValue = CC_av_payload[4];
CCPairs[5].attributeID.SetValue(kColorLoopActiveId);
CCPairs[5].attributeID = kColorLoopActiveId;
CCPairs[5].attributeValue = CC_av_payload[5];
CCPairs[6].attributeID.SetValue(kColorLoopDirectionId);
CCPairs[6].attributeID = kColorLoopDirectionId;
CCPairs[6].attributeValue = CC_av_payload[6];
CCPairs[7].attributeID.SetValue(kColorLoopTimeId);
CCPairs[7].attributeID = kColorLoopTimeId;
CCPairs[7].attributeValue = CC_av_payload[7];

// Initialize Extension Field sets as if they were received by add commands
Expand Down Expand Up @@ -637,7 +637,6 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext)
app::Clusters::Scenes::Structs::AttributeValuePair::Type TooManyPairs[16];

uint8_t payloadOk = 0;

for (uint8_t i = 0; i < 16; i++)
{
TooManyPairs[i].attributeValue = payloadOk;
Expand All @@ -646,7 +645,8 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext)
extensionFieldFailTestOut.clusterID = kColorControlClusterId;
extensionFieldFailTestOut.attributeValueList = TooManyPairs;

uint8_t failBuffer[scenes::kMaxFieldBytesPerCluster] = { 0 };
// Give a bigger buffer given we are using too many pairs on purpose
uint8_t failBuffer[2 * scenes::kMaxFieldBytesPerCluster] = { 0 };
ByteSpan fail_list(failBuffer);

// Serialize Extension Field sets as if they were recovered from memory
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/data-model/chip/scene.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.

<struct name="AttributeValuePair">
<cluster code="0x0005"/>
<item name="AttributeID" type="attrib_id" optional="true"/>
<item name="AttributeID" type="attrib_id" optional="false"/>
<item name="AttributeValue" type="INT32U" optional="false"/>
</struct>

Expand Down
2 changes: 1 addition & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ client cluster Scenes = 5 {
}

struct AttributeValuePair {
optional attrib_id attributeID = 0;
attrib_id attributeID = 0;
int32u attributeValue = 1;
}

Expand Down
46 changes: 12 additions & 34 deletions src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp

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

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

4 changes: 2 additions & 2 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.

10 changes: 2 additions & 8 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

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

10 changes: 2 additions & 8 deletions src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm

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

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

Loading