Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Update ZAP to force lists to be external-storage. #13847

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src"
#${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ias-zone-client
)
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ target_sources(${APP_TARGET} PRIVATE
${APP_CLUSTERS}/general-diagnostics-server/general-diagnostics-server.cpp
${APP_CLUSTERS}/group-key-mgmt-server/group-key-mgmt-server.cpp
${APP_CLUSTERS}/power-source-configuration-server/power-source-configuration-server.cpp
${APP_CLUSTERS}/power-source-server/power-source-server.cpp
${APP_CLUSTERS}/ota-requestor/ota-requestor-server.cpp
${APP_CLUSTERS}/ota-requestor/BDXDownloader.cpp
${APP_CLUSTERS}/ota-requestor/OTARequestor.cpp
Expand Down
2 changes: 2 additions & 0 deletions examples/lock-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ idf_component_register(INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server"
PRIV_REQUIRES bt chip QRCode)

get_filename_component(CHIP_ROOT ../third_party/connectedhomeip REALPATH)
Expand Down Expand Up @@ -153,6 +154,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
PRIV_REQUIRES chip QRCode bt)

Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp
${CHIP_ROOT}/src/app/clusters/on-off-server/on-off-server.cpp
${CHIP_ROOT}/src/app/clusters/power-source-configuration-server/power-source-configuration-server.cpp
${CHIP_ROOT}/src/app/clusters/power-source-configuration-server/power-source-server.cpp
${CHIP_ROOT}/src/app/clusters/user-label-server/user-label-server.cpp
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath
case LocationCapability::Id: {
return ReadIfSupported(&ConfigurationManager::GetLocationCapability, aEncoder);
}
case BasicCommissioningInfoList::Id: {
// TODO: This should not be a list at all!
return aEncoder.EncodeEmptyList();
}
default: {
break;
}
Expand Down
70 changes: 70 additions & 0 deletions src/app/clusters/power-source-server/power-source-server.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/****************************************************************************
* @file
* @brief Implementation for the Power Source Server Cluster
***************************************************************************/

#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/AttributeAccessInterface.h>
#include <app/util/attribute-storage.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::PowerSource::Attributes;

namespace {

class PowerSourceAttrAccess : public AttributeAccessInterface
{
public:
// Register on all endpoints.
PowerSourceAttrAccess() : AttributeAccessInterface(Optional<EndpointId>::Missing(), PowerSource::Id) {}

CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;
};

PowerSourceAttrAccess gAttrAccess;

CHIP_ERROR PowerSourceAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
{
CHIP_ERROR err = CHIP_NO_ERROR;

switch (aPath.mAttributeId)
{
case ActiveBatteryFaults::Id:
// TODO: Needs implementation.
err = aEncoder.EncodeEmptyList();
break;
default:
break;
}

return err;
}

} // anonymous namespace

void MatterPowerSourcePluginServerInitCallback(void)
{
registerAttributeAccessOverride(&gAttrAccess);
}
15 changes: 0 additions & 15 deletions src/app/util/ember-compatibility-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,21 +658,6 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b
}
break;
}
case ZCL_ARRAY_ATTRIBUTE_TYPE: {
// We only get here for attributes of list type that have no override
// registered. There should not be any nonempty lists like that.
uint16_t length = emberAfGetInt16u(attributeData, 0, 2);
if (length != 0)
{
return CHIP_ERROR_INCORRECT_STATE;
}

// Just encode an empty array.
TLV::TLVType containerType;
ReturnErrorOnFailure(writer->StartContainer(tag, TLV::kTLVType_Array, containerType));
ReturnErrorOnFailure(writer->EndContainer(containerType));
break;
}
default:
ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast<int>(attributeType));
emberStatus = EMBER_ZCL_STATUS_WRITE_ONLY;
Expand Down
1 change: 0 additions & 1 deletion src/app/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ void MatterPressureMeasurementPluginServerInitCallback() {}
void MatterTemperatureMeasurementPluginServerInitCallback() {}
void MatterFlowMeasurementPluginServerInitCallback() {}
void MatterOnOffSwitchConfigurationPluginServerInitCallback() {}
void MatterPowerSourcePluginServerInitCallback() {}
void MatterThermostatUserInterfaceConfigurationPluginServerInitCallback() {}
void MatterBridgedDeviceBasicInformationPluginServerInitCallback() {}
void MatterPowerConfigurationPluginServerInitCallback() {}
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,7 @@
"commandDiscovery": true
}
},
"listsUseAttributeAccessInterface": true,
"attributeAccessInterfaceAttributes": {},
"defaultReportingPolicy": "mandatory"
}
2 changes: 1 addition & 1 deletion src/app/zap_cluster_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
'OTA_BOOTLOAD_CLUSTER': [],
'OTA_PROVIDER_CLUSTER': ['ota-provider'],
'OTA_REQUESTOR_CLUSTER': ['ota-requestor'],
'POWER_SOURCE_CLUSTER': [],
'POWER_SOURCE_CLUSTER': ['power-source-server'],
'POWER_SOURCE_CONFIGURATION_CLUSTER': ['power-source-configuration-server'],
'POLL_CONTROL_CLUSTER': [],
'POWER_CONFIG_CLUSTER': [],
Expand Down
Loading