Skip to content

Commit

Permalink
Stop generating attribute accessors for AttributeAccessInterface-only…
Browse files Browse the repository at this point in the history
… attributes. (#26279)

Those accessors can't work correctly and are just a bug waiting to happen if
someone tries to use them.

The code in the Infineon examples that did ManufacturingDate::Set was not really
doing anything useful, since the attribute value is read from
GetDeviceInstanceInfoProvider()->GetManufacturingDate() in the Basic Information
cluster implementation anyway, ignoring the attribute store.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jan 5, 2024
1 parent 481ac72 commit 077ecb2
Show file tree
Hide file tree
Showing 12 changed files with 1,605 additions and 6,703 deletions.
14 changes: 0 additions & 14 deletions examples/light-switch-app/infineon/cyw30739/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::DeviceLayer;

void emberAfBasicInformationClusterInitCallback(EndpointId endpoint)
{
uint16_t year;
uint8_t month;
uint8_t dayOfMonth;
char cString[16] = "00000000";

if (GetDeviceInstanceInfoProvider()->GetManufacturingDate(year, month, dayOfMonth) == CHIP_NO_ERROR)
{
snprintf(cString, sizeof(cString), "%04u%02u%02u", year, month, dayOfMonth);
}
BasicInformation::Attributes::ManufacturingDate::Set(endpoint, CharSpan(cString));
}

void MatterPostAttributeChangeCallback(const app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
Expand Down
14 changes: 0 additions & 14 deletions examples/lighting-app/infineon/cyw30739/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,6 @@ using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::DeviceLayer;

void emberAfBasicInformationClusterInitCallback(EndpointId endpoint)
{
uint16_t year;
uint8_t month;
uint8_t dayOfMonth;
char cString[16] = "00000000";

if (GetDeviceInstanceInfoProvider()->GetManufacturingDate(year, month, dayOfMonth) == CHIP_NO_ERROR)
{
snprintf(cString, sizeof(cString), "%04u%02u%02u", year, month, dayOfMonth);
}
BasicInformation::Attributes::ManufacturingDate::Set(endpoint, CharSpan(cString));
}

void MatterPostAttributeChangeCallback(const app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)

Expand Down
14 changes: 0 additions & 14 deletions examples/lock-app/infineon/cyw30739/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@ using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::DeviceLayer;

void emberAfBasicInformationClusterInitCallback(EndpointId endpoint)
{
uint16_t year;
uint8_t month;
uint8_t dayOfMonth;
char cString[16] = "00000000";

if (GetDeviceInstanceInfoProvider()->GetManufacturingDate(year, month, dayOfMonth) == CHIP_NO_ERROR)
{
snprintf(cString, sizeof(cString), "%04u%02u%02u", year, month, dayOfMonth);
}
BasicInformation::Attributes::ManufacturingDate::Set(endpoint, CharSpan(cString));
}

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-cert-bins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ARG COMMITHASH=7b99e6399c6069037c613782d78132c69b9dcabb
# ZAP Development install, so that it runs on both x64 and arm64
# Generally this should match with the ZAP version that is used for codegen within the
# specified SHA
ARG ZAP_VERSION=v2023.04.21-nightly
ARG ZAP_VERSION=v2023.04.27-nightly

# Ensure TARGETPLATFORM is set
RUN case ${TARGETPLATFORM} in \
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup/zap.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mac-arm64",
"windows-amd64"
],
"tags": ["version:[email protected].21-nightly.1"]
"tags": ["version:[email protected].27-nightly.1"]
}
]
}
2 changes: 1 addition & 1 deletion scripts/tools/zap/zap_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Use scripts/tools/zap/version_update.py to manage ZAP versioning as many
# files may need updating for versions
#
MIN_ZAP_VERSION = '2023.4.21'
MIN_ZAP_VERSION = '2023.4.27'


class ZapTool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ namespace {{asUpperCamelCase parent.label}} {
namespace Attributes {

{{/first}}
{{#unless (isStrEqual storagePolicy "attributeAccessInterface")}}
{{#if_is_struct type}}
{{else if (canHaveSimpleAccessors this)}}
#error Attribute "{{name}}" in cluster "{{../name}}" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json
{{/if_is_struct}}
namespace {{asUpperCamelCase label}} {

{{#*inline "clusterId"}}Clusters::{{asUpperCamelCase parent.label}}::Id{{/inline}}
Expand Down Expand Up @@ -133,7 +135,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectTy

} // namespace {{asUpperCamelCase label}}

{{/if_is_struct}}
{{/unless}}
{{#last}}
} // namespace Attributes
} // {{asUpperCamelCase parent.label}}
Expand Down
5 changes: 2 additions & 3 deletions src/app/zap-templates/templates/app/attributes/Accessors.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ namespace {{asUpperCamelCase parent.label}} {
namespace Attributes {

{{/first}}
{{#if_is_struct type}}
{{else if (canHaveSimpleAccessors this)}}
{{#unless (isStrEqual storagePolicy "attributeAccessInterface")}}
namespace {{asUpperCamelCase label}} {
EmberAfStatus Get(chip::EndpointId endpoint, {{accessorGetterType this}} value); // {{type}}
EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotNullable=true forceNotOptional=true}} value);
Expand All @@ -34,7 +33,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectTy
{{/if}}
} // namespace {{asUpperCamelCase label}}

{{/if_is_struct}}
{{/unless}}
{{#last}}
} // namespace Attributes
} // {{asUpperCamelCase parent.label}}
Expand Down
6 changes: 5 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@
"PacketUnicastTxCount",
"CurrentMaxRate",
"OverrunCount"
]
],
"Channel": ["Lineup", "CurrentChannel"],
"Media Playback": ["SampledPosition"],
"Application Launcher": ["CurrentApp"],
"Application Basic": ["Application"]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
6 changes: 5 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,11 @@
"PacketUnicastTxCount",
"CurrentMaxRate",
"OverrunCount"
]
],
"Channel": ["Lineup", "CurrentChannel"],
"Media Playback": ["SampledPosition"],
"Application Launcher": ["CurrentApp"],
"Application Basic": ["Application"]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
Loading

0 comments on commit 077ecb2

Please sign in to comment.