From 1725893e9b359d1bf755725428dcb7c1a9b31524 Mon Sep 17 00:00:00 2001 From: Song Guo Date: Mon, 12 Apr 2021 15:12:20 +0800 Subject: [PATCH] [controller] Use interaction model for commands --- src/app/chip_data_model.gni | 6 +----- src/app/server/Server.cpp | 2 -- src/app/zap-templates/templates/app/CHIPClusters-src.zapt | 6 ------ src/controller/CHIPDevice.cpp | 2 -- src/controller/CHIPDevice.h | 2 -- src/controller/CHIPDeviceController.cpp | 2 -- src/controller/CHIPDeviceController.h | 2 -- .../python/ChipDeviceController-ScriptBinding.cpp | 2 -- src/lib/core/BUILD.gn | 1 - src/lib/core/core.gni | 3 --- 10 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index a08807b2831dbd..a1dcca5ec70325 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -107,6 +107,7 @@ template("chip_data_model") { "${_app_root}/util/process-cluster-message.cpp", "${_app_root}/util/process-global-message.cpp", "${_app_root}/util/util.cpp", + "${invoker.zap_pregenerated_dir}/IMClusterCommandHandler.cpp", ] if (defined(invoker.cluster_sources)) { @@ -151,11 +152,6 @@ template("chip_data_model") { if (_use_default_client_callbacks) { sources += [ "${invoker.zap_pregenerated_dir}/CHIPClientCallbacks.cpp" ] } - - if (chip_enable_interaction_model) { - sources += - [ "${invoker.zap_pregenerated_dir}/IMClusterCommandHandler.cpp" ] - } } if (!defined(public_deps)) { diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index dc4f342074e14d..5f00100a64855e 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -523,10 +523,8 @@ void InitServer(AppDelegate * delegate) err = gExchangeMgr.Init(&gSessions); SuccessOrExit(err); -#if CHIP_ENABLE_INTERACTION_MODEL err = chip::app::InteractionModelEngine::GetInstance()->Init(&gExchangeMgr, nullptr); SuccessOrExit(err); -#endif #if defined(CHIP_APP_USE_ECHO) err = InitEchoHandler(&gExchangeMgr); diff --git a/src/app/zap-templates/templates/app/CHIPClusters-src.zapt b/src/app/zap-templates/templates/app/CHIPClusters-src.zapt index 52a06547e13163..ce7eb4ca622821 100644 --- a/src/app/zap-templates/templates/app/CHIPClusters-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClusters-src.zapt @@ -19,7 +19,6 @@ namespace Controller { {{#chip_server_cluster_commands}} CHIP_ERROR {{asCamelCased clusterName false}}Cluster::{{asCamelCased name false}}(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback{{#chip_server_cluster_command_arguments}}, {{chipType}} {{asCamelCased label}}{{/chip_server_cluster_command_arguments}}) { -#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -44,11 +43,6 @@ CHIP_ERROR {{asCamelCased clusterName false}}Cluster::{{asCamelCased name false} ReturnErrorOnFailure(ZCLcommand->FinishCommand()); return mDevice->SendCommands(); -#else - uint8_t seqNum = mDevice->GetNextSequenceNumber(); - System::PacketBufferHandle encodedCommand = encode{{asCamelCased clusterName false}}Cluster{{asType name}}Command(seqNum, mEndpoint{{#chip_server_cluster_command_arguments}}, {{asCamelCased label}}{{/chip_server_cluster_command_arguments}}); - return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); -#endif } {{/chip_server_cluster_commands}} diff --git a/src/controller/CHIPDevice.cpp b/src/controller/CHIPDevice.cpp index b8f2822f1f479e..23e952c9e67559 100644 --- a/src/controller/CHIPDevice.cpp +++ b/src/controller/CHIPDevice.cpp @@ -417,10 +417,8 @@ void Device::InitCommandSender() mCommandSender->Shutdown(); mCommandSender = nullptr; } -#if CHIP_ENABLE_INTERACTION_MODEL CHIP_ERROR err = chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&mCommandSender); ChipLogFunctError(err); -#endif } } // namespace Controller diff --git a/src/controller/CHIPDevice.h b/src/controller/CHIPDevice.h index 83033234c836ec..4015411efc319d 100644 --- a/src/controller/CHIPDevice.h +++ b/src/controller/CHIPDevice.h @@ -166,9 +166,7 @@ class DLL_EXPORT Device mBleLayer = params.bleLayer; #endif -#if CHIP_ENABLE_INTERACTION_MODEL InitCommandSender(); -#endif } /** diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index e239a86a7edad2..475b4e7841cac4 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -186,10 +186,8 @@ CHIP_ERROR DeviceController::Init(NodeId localDeviceId, ControllerInitParams par err = mExchangeMgr->RegisterUnsolicitedMessageHandlerForProtocol(Protocols::TempZCL::Id, this); SuccessOrExit(err); -#if CHIP_ENABLE_INTERACTION_MODEL err = chip::app::InteractionModelEngine::GetInstance()->Init(mExchangeMgr, params.imDelegate); SuccessOrExit(err); -#endif mExchangeMgr->SetDelegate(this); diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 3c62ac05531df8..09a4ca61553729 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -68,9 +68,7 @@ struct ControllerInitParams #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * bleLayer = nullptr; #endif -#if CHIP_ENABLE_INTERACTION_MODEL app::InteractionModelDelegate * imDelegate = nullptr; -#endif #if CHIP_DEVICE_CONFIG_ENABLE_MDNS DeviceAddressUpdateDelegate * mDeviceAddressUpdateDelegate = nullptr; #endif diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 2e0f97b7ac909a..4e50f72bcda786 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -139,9 +139,7 @@ CHIP_ERROR pychip_DeviceController_NewDeviceController(chip::Controller::DeviceC localDeviceId = kDefaultLocalDeviceId; } -#if CHIP_ENABLE_INTERACTION_MODEL initParams.imDelegate = &PythonInteractionModelDelegate::Instance(); -#endif SuccessOrExit(err = (*outDevCtrl)->Init(localDeviceId, initParams, &sPairingDelegate)); SuccessOrExit(err = (*outDevCtrl)->ServiceEvents()); diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index 63ceb6d754bd61..e60a34ddff2752 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -56,7 +56,6 @@ buildconfig_header("chip_buildconfig") { "CHIP_CONFIG_MEMORY_DEBUG_CHECKS=${chip_config_memory_debug_checks}", "CHIP_CONFIG_MEMORY_DEBUG_DMALLOC=${chip_config_memory_debug_dmalloc}", "CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES=false", - "CHIP_ENABLE_INTERACTION_MODEL=${chip_enable_interaction_model}", ] } diff --git a/src/lib/core/core.gni b/src/lib/core/core.gni index 5b4b7951806aff..15d6ea268c3757 100644 --- a/src/lib/core/core.gni +++ b/src/lib/core/core.gni @@ -44,9 +44,6 @@ declare_args() { # Memory management debug option: use dmalloc chip_config_memory_debug_dmalloc = false - - # Overall experimental options for CHIP - chip_enable_interaction_model = false } if (chip_target_style == "") {