Skip to content

Commit

Permalink
Remove attribute-size.cpp. (#12664)
Browse files Browse the repository at this point in the history
This was being used only for the old list encoding, which we are not using anymore
  • Loading branch information
bzbarsky-apple authored Dec 7, 2021
1 parent 05d9dd0 commit 7ce81e5
Show file tree
Hide file tree
Showing 71 changed files with 66 additions and 10,500 deletions.
1 change: 0 additions & 1 deletion examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ include(${prj_root}/GCC-RELEASE/project_hp/asdk/includepath.cmake)
list(
APPEND ${list_chip_main_sources}

${chip_dir}/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp
${chip_dir}/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp
${chip_dir}/zzz_generated/all-clusters-app/zap-generated/callback-stub.cpp
${chip_dir}/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp
Expand Down
2 changes: 0 additions & 2 deletions examples/all-clusters-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ target_sources(${APP_TARGET} PRIVATE

${MBED_COMMON}/util/LEDWidget.cpp

${GEN_DIR}/all-clusters-app/zap-generated/attribute-size.cpp
${GEN_DIR}/all-clusters-app/zap-generated/callback-stub.cpp
${GEN_DIR}/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp
${GEN_DIR}/all-clusters-app/zap-generated/CHIPClusters.cpp
Expand All @@ -77,7 +76,6 @@ target_sources(${APP_TARGET} PRIVATE
${APP_UTIL}/attribute-storage.cpp
${APP_UTIL}/attribute-table.cpp
${APP_UTIL}/attribute-size-util.cpp
${APP_UTIL}/attribute-list-byte-span.cpp
${APP_UTIL}/binding-table.cpp
${APP_UTIL}/chip-message-send.cpp
${APP_UTIL}/client-api.cpp
Expand Down
8 changes: 3 additions & 5 deletions examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,12 @@ uint8_t * ToZclCharString(uint8_t * zclString, const char * cString, uint8_t max
// Converted into bytes and mapped the (label, value)
void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer, uint16_t length, EmberAfAttributeMetadata * am)
{
uint16_t listCount = 1;
_LabelStruct labelStruct;

labelStruct.label = chip::CharSpan(label, strlen(label));
labelStruct.value = chip::CharSpan(value, strlen(value));

emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&labelStruct), 1);
emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&listCount), 0);
// TODO: Need to set up an AttributeAccessInterface to handle the lists here.
}

EmberAfStatus HandleReadBridgedDeviceBasicAttribute(Device * dev, chip::AttributeId attributeId, uint8_t * buffer,
Expand Down Expand Up @@ -260,7 +258,7 @@ EmberAfStatus HandleWriteOnOffAttribute(Device * dev, chip::AttributeId attribut

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

Expand All @@ -287,7 +285,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI

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

Expand Down
8 changes: 3 additions & 5 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ int RemoveDeviceEndpoint(Device * dev)
void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer, uint16_t length, EmberAfAttributeMetadata * am)
{
char zclOctetStrBuf[kFixedLabelElementsOctetStringSize];
uint16_t listCount = 1;
_LabelStruct labelStruct;

// TODO: This size is obviously wrong. See
Expand All @@ -251,8 +250,7 @@ void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer,
// https://github.com/project-chip/connectedhomeip/issues/10743
labelStruct.value = CharSpan(&zclOctetStrBuf[0], sizeof(zclOctetStrBuf));

emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&labelStruct), 1);
emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&listCount), 0);
// TODO: Need to set up an AttributeAccessInterface to handle the lists here.
}

void HandleDeviceStatusChanged(Device * dev, Device::Changed_t itemChangedMask)
Expand Down Expand Up @@ -454,7 +452,7 @@ EmberAfStatus HandleReadSwitchAttribute(DeviceSwitch * dev, chip::AttributeId at

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

Expand Down Expand Up @@ -488,7 +486,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI

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

Expand Down
11 changes: 3 additions & 8 deletions examples/common/pigweed/rpc_services/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,9 @@ class Attributes : public generated::Attributes<Attributes>
response.which_data = chip_rpc_AttributeData_data_uint32_tag;
break;
case chip_rpc_AttributeType_ZCL_ARRAY_ATTRIBUTE_TYPE:
data = response.data.data_bytes.bytes;
size = sizeof(response.data.data_bytes.bytes);
RETURN_STATUS_IF_NOT_OK(emberAfReadServerAttribute(request.endpoint, request.cluster, request.attribute_id,
static_cast<uint8_t *>(data), size));
size = emberAfAttributeValueListSize(request.cluster, request.attribute_id, (const uint8_t *) data);
response.data.data_bytes.size = size;
response.which_data = chip_rpc_AttributeData_data_bytes_tag;
return pw::OkStatus();
// We don't know how to read these; need to get the right
// AttributeAccessInterface.
return pw::Status::InvalidArgument();
case chip_rpc_AttributeType_ZCL_BITMAP64_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT24U_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT40U_ATTRIBUTE_TYPE:
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ include(${prj_root}/GCC-RELEASE/project_hp/asdk/includepath.cmake)
list(
APPEND ${list_chip_main_sources}

${chip_dir}/zzz_generated/lighting-app/zap-generated/attribute-size.cpp
${chip_dir}/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp
${chip_dir}/zzz_generated/lighting-app/zap-generated/callback-stub.cpp
${chip_dir}/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/LightingManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/ZclCallbacks.cpp
${GEN_DIR}/lighting-app/zap-generated/attribute-size.cpp
${GEN_DIR}/lighting-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lighting-app/zap-generated/IMClusterCommandHandler.cpp
${MBED_COMMON}/util/LEDWidget.cpp
Expand All @@ -56,7 +55,6 @@ target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/src/app/util/DataModelHandler.cpp
${CHIP_ROOT}/src/app/util/af-event.cpp
${CHIP_ROOT}/src/app/util/af-main-common.cpp
${CHIP_ROOT}/src/app/util/attribute-list-byte-span.cpp
${CHIP_ROOT}/src/app/util/attribute-size-util.cpp
${CHIP_ROOT}/src/app/util/attribute-storage.cpp
${CHIP_ROOT}/src/app/util/attribute-table.cpp
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ target_sources(app PRIVATE
main/LightingManager.cpp
main/main.cpp
main/ZclCallbacks.cpp
${GEN_DIR}/lighting-app/zap-generated/attribute-size.cpp
${GEN_DIR}/lighting-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lighting-app/zap-generated/CHIPClusters.cpp
${GEN_DIR}/lighting-app/zap-generated/IMClusterCommandHandler.cpp
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ target_sources(app PRIVATE
src/LightingManager.cpp
src/main.cpp
src/ZclCallbacks.cpp
${GEN_DIR}/lighting-app/zap-generated/attribute-size.cpp
${GEN_DIR}/lighting-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lighting-app/zap-generated/IMClusterCommandHandler.cpp
${TELINK_COMMON}/util/src/LEDWidget.cpp
Expand All @@ -56,7 +55,6 @@ target_sources(app PRIVATE
${CHIP_ROOT}/src/app/util/DataModelHandler.cpp
${CHIP_ROOT}/src/app/util/af-event.cpp
${CHIP_ROOT}/src/app/util/af-main-common.cpp
${CHIP_ROOT}/src/app/util/attribute-list-byte-span.cpp
${CHIP_ROOT}/src/app/util/attribute-size-util.cpp
${CHIP_ROOT}/src/app/util/attribute-storage.cpp
${CHIP_ROOT}/src/app/util/attribute-table.cpp
Expand Down
2 changes: 0 additions & 2 deletions examples/lock-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/BoltLockManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/ZclCallbacks.cpp
${GEN_DIR}/lock-app/zap-generated/attribute-size.cpp
${GEN_DIR}/lock-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lock-app/zap-generated/IMClusterCommandHandler.cpp
${MBED_COMMON}/util/LEDWidget.cpp
Expand All @@ -55,7 +54,6 @@ target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
${CHIP_ROOT}/src/app/util/af-event.cpp
${CHIP_ROOT}/src/app/util/af-main-common.cpp
${CHIP_ROOT}/src/app/util/attribute-list-byte-span.cpp
${CHIP_ROOT}/src/app/util/attribute-size-util.cpp
${CHIP_ROOT}/src/app/util/attribute-storage.cpp
${CHIP_ROOT}/src/app/util/attribute-table.cpp
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ target_sources(app PRIVATE
main/BoltLockManager.cpp
main/main.cpp
main/ZclCallbacks.cpp
${GEN_DIR}/lock-app/zap-generated/attribute-size.cpp
${GEN_DIR}/lock-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lock-app/zap-generated/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
Expand Down
1 change: 0 additions & 1 deletion examples/pump-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ target_sources(app PRIVATE
main/PumpManager.cpp
main/main.cpp
main/ZclCallbacks.cpp
${GEN_DIR}/pump-app/zap-generated/attribute-size.cpp
${GEN_DIR}/pump-app/zap-generated/callback-stub.cpp
${GEN_DIR}/pump-app/zap-generated/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
Expand Down
1 change: 0 additions & 1 deletion examples/pump-controller-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ target_sources(app PRIVATE
main/PumpManager.cpp
main/main.cpp
main/ZclCallbacks.cpp
${GEN_DIR}/pump-controller-app/zap-generated/attribute-size.cpp
${GEN_DIR}/pump-controller-app/zap-generated/callback-stub.cpp
${GEN_DIR}/pump-controller-app/zap-generated/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
Expand Down
1 change: 0 additions & 1 deletion src/app/chip_data_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function(chip_configure_data_model APP_TARGET)
${CHIP_APP_BASE_DIR}/../../zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
${CHIP_APP_BASE_DIR}/util/af-event.cpp
${CHIP_APP_BASE_DIR}/util/af-main-common.cpp
${CHIP_APP_BASE_DIR}/util/attribute-list-byte-span.cpp
${CHIP_APP_BASE_DIR}/util/attribute-size-util.cpp
${CHIP_APP_BASE_DIR}/util/attribute-storage.cpp
${CHIP_APP_BASE_DIR}/util/attribute-table.cpp
Expand Down
6 changes: 1 addition & 5 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ template("chip_data_model") {
"${_app_root}/util/DataModelHandler.cpp",
"${_app_root}/util/af-event.cpp",
"${_app_root}/util/af-main-common.cpp",
"${_app_root}/util/attribute-list-byte-span.cpp",
"${_app_root}/util/attribute-size-util.cpp",
"${_app_root}/util/attribute-storage.cpp",
"${_app_root}/util/attribute-table.cpp",
Expand Down Expand Up @@ -160,10 +159,7 @@ template("chip_data_model") {
}

if (defined(invoker.zap_pregenerated_dir)) {
sources += [
"${invoker.zap_pregenerated_dir}/attribute-size.cpp",
"${invoker.zap_pregenerated_dir}/callback-stub.cpp",
]
sources += [ "${invoker.zap_pregenerated_dir}/callback-stub.cpp" ]

if (chip_controller) {
sources += [
Expand Down
4 changes: 2 additions & 2 deletions src/app/util/ContentAppPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ using namespace chip::AppPlatform;

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

Expand All @@ -64,7 +64,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI

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

Expand Down
33 changes: 0 additions & 33 deletions src/app/util/af.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,30 +588,6 @@ uint8_t emberAfStringLength(const uint8_t * buffer);
*/
uint16_t emberAfLongStringLength(const uint8_t * buffer);

/*
* @brief Function that copies (part of) a ZCL typed list into a buffer. The index parameter
* may indicate a specific member of the list, or the list length, or the whole list if it
* is equal to -1.
*
* Individual elements may be accessed by an index of type 16-bit unsigned integer.
* Elements are numbered from 1 upwards. The element with index 0 is always of type
* uint16, and holds the number of elements contained in the list, which may be zero.
* If the zeroth element contains 0xffff, the list is a non value and is considered
* undefined.
*
* When writing, dest points to the list to write to, src points to the value to write, and index is the index to write at.
*
* When reading (i.e write is false), dest is the location to read into, src points to the list, and index is the index to read
* from.
*
* When reading or writing if the index leads to read or write outside of the
* allocated size for the list, this function will return 0.
*
* @return The number of bytes copied
*/
uint16_t emberAfCopyList(chip::ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src,
int32_t index);

/*
* @brief Function that determines the size of a zigbee Cluster Library
* attribute value (where the attribute could be non-string, string, or long
Expand All @@ -621,15 +597,6 @@ uint16_t emberAfCopyList(chip::ClusterId clusterId, EmberAfAttributeMetadata * a
uint16_t emberAfAttributeValueSize(chip::ClusterId clusterId, chip::AttributeId attributeId, EmberAfAttributeType dataType,
const uint8_t * buffer);

/*
* @brief Function that determines the size of a zigbee Cluster Library
* attribute List[T] where T could be of any type.
* The size is expressed in bytes, and includes the used length consumed
* by list entries plus the 2 bytes used to represent the number of actual
* entries in the list.
*/
uint16_t emberAfAttributeValueListSize(chip::ClusterId clusterId, chip::AttributeId attributeId, const uint8_t * buffer);

/** @} END Attribute Storage */

/** @name Device Control */
Expand Down
91 changes: 0 additions & 91 deletions src/app/util/attribute-list-byte-span.cpp

This file was deleted.

Loading

0 comments on commit 7ce81e5

Please sign in to comment.