diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index 1a611500ef5db4..d162ec4bbab7ad 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -60,6 +60,10 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI { ret = app->HandleReadAttribute(clusterId, attributeMetadata->attributeId, buffer, maxReadLength); } + else + { + ret = AppPlatformExternalAttributeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); + } return ret; } @@ -78,6 +82,10 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster { ret = app->HandleWriteAttribute(clusterId, attributeMetadata->attributeId, buffer); } + else + { + ret = AppPlatformExternalAttributeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); + } return ret; } @@ -85,6 +93,20 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster namespace chip { namespace AppPlatform { +EmberAfStatus __attribute__((weak)) AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + return (EMBER_ZCL_STATUS_FAILURE); +} + +EmberAfStatus __attribute__((weak)) +AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +{ + return (EMBER_ZCL_STATUS_FAILURE); +} + EndpointId ContentAppPlatform::AddContentApp(ContentApp * app, EmberAfEndpointType * ep, const Span & dataVersionStorage, const Span & deviceTypeList) diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 69248cd431e3c7..8ab9efab8250c6 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -38,6 +38,17 @@ using BindingListType = chip::app::Clusters::Binding::Attributes::Binding::TypeI namespace chip { namespace AppPlatform { +// The AppPlatform overrides emberAfExternalAttributeReadCallback to handle external attribute reads for ContentApps. +// This callback can be used to handle external attribute reads for attributes belonging to static endpoints. +EmberAfStatus AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength); + +// The AppPlatform overrides emberAfExternalAttributeWriteCallback to handle external attribute writes for ContentApps. +// This callback can be used to handle external attribute writes for attributes belonging to static endpoints. +EmberAfStatus AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); + constexpr EndpointId kTargetBindingClusterEndpointId = 0; constexpr EndpointId kLocalVideoPlayerEndpointId = 1; constexpr EndpointId kLocalSpeakerEndpointId = 2;