Ember attribute storage API surface simplification (#31611)
* Remove more unused defines and declarations
* Restyle
* Remove support for include overrides
* Add extra space, to not re-order include (not sure if include ordering matters here)
* Remove duplicated include
* Remove more macros that were syntaxed to look like functions
diff --git a/src/app/clusters/barrier-control-server/barrier-control-server.cpp b/src/app/clusters/barrier-control-server/barrier-control-server.cpp
index 8d1cedc..e4e72ee 100644
--- a/src/app/clusters/barrier-control-server/barrier-control-server.cpp
+++ b/src/app/clusters/barrier-control-server/barrier-control-server.cpp
@@ -74,15 +74,6 @@
} State;
static State state;
-#ifdef EMBER_SCRIPTED_TEST
-#define ZCL_USING_BARRIER_CONTROL_CLUSTER_OPEN_PERIOD_ATTRIBUTE
-#define ZCL_USING_BARRIER_CONTROL_CLUSTER_CLOSE_PERIOD_ATTRIBUTE
-#define ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_OPEN_EVENTS_ATTRIBUTE
-#define ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_CLOSE_EVENTS_ATTRIBUTE
-#define ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_COMMAND_OPEN_EVENTS_ATTRIBUTE
-#define ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_COMMAND_CLOSE_EVENTS_ATTRIBUTE
-#endif
-
/**********************************************************
* Matter timer scheduling glue logic
*********************************************************/
diff --git a/src/app/util/af.h b/src/app/util/af.h
index 0875c09..0af5d75 100644
--- a/src/app/util/af.h
+++ b/src/app/util/af.h
@@ -252,14 +252,6 @@
/** @} END addtogroup */
-#if !defined(DOXYGEN_SHOULD_SKIP_THIS)
-#if defined(EMBER_TEST)
-#define EMBER_TEST_ASSERT(x) assert(x)
-#else
-#define EMBER_TEST_ASSERT(x)
-#endif
-#endif
-
/**
* Returns the pointer to the data version storage for the given endpoint and
* cluster. Can return null in the following cases:
diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp
index e810c7c..ea4c3cc 100644
--- a/src/app/util/attribute-storage.cpp
+++ b/src/app/util/attribute-storage.cpp
@@ -132,14 +132,6 @@
// Not const, because these need to mutate.
DataVersion fixedEndpointDataVersions[ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT];
-#if !defined(EMBER_SCRIPTED_TEST)
-#define endpointNumber(x) fixedEndpoints[x]
-#define endpointDeviceTypeList(x) \
- Span<const EmberAfDeviceType>(&fixedDeviceTypeList[fixedDeviceTypeListOffsets[x]], fixedDeviceTypeListLengths[x])
-// Added 'Macro' to silence MISRA warning about conflict with synonymous vars.
-#define endpointTypeMacro(x) (&(generatedEmberAfEndpointTypes[fixedEmberAfEndpointTypes[x]]))
-#endif
-
AttributeAccessInterface * gAttributeAccessOverrides = nullptr;
// shouldUnregister returns true if the given AttributeAccessInterface should be
@@ -186,12 +178,10 @@
static_assert(FIXED_ENDPOINT_COUNT <= std::numeric_limits<decltype(ep)>::max(),
"FIXED_ENDPOINT_COUNT must not exceed the size of the endpoint data type");
-#if !defined(EMBER_SCRIPTED_TEST)
uint16_t fixedEndpoints[] = FIXED_ENDPOINT_ARRAY;
uint16_t fixedDeviceTypeListLengths[] = FIXED_DEVICE_TYPE_LENGTHS;
uint16_t fixedDeviceTypeListOffsets[] = FIXED_DEVICE_TYPE_OFFSETS;
uint8_t fixedEmberAfEndpointTypes[] = FIXED_ENDPOINT_TYPES;
-#endif
#if ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT > 0
// Initialize our data version storage. If
@@ -210,10 +200,11 @@
DataVersion * currentDataVersions = fixedEndpointDataVersions;
for (ep = 0; ep < FIXED_ENDPOINT_COUNT; ep++)
{
- emAfEndpoints[ep].endpoint = endpointNumber(ep);
- emAfEndpoints[ep].deviceTypeList = endpointDeviceTypeList(ep);
- emAfEndpoints[ep].endpointType = endpointTypeMacro(ep);
- emAfEndpoints[ep].dataVersions = currentDataVersions;
+ emAfEndpoints[ep].endpoint = fixedEndpoints[ep];
+ emAfEndpoints[ep].deviceTypeList =
+ Span<const EmberAfDeviceType>(&fixedDeviceTypeList[fixedDeviceTypeListOffsets[ep]], fixedDeviceTypeListLengths[ep]);
+ emAfEndpoints[ep].endpointType = &generatedEmberAfEndpointTypes[fixedEmberAfEndpointTypes[ep]];
+ emAfEndpoints[ep].dataVersions = currentDataVersions;
emAfEndpoints[ep].bitmask.Set(EmberAfEndpointOptions::isEnabled);
emAfEndpoints[ep].bitmask.Set(EmberAfEndpointOptions::isFlatComposition);
@@ -918,10 +909,7 @@
bool emberAfEndpointIsEnabled(EndpointId endpoint)
{
- uint16_t index = findIndexFromEndpoint(endpoint,
- false); // ignore disabled endpoints?
-
- EMBER_TEST_ASSERT(kEmberInvalidEndpointIndex != index);
+ uint16_t index = findIndexFromEndpoint(endpoint, false /* ignoreDisabledEndpoints */);
if (kEmberInvalidEndpointIndex == index)
{
@@ -933,8 +921,7 @@
bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable)
{
- uint16_t index = findIndexFromEndpoint(endpoint,
- false); // ignore disabled endpoints?
+ uint16_t index = findIndexFromEndpoint(endpoint, false /* ignoreDisabledEndpoints */);
bool currentlyEnabled;
if (kEmberInvalidEndpointIndex == index)
@@ -990,15 +977,13 @@
// Returns the index of a given endpoint. Does not consider disabled endpoints.
uint16_t emberAfIndexFromEndpoint(EndpointId endpoint)
{
- return findIndexFromEndpoint(endpoint,
- true); // ignore disabled endpoints?
+ return findIndexFromEndpoint(endpoint, true /* ignoreDisabledEndpoints */);
}
// Returns the index of a given endpoint. Considers disabled endpoints.
uint16_t emberAfIndexFromEndpointIncludingDisabledEndpoints(EndpointId endpoint)
{
- return findIndexFromEndpoint(endpoint,
- false); // ignore disabled endpoints?
+ return findIndexFromEndpoint(endpoint, false /* ignoreDisabledEndpoints */);
}
EndpointId emberAfEndpointFromIndex(uint16_t index)
diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h
index 175af55..210e327 100644
--- a/src/app/util/attribute-storage.h
+++ b/src/app/util/attribute-storage.h
@@ -25,24 +25,8 @@
#include <app/util/endpoint-config-api.h>
#include <lib/support/CodeUtils.h>
-#if !defined(EMBER_SCRIPTED_TEST)
#include <app/att-storage.h>
-#endif
-
-#if !defined(ATTRIBUTE_STORAGE_CONFIGURATION) && defined(EMBER_TEST)
-#define ATTRIBUTE_STORAGE_CONFIGURATION "attribute-storage-test.h"
-#endif
-
-// ATTRIBUTE_STORAGE_CONFIGURATION macro
-// contains the file that contains the initial set-up of the
-// attribute data structures. If it is missing
-// we use the provider sample.
-#ifndef ATTRIBUTE_STORAGE_CONFIGURATION
-// #error "Must define ATTRIBUTE_STORAGE_CONFIGURATION to specify the App. Builder default attributes file."
#include <zap-generated/endpoint_config.h>
-#else
-#include ATTRIBUTE_STORAGE_CONFIGURATION
-#endif
// If we have fixed number of endpoints, then max is the same.
#ifdef FIXED_ENDPOINT_COUNT
diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp
index 58430ac..c16cad8 100644
--- a/src/app/util/attribute-table.cpp
+++ b/src/app/util/attribute-table.cpp
@@ -32,17 +32,6 @@
using namespace chip;
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// External Declarations
-
-//------------------------------------------------------------------------------
-// Forward Declarations
-
-//------------------------------------------------------------------------------
-// Globals
-
EmberAfStatus emberAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr,
EmberAfAttributeType dataType)
{
diff --git a/src/app/util/attribute-table.h b/src/app/util/attribute-table.h
index bc46ddd..e18c21b 100644
--- a/src/app/util/attribute-table.h
+++ b/src/app/util/attribute-table.h
@@ -19,8 +19,6 @@
#include <app/util/af.h>
-#define ZCL_NULL_ATTRIBUTE_TABLE_INDEX 0xFFFF
-
// Remote devices writing attributes of local device
EmberAfStatus emberAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
uint8_t * dataPtr, EmberAfAttributeType dataType);
diff --git a/src/app/util/config.h b/src/app/util/config.h
index b71f49b..288935e 100644
--- a/src/app/util/config.h
+++ b/src/app/util/config.h
@@ -21,19 +21,9 @@
#if !CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES
-// include generated configuration information from AppBuilder.
-// ZA_GENERATED_HEADER is defined in the project file
-#ifdef ZA_GENERATED_HEADER
-#include ZA_GENERATED_HEADER
-#else
#include <zap-generated/gen_config.h>
-#endif
-#ifdef ATTRIBUTE_STORAGE_CONFIGURATION
-#include ATTRIBUTE_STORAGE_CONFIGURATION
-#else
#include <zap-generated/endpoint_config.h>
-#endif
#endif // !CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES
@@ -42,8 +32,3 @@
#ifndef EMBER_BINDING_TABLE_SIZE
#define EMBER_BINDING_TABLE_SIZE 10
#endif // EMBER_BINDING_TABLE_SIZE
-
-/**
- * @brief CHIP uses millisecond ticks
- */
-#define MILLISECOND_TICKS_PER_SECOND 1000