Skip to content

Commit

Permalink
Remove AttributeWritePermission from types-silabs.xml and makes it a …
Browse files Browse the repository at this point in the history
…not generated enum (#24926)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jul 28, 2023
1 parent cd01632 commit 5642833
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/app/common/templates/weak-enum-list.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Allow-list of enums that we generate as enums, not enum classes. The goal is
# to drive this down to 0.
- AttributeWritePermission
- BarrierControlBarrierPosition
- BarrierControlMovingState
- ColorControlOptions
Expand Down
11 changes: 11 additions & 0 deletions src/app/util/attribute-metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ union EmberAfDefaultOrMinMaxAttributeValue
const EmberAfAttributeMinMaxValue * ptrToMinMaxValue;
};

enum class EmberAfAttributeWritePermission
{
DenyWrite = 0,
AllowWriteNormal = 1,
AllowWriteOfReadOnly = 2,
UnsupportedAttribute = 0x86, // Protocols::InteractionModel::Status::UnsupportedAttribute
InvalidValue = 0x87, // Protocols::InteractionModel::Status::ConstraintError
ReadOnly = 0x88, // Protocols::InteractionModel::Status::UnsupportedWrite
InvalidDataType = 0x8d, // Protocols::InteractionModel::Status::InvalidDataType
};

// Attribute masks modify how attributes are used by the framework
//
// Attribute that has this mask is NOT read-only
Expand Down
8 changes: 4 additions & 4 deletions src/app/util/attribute-table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ EmberAfStatus emberAfWriteAttributeExternal(EndpointId endpoint, ClusterId clust
emberAfAllowNetworkWriteAttributeCallback(endpoint, cluster, attributeID, dataPtr, dataType);
switch (extWritePermission)
{
case EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_DENY_WRITE:
case EmberAfAttributeWritePermission::DenyWrite:
return EMBER_ZCL_STATUS_FAILURE;
case EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL:
case EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_OF_READ_ONLY:
case EmberAfAttributeWritePermission::AllowWriteNormal:
case EmberAfAttributeWritePermission::AllowWriteOfReadOnly:
return emAfWriteAttribute(endpoint, cluster, attributeID, dataPtr, dataType,
(extWritePermission == EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_OF_READ_ONLY), false);
(extWritePermission == EmberAfAttributeWritePermission::AllowWriteOfReadOnly), false);
default:
return (EmberAfStatus) extWritePermission;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/util/generic-callback-stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ EmberAfAttributeWritePermission __attribute__((weak))
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t * value,
uint8_t type)
{
return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default
return EmberAfAttributeWritePermission::AllowWriteNormal; // Default
}

bool __attribute__((weak)) emberAfAttributeReadAccessCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId)
Expand Down
9 changes: 0 additions & 9 deletions src/app/zap-templates/zcl/data-model/silabs/types-silabs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ limitations under the License.
<item name="NoSourceFound" value="0x0"/>
<item name="SourceFound" value="0x1"/>
</enum>
<enum name="AttributeWritePermission" type="ENUM8">
<item name="DenyWrite" value="0x00"/>
<item name="AllowWriteNormal" value="0x01"/>
<item name="AllowWriteOfReadOnly" value="0x02"/>
<item name="UnsupportedAttribute" value="0x86"/>
<item name="InvalidValue" value="0x87"/>
<item name="ReadOnly" value="0x88"/>
<item name="InvalidDataType" value="0x8D"/>
</enum>
<struct name="Notification">
<item name="contentId" type="INT16U"/>
<item name="statusFeedback" type="ENUM8"/>
Expand Down
12 changes: 0 additions & 12 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.

0 comments on commit 5642833

Please sign in to comment.