Skip to content

Commit

Permalink
Move declarations from af.h into the corresponding storage/table/..…
Browse files Browse the repository at this point in the history
…. headers (project-chip#32776)

* move emberAfLocateAttributeMetadata to attribute-storage.h as it is implemented in attribute-storage.cpp

* Move more methods

* Global endpoints extern should not exist

* move more things

* restyle

* Move the last bits from af.h into the corresponding headers. Remove af.h (this will cause compile issues)

* Remove all references to af.h

* Restyle and zap regen

* All-clusters now compiles on linux

* Fix ota requester compile

* Make tests compile

* Restyle

* Fix lint.yml: af.h does not exist anymore

* Fix door lock compile

* Ensure everything using emberAfEndpointEnableDisable includes endpoint-config-api

* Fix emberAfContainsServer include needs

* Include attribute-storage.h whenever kEmberinvalidEndpointIndex is defined

* Include attribute-storage.h whenever kEmberinvalidEndpointIndex is used

* Fix linter

* Another lint cleanup

* Fix all includes referencing EnabledEndpointsWithServerCluster

* Restyle

* Fix andorid tv compile

* Fix linter complain: application basic delegate was already stl-bound, add string as well

* Fix Attributes.h using emberAfWriteAttribute

* Fix dependencies on AccountLogingManager ... needs config to access SERVER_ENDPOINT_COUNT

* Add a lot of includes for std::string where std::string is used

* Fix checkincludes

* Fix one more build

* Zap regen ... some string adds were in generated code

* make android compile: fix dynamic server dependencies on attribute-storage.h

* Refactor a bit to make gn linter happy

* Restyle

* Split out attribute-storage/table into a -detail and non-detail header

* Restyle

* Fix lint typo

* Make tv app compile: need dynamic endpoints defines accessible

* Restyle

* Remove code from storage-detail

* Fix code again: FIXED_ENDPOINT_COUNT must be defined, so config has to be included

* More includes to make compile work. At least now boufallolab compiles

* Fix linux builds ... apparently mock attribute storage is a copy & paste ... this is probably not good...

* Direct include of endpoint_config in attribute-storage.h

* Minor comment update: alignment and fix typo

* Some code review comments

---------

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
andy31415 and andreilitvin authored Apr 4, 2024
1 parent 4cfde10 commit 660c928
Show file tree
Hide file tree
Showing 382 changed files with 876 additions and 613 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ jobs:
--known-failure app/reporting/tests/MockReportScheduler.cpp \
--known-failure app/reporting/tests/MockReportScheduler.h \
--known-failure app/TestEventTriggerDelegate.h \
--known-failure app/util/af.h \
--known-failure app/util/attribute-storage.cpp \
--known-failure app/util/attribute-storage.h \
--known-failure app/util/attribute-storage-detail.h \
--known-failure app/util/attribute-table.cpp \
--known-failure app/util/attribute-table.h \
--known-failure app/util/attribute-table-detail.h \
--known-failure app/util/binding-table.cpp \
--known-failure app/util/binding-table.h \
--known-failure app/util/config.h \
Expand Down Expand Up @@ -253,7 +254,7 @@ jobs:
- name: Check for use of 'emberAfReadAttribute' instead of the type-safe getters
if: always()
run: |
git grep -I -n 'emberAfReadAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' && exit 1 || exit 0
git grep -I -n 'emberAfReadAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/attribute-table.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' && exit 1 || exit 0
# git grep exits with 0 if it finds a match, but we want
# to fail (exit nonzero) on match. And we want to exclude this file,
Expand All @@ -263,7 +264,7 @@ jobs:
- name: Check for use of 'emberAfWriteAttribute' instead of the type-safe setters
if: always()
run: |
git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0
git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0
# Run ruff python linter
- name: Check for errors using ruff Python linter
Expand Down
1 change: 0 additions & 1 deletion examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/server/Dnssd.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <app/util/util.h>
#include <lib/dnssd/Advertiser.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/air-purifier-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <app/clusters/identify-server/identify-server.h>
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/util/af.h>
#include <app/util/endpoint-config-api.h>
#include <lib/core/ErrorStr.h>
#include <platform/Ameba/AmebaConfig.h>
#include <platform/Ameba/NetworkCommissioningDriver.h>
Expand Down
1 change: 0 additions & 1 deletion examples/air-purifier-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/ConcreteAttributePath.h>
#include <app/util/af.h>
#include <lib/support/logging/CHIPLogging.h>

#define AIR_PURIFIER_ENDPOINT 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <limits>
#include <map>
#include <string>

using namespace chip;
using namespace chip::app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <json/json.h>
#include <platform/DiagnosticDataProvider.h>

#include <string>

class AirQualitySensorAttrUpdateHandler
{
public:
Expand Down
3 changes: 2 additions & 1 deletion examples/air-quality-sensor-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
#include <AppMain.h>
#include <air-quality-sensor-manager.h>

#include <app/util/af.h>
#include <platform/CHIPDeviceConfig.h>

#include <string>

#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED
#include <imgui_ui/ui.h>
#include <imgui_ui/windows/qrcode.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-delegate.h>
#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <app/clusters/laundry-washer-controls-server/laundry-washer-controls-delegate.h>
#include <app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-select-server/supported-modes-manager.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h>
#include <app/util/af.h>
#include <app/util/config.h>

namespace chip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/server/Dnssd.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <app/util/util.h>
#include <lib/dnssd/Advertiser.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/af.h>
#include <app/util/endpoint-config-api.h>
#include <laundry-dryer-controls-delegate-impl.h>
#include <laundry-washer-controls-delegate-impl.h>
#include <lib/core/ErrorStr.h>
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/asr/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <app/util/endpoint-config-api.h>
#include <assert.h>
#include <lega_rtos_api.h>
#include <platform/ASR/NetworkCommissioningDriver.h>
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/asr/src/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/server/Dnssd.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <app/util/util.h>
#include <lib/dnssd/Advertiser.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include <app/server/Server.h>
#include <app/util/af.h>

#include "FreeRTOS.h"
#include "Globals.h"
#include <app/util/endpoint-config-api.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/util/af-types.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>

using namespace ::chip;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include <app/server/Server.h>
#include <app/util/af.h>

#include "FreeRTOS.h"
#include "Globals.h"
#include <app/util/endpoint-config-api.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <examples/platform/cc13x4_26x4/CC13X4_26X4DeviceAttestationCreds.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
#include <app/util/af-types.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>

using namespace ::chip;
Expand Down
4 changes: 4 additions & 0 deletions examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>

#include <string>
#include <tuple>
#include <vector>

#if CONFIG_HAVE_DISPLAY
using namespace ::chip;
using namespace ::chip::Credentials;
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/esp32/main/QRCodeScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <platform/CHIPDeviceLayer.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>

#include <string>

// TODO need sensible library tag when put in library
extern const char TAG[];

Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/esp32/main/StatusScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include <app/server/Server.h>
#include <lib/core/DataModelTypes.h>

#include <string>

#define MAX_LENGTH_SMALL_FONT 30

using namespace chip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "ScreenManager.h"

#include <cstdint>
#include <string>
#include <vector>

class QRCodeScreen : public Screen
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "platform/PlatformManager.h"
#include "shell_extension/launch.h"
#include <app/server/OnboardingCodesUtil.h>
#include <app/util/af.h>
#include <app/util/endpoint-config-api.h>
#include <binding-handler.h>
#include <common/CHIPDeviceManager.h>
#include <common/Esp32AppServer.h>
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <app/util/endpoint-config-api.h>
#include <assert.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <app/clusters/switch-server/switch-server.h>
#include <app/server/Server.h>
#include <app/util/att-storage.h>
#include <app/util/attribute-storage.h>
#include <platform/PlatformManager.h>

#include <air-quality-instance.h>
Expand All @@ -35,6 +36,8 @@
#include <oven-operational-state-delegate.h>
#include <rvc-modes.h>

#include <string>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/AllClustersCommandDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <json/json.h>
#include <platform/DiagnosticDataProvider.h>

#include <string>

class AllClustersAppCommandHandler
{
public:
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/AppOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <app/server/CommissioningWindowManager.h>
#include <app/server/Server.h>

#include <string>

using namespace chip::ArgParser;

using chip::ArgParser::OptionDef;
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/AppOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <app/tests/suites/credentials/TestHarnessDACProvider.h>

#include <string>

class AppOptions
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <lib/support/SafeInt.h>

#include <string>

using namespace chip;
using namespace chip::app::Clusters::DiagnosticLogs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <fstream>
#include <map>
#include <string>

namespace chip {
namespace app {
Expand Down
3 changes: 2 additions & 1 deletion examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include <app/clusters/time-synchronization-server/time-synchronization-server.h>
#include <app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h>
#include <app/server/Server.h>
#include <app/util/af.h>
#include <app/util/att-storage.h>
#include <app/util/attribute-storage.h>
#include <lib/support/CHIPMem.h>
Expand All @@ -61,6 +60,8 @@
#include <transport/SessionManager.h>
#include <transport/raw/PeerAddress.h>

#include <string>

using namespace chip;
using namespace chip::app;
using namespace chip::DeviceLayer;
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <app/clusters/identify-server/identify-server.h>
#include <app/clusters/ota-requestor/OTATestEventTriggerHandler.h>
#include <app/util/attribute-storage.h>
#include <app/util/endpoint-config-api.h>

#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/nxp/common/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ICDUtil.h"
#include <app/InteractionModelEngine.h>
#include <app/util/attribute-storage.h>
#include <app/util/endpoint-config-api.h>

using namespace chip;
using namespace chip::app::Clusters;
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/nxp/common/main/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/ConcreteAttributePath.h>
#include <app/util/af-types.h>
#include <app/util/af.h>

using namespace ::chip;

Expand Down
Loading

0 comments on commit 660c928

Please sign in to comment.