Skip to content

Commit

Permalink
Remove CHIPClusters.cpp and various things it called into (#14581)
Browse files Browse the repository at this point in the history
* Remove CHIPClusters.cpp, now that it's not used.

* Remove CHIPClientCallbacks.cpp now that it's not used.

* Remove DeviceControllerInteractionModelDelegate.

* Remove im-client-callbacks.cpp.

* Remove the callbacks manager.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Aug 17, 2023
1 parent 4fcfcfa commit 9824625
Show file tree
Hide file tree
Showing 139 changed files with 13 additions and 28,300 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Same for files in zap-generated folders
**/zap-generated/** linguist-generated
# And some specific generated files
src/controller/python/chip/clusters/CHIPClusters.cpp linguist-generated
src/controller/python/chip/clusters/CHIPClusters.py linguist-generated
src/controller/python/chip/clusters/Objects.py linguist-generated
src/darwin/Framework/CHIPTests/CHIPClustersTests.m linguist-generated
1 change: 0 additions & 1 deletion config/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ if (CONFIG_CHIP_OTA_REQUESTOR)

target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp
${CHIP_ROOT}/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.cpp
${CHIP_ROOT}/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp

${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/all-clusters-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ chip_data_model("all-clusters-common") {
zap_pregenerated_dir =
"${chip_root}/zzz_generated/all-clusters-app/zap-generated"
is_server = true
use_default_client_callbacks = true
}
2 changes: 0 additions & 2 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ endif (matter_enable_ota_requestor)
list(
APPEND ${list_chip_main_sources}

${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
${chip_dir}/zzz_generated/all-clusters-app/zap-generated/CHIPClusters.cpp

${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.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,8 +54,6 @@ target_sources(${APP_TARGET} PRIVATE
${MBED_COMMON}/util/LEDWidget.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
${GEN_DIR}/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp
${GEN_DIR}/app-common/app-common/zap-generated/attributes/Accessors.cpp
${GEN_DIR}/app-common/app-common/zap-generated/cluster-objects.cpp
Expand Down
1 change: 0 additions & 1 deletion examples/chip-tool/commands/pairing/PairingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "../common/CHIPCommand.h"
#include <controller/CommissioningDelegate.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <zap-generated/CHIPClusters.h>

#include <commands/common/CredentialIssuerCommands.h>
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ endif (matter_enable_ota_requestor)
list(
APPEND ${list_chip_main_sources}

${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
${chip_dir}/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp

${chip_dir}/examples/lighting-app/lighting-common/color_format/color_format.cpp

Expand Down
1 change: 0 additions & 1 deletion examples/lighting-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
)

chip_configure_data_model(${APP_TARGET}
INCLUDE_CLIENT_CALLBACKS
INCLUDE_SERVER
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lighting-common/lighting-app.zap
GEN_DIR ${GEN_DIR}/lighting-app/zap-generated
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,13 @@ target_sources(app PRIVATE
main/main.cpp
main/ZclCallbacks.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
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
${NRFCONNECT_COMMON}/util/ThreadUtil.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp)

chip_configure_data_model(app
INCLUDE_CLIENT_CALLBACKS
INCLUDE_SERVER
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lighting-common/lighting-app.zap
GEN_DIR ${GEN_DIR}/lighting-app/zap-generated
Expand Down
3 changes: 0 additions & 3 deletions examples/ota-requestor-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ list(

${chip_dir}/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp
${chip_dir}/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp
${chip_dir}/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.cpp
${chip_dir}/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.cpp

${chip_dir}/examples/ota-requestor-app/ameba/main/chipinterface.cpp
${chip_dir}/examples/ota-requestor-app/ameba/main/Globals.cpp
Expand All @@ -27,7 +25,6 @@ list(
${chip_dir}/src/app/clusters/ota-requestor/BDXDownloader.cpp
${chip_dir}/src/app/clusters/ota-requestor/OTARequestor.cpp
${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
${chip_dir}/src/app/util/im-client-callbacks.cpp
)

add_library(
Expand Down
1 change: 0 additions & 1 deletion examples/ota-requestor-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ target_sources(${APP_TARGET} PRIVATE

chip_configure_data_model(${APP_TARGET}
INCLUDE_SERVER
INCLUDE_CLIENT_CALLBACKS
ZAP_FILE ${CHIP_ROOT}/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap
GEN_DIR ${CHIP_ROOT}/zzz_generated/ota-requestor-app/zap-generated
)
Expand Down
2 changes: 0 additions & 2 deletions examples/ota-requestor-app/ota-requestor-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ chip_data_model("ota-requestor-common") {
zap_pregenerated_dir =
"${chip_root}/zzz_generated/ota-requestor-app/zap-generated"

use_default_client_callbacks = true

deps = [ "${chip_root}/src/lib" ]

public_configs = [ ":config" ]
Expand Down
1 change: 0 additions & 1 deletion examples/tv-app/tv-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ chip_data_model("tv-common") {

zap_pregenerated_dir = "${chip_root}/zzz_generated/tv-app/zap-generated"
is_server = true
use_default_client_callbacks = true
}
1 change: 0 additions & 1 deletion examples/tv-casting-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ void DeviceEventCallback(const DeviceLayer::ChipDeviceEvent * event, intptr_t ar
.idAllocator = &(server->GetSessionIDAllocator()),
.fabricTable = &(server->GetFabricTable()),
.clientPool = &gCASEClientPool,
.imDelegate = chip::Platform::New<chip::Controller::DeviceControllerInteractionModelDelegate>(),
};

PeerId peerID = fabric->GetPeerIdForNode(tvNodeId);
Expand Down
1 change: 0 additions & 1 deletion examples/tv-casting-app/tv-casting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ chip_data_model("tv-casting-common") {
zap_pregenerated_dir =
"${chip_root}/zzz_generated/tv-casting-app/zap-generated"
is_server = true
use_default_client_callbacks = true
}
1 change: 0 additions & 1 deletion src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ static_library("app") {
public_deps = [
":app_buildconfig",
"${chip_root}/src/access",
"${chip_root}/src/app/util:device_callbacks_manager",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
"${chip_root}/src/protocols/secure_channel",
Expand Down
74 changes: 0 additions & 74 deletions src/app/DeviceControllerInteractionModelDelegate.h

This file was deleted.

22 changes: 0 additions & 22 deletions src/app/DeviceProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,4 @@ CHIP_ERROR DeviceProxy::SendCommands(app::CommandSender * commandObj, Optional<S
return commandObj->SendCommandRequest(GetSecureSession().Value(), timeout);
}

void DeviceProxy::AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback, app::TLVDataFilter tlvDataFilter)
{
// Interaction model uses the object instead of a sequence number as the identifier of transactions.
// Since the objects can be identified by its pointer which fits into a uint64 value (the type of NodeId), we use it for the
// "node id" field in callback manager.
static_assert(std::is_same<chip::NodeId, uint64_t>::value, "chip::NodeId is not uint64_t");
chip::NodeId transactionId = reinterpret_cast<chip::NodeId>(commandObj);
mCallbacksMgr.AddResponseCallback(transactionId, 0 /* seqNum, always 0 for IM before #6559 */, onSuccessCallback,
onFailureCallback, tlvDataFilter);
}

void DeviceProxy::CancelIMResponseHandler(void * commandObj)
{
// Interaction model uses the object instead of a sequence number as the identifier of transactions.
// Since the objects can be identified by its pointer which fits into a uint64 value (the type of NodeId), we use it for the
// "node id" field in callback manager.
static_assert(std::is_same<chip::NodeId, uint64_t>::value, "chip::NodeId is not uint64_t");
chip::NodeId transactionId = reinterpret_cast<chip::NodeId>(commandObj);
mCallbacksMgr.CancelResponseCallback(transactionId, 0 /* seqNum, always 0 for IM before #6559 */);
}

} // namespace chip
12 changes: 0 additions & 12 deletions src/app/DeviceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
#pragma once

#include <app/CommandSender.h>
#include <app/DeviceControllerInteractionModelDelegate.h>
#include <app/InteractionModelEngine.h>
#include <app/util/CHIPDeviceCallbacksMgr.h>
#include <lib/core/CHIPCallback.h>
#include <lib/core/CHIPCore.h>
#include <lib/support/DLLUtil.h>
Expand All @@ -55,14 +53,6 @@ class DLL_EXPORT DeviceProxy

virtual CHIP_ERROR SendCommands(app::CommandSender * commandObj, chip::Optional<System::Clock::Timeout> timeout = NullOptional);

// Interaction model uses the object and callback interface instead of sequence number to mark different transactions.
virtual void AddIMResponseHandler(void * commandObj, Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback, app::TLVDataFilter tlvDataFilter = nullptr);

virtual void CancelIMResponseHandler(void * commandObj);

virtual Controller::DeviceControllerInteractionModelDelegate * GetInteractionModelDelegate() = 0;

virtual Messaging::ExchangeManager * GetExchangeManager() const = 0;

virtual chip::Optional<SessionHandle> GetSecureSession() const = 0;
Expand All @@ -78,8 +68,6 @@ class DLL_EXPORT DeviceProxy

virtual uint8_t GetNextSequenceNumber() = 0;

app::CHIPDeviceCallbacksMgr & mCallbacksMgr = app::CHIPDeviceCallbacksMgr::GetInstance();

ReliableMessageProtocolConfig mMRPConfig = gDefaultMRPConfig;
};

Expand Down
2 changes: 0 additions & 2 deletions src/app/InteractionModelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman

void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, chip::TLV::TLVReader & aReader,
CommandHandler * apCommandObj);
void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, chip::TLV::TLVReader & aReader,
CommandSender * apCommandObj);

/**
* Check whether the given cluster exists on the given endpoint and supports the given command.
Expand Down
4 changes: 0 additions & 4 deletions src/app/OperationalDeviceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ struct DeviceProxyInitParams
FabricTable * fabricTable = nullptr;
CASEClientPoolDelegate * clientPool = nullptr;

Controller::DeviceControllerInteractionModelDelegate * imDelegate = nullptr;

Optional<ReliableMessageProtocolConfig> mrpLocalConfig = Optional<ReliableMessageProtocolConfig>::Missing();

CHIP_ERROR Validate() const
Expand Down Expand Up @@ -170,8 +168,6 @@ class DLL_EXPORT OperationalDeviceProxy : public DeviceProxy, SessionReleaseDele

CHIP_ERROR ShutdownSubscriptions() override;

Controller::DeviceControllerInteractionModelDelegate * GetInteractionModelDelegate() override { return mInitParams.imDelegate; }

Messaging::ExchangeManager * GetExchangeManager() const override { return mInitParams.exchangeMgr; }

chip::Optional<SessionHandle> GetSecureSession() const override { return mSecureSession.ToOptional(); }
Expand Down
9 changes: 1 addition & 8 deletions src/app/chip_data_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,7 @@ endfunction()
# supported by the application.
#
function(chip_configure_data_model APP_TARGET)
cmake_parse_arguments(ARG "INCLUDE_CLIENT_CALLBACKS;INCLUDE_SERVER" "ZAP_FILE;GEN_DIR" "" ${ARGN})

if (ARG_INCLUDE_CLIENT_CALLBACKS)
target_sources(${APP_TARGET} PRIVATE
${CHIP_APP_BASE_DIR}/util/im-client-callbacks.cpp
${ARG_GEN_DIR}/CHIPClientCallbacks.cpp
)
endif()
cmake_parse_arguments(ARG "INCLUDE_SERVER" "ZAP_FILE;GEN_DIR" "" ${ARGN})

if (ARG_INCLUDE_SERVER)
target_sources(${APP_TARGET} PRIVATE
Expand Down
20 changes: 1 addition & 19 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ _zap_cluster_list_script = get_path_info("zap_cluster_list.py", "abspath")
# Names of the clusters directories to compile.
# Deprecated, specify zap_file instead.
#
# use_default_client_callbacks
# Include CHIPClientCallbacks.cpp.
#
# Forwards all the remaining variables to the source_set.
#
template("chip_data_model") {
Expand All @@ -56,18 +53,13 @@ template("chip_data_model") {

_use_tests_apis = defined(invoker.use_tests_apis) && invoker.use_tests_apis

_use_default_client_callbacks =
defined(invoker.use_default_client_callbacks) &&
invoker.use_default_client_callbacks

source_set(_data_model_name) {
forward_variables_from(invoker,
"*",
[
"zap_pregenerated_dir",
"cluster_sources",
"zap_file",
"use_default_client_callbacks",
"is_server",
])

Expand Down Expand Up @@ -166,17 +158,7 @@ template("chip_data_model") {
sources += [ "${invoker.zap_pregenerated_dir}/callback-stub.cpp" ]

if (chip_controller) {
sources += [
"${invoker.zap_pregenerated_dir}/CHIPClusters.cpp",
"${invoker.zap_pregenerated_dir}/CHIPClusters.h",
]
}

if (_use_default_client_callbacks) {
sources += [
"${_app_root}/util/im-client-callbacks.cpp",
"${invoker.zap_pregenerated_dir}/CHIPClientCallbacks.cpp",
]
sources += [ "${invoker.zap_pregenerated_dir}/CHIPClusters.h" ]
}

if (_use_default_im_dispatch) {
Expand Down
1 change: 0 additions & 1 deletion src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ Server::Server() :
.idAllocator = &mSessionIDAllocator,
.fabricTable = &mFabrics,
.clientPool = &mCASEClientPool,
.imDelegate = nullptr,
},
.dnsCache = nullptr,
.devicePool = &mDevicePool,
Expand Down
2 changes: 0 additions & 2 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ chip_test_suite("tests") {
"TestAttributePathExpandIterator.cpp",
"TestAttributeValueEncoder.cpp",
"TestBuilderParser.cpp",
"TestCHIPDeviceCallbacksMgr.cpp",
"TestClusterInfo.cpp",
"TestCommandInteraction.cpp",
"TestCommandPathParams.cpp",
Expand Down Expand Up @@ -77,7 +76,6 @@ chip_test_suite("tests") {
"${chip_root}/src/app",
"${chip_root}/src/app/common:cluster-objects",
"${chip_root}/src/app/tests:helpers",
"${chip_root}/src/app/util:device_callbacks_manager",
"${chip_root}/src/app/util/mock:mock_ember",
"${chip_root}/src/lib/core",
"${nlunit_test_root}:nlunit-test",
Expand Down
Loading

0 comments on commit 9824625

Please sign in to comment.