Skip to content

Commit

Permalink
Remove manufacturer code from external attibute APIs.
Browse files Browse the repository at this point in the history
Matter manufacturer codes go directly inside ids.
  • Loading branch information
bzbarsky-apple committed Jan 14, 2022
1 parent b42655a commit 319df14
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 148 deletions.
7 changes: 3 additions & 4 deletions examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ EmberAfStatus HandleWriteOnOffAttribute(Device * dev, chip::AttributeId attribut
}

EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
uint8_t * buffer, uint16_t maxReadLength)
EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength)
{
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);

Expand All @@ -284,8 +284,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI
}

EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
uint8_t * buffer)
EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
{
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);

Expand Down
7 changes: 3 additions & 4 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ EmberAfStatus HandleReadSwitchAttribute(DeviceSwitch * dev, chip::AttributeId at
}

EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
uint8_t * buffer, uint16_t maxReadLength)
EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength)
{
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);

Expand Down Expand Up @@ -485,8 +485,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI
}

EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
uint8_t * buffer)
EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
{
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);

Expand Down
7 changes: 3 additions & 4 deletions src/app/util/ContentAppPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ using namespace chip::AppPlatform;
#define DEVICE_VERSION_DEFAULT 1

EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
uint8_t * buffer, uint16_t maxReadLength)
EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength)
{
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);

Expand All @@ -62,8 +62,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI
}

EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
uint8_t * buffer)
EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
{
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);

Expand Down
14 changes: 6 additions & 8 deletions src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord,
src = buffer;
dst = attributeLocation;
if (!emberAfAttributeWriteAccessCallback(attRecord->endpoint, attRecord->clusterId,
EMBER_AF_NULL_MANUFACTURER_CODE, am->attributeId))
am->attributeId))
{
return EMBER_ZCL_STATUS_NOT_AUTHORIZED;
}
Expand All @@ -563,7 +563,7 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord,
src = attributeLocation;
dst = buffer;
if (!emberAfAttributeReadAccessCallback(attRecord->endpoint, attRecord->clusterId,
EMBER_AF_NULL_MANUFACTURER_CODE, am->attributeId))
am->attributeId))
{
return EMBER_ZCL_STATUS_NOT_AUTHORIZED;
}
Expand All @@ -572,12 +572,10 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord,
// Is the attribute externally stored?
if (am->mask & ATTRIBUTE_MASK_EXTERNAL_STORAGE)
{
return (write
? emberAfExternalAttributeWriteCallback(attRecord->endpoint, attRecord->clusterId,
am, EMBER_AF_NULL_MANUFACTURER_CODE, buffer)
: emberAfExternalAttributeReadCallback(attRecord->endpoint, attRecord->clusterId,
am, EMBER_AF_NULL_MANUFACTURER_CODE, buffer,
emberAfAttributeSize(am)));
return (write ? emberAfExternalAttributeWriteCallback(attRecord->endpoint, attRecord->clusterId,
am, buffer)
: emberAfExternalAttributeReadCallback(attRecord->endpoint, attRecord->clusterId,
am, buffer, emberAfAttributeSize(am)));
}
else
{
Expand Down
10 changes: 4 additions & 6 deletions src/app/zap-templates/templates/app/callback-stub-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ EmberAfAttributeWritePermission __attribute__((weak)) emberAfAllowNetworkWriteAt
}

bool __attribute__((weak)) emberAfAttributeReadAccessCallback(
EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode,
AttributeId attributeId)
EndpointId endpoint, ClusterId clusterId, AttributeId attributeId)
{
return true;
}

bool __attribute__((weak)) emberAfAttributeWriteAccessCallback(
EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode,
AttributeId attributeId)
EndpointId endpoint, ClusterId clusterId, AttributeId attributeId)
{
return true;
}
Expand All @@ -83,15 +81,15 @@ bool __attribute__((weak)) emberAfMessageSentCallback(

EmberAfStatus __attribute__((weak)) emberAfExternalAttributeReadCallback(
EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength)
{
return EMBER_ZCL_STATUS_FAILURE;
}

EmberAfStatus __attribute__((weak)) emberAfExternalAttributeWriteCallback(
EndpointId endpoint, ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer)
{
return EMBER_ZCL_STATUS_FAILURE;
Expand Down
10 changes: 4 additions & 6 deletions src/app/zap-templates/templates/app/callback.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,14 @@ EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::
* This function is called whenever the Application Framework needs to check
* access permission for an attribute read.
*/
bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
chip::AttributeId attributeId);
bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId);

/** @brief Attribute Write Access
*
* This function is called whenever the Application Framework needs to check
* access permission for an attribute write.
*/
bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
chip::AttributeId attributeId);
bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId);

/** @brief Default Response
*
Expand Down Expand Up @@ -309,7 +307,7 @@ bool emberAfMessageSentCallback(const chip::MessageSendDestination & destination
* application was not able to read the attribute.
*/
EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength);

/** @brief External Attribute Write
Expand Down Expand Up @@ -353,7 +351,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, ch
* attribute.
*/
EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer);

/** @brief Get Current Time
Expand Down
10 changes: 4 additions & 6 deletions zzz_generated/all-clusters-app/zap-generated/callback-stub.cpp

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

13 changes: 5 additions & 8 deletions zzz_generated/app-common/app-common/zap-generated/callback.h

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

10 changes: 4 additions & 6 deletions zzz_generated/bridge-app/zap-generated/callback-stub.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.

10 changes: 4 additions & 6 deletions zzz_generated/door-lock-app/zap-generated/callback-stub.cpp

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

Loading

0 comments on commit 319df14

Please sign in to comment.