Skip to content

Commit

Permalink
[controller] Use interaction model for commands
Browse files Browse the repository at this point in the history
  • Loading branch information
erjiaqing committed Apr 28, 2021
1 parent e2b2f30 commit 1725893
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 27 deletions.
6 changes: 1 addition & 5 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 0 additions & 2 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions src/app/zap-templates/templates/app/CHIPClusters-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}}
Expand Down
2 changes: 0 additions & 2 deletions src/controller/CHIPDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/controller/CHIPDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ class DLL_EXPORT Device
mBleLayer = params.bleLayer;
#endif

#if CHIP_ENABLE_INTERACTION_MODEL
InitCommandSender();
#endif
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions src/controller/CHIPDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/controller/python/ChipDeviceController-ScriptBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
]
}

Expand Down
3 changes: 0 additions & 3 deletions src/lib/core/core.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "") {
Expand Down

0 comments on commit 1725893

Please sign in to comment.