Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a3fe1a0

Browse files
wqx6restyled-commits
authored andcommittedJul 21, 2023
[app] Add option to disable Read Client (project-chip#28050)
* Add option to disable Read Client * Restyled by gn --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent ad8f15d commit a3fe1a0

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed
 

‎config/esp32/components/chip/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ if(CONFIG_DISABLE_IPV4)
124124
chip_gn_arg_append("chip_inet_config_enable_ipv4" "false")
125125
endif()
126126

127+
if(CONFIG_DISABLE_READ_CLIENT)
128+
chip_gn_arg_append("chip_enable_read_client" "false")
129+
endif()
130+
127131
if(CHIP_CODEGEN_PREGEN_DIR)
128132
chip_gn_arg_append("chip_code_pre_generated_directory" "\"${CHIP_CODEGEN_PREGEN_DIR}\"")
129133
endif()

‎config/esp32/components/chip/Kconfig

+6
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ menu "CHIP Core"
108108
help
109109
Matter spec is based on IPv6 communication only. Enabling this option may save some flash/ram.
110110

111+
config DISABLE_READ_CLIENT
112+
bool "Disable read client in Interaction Model"
113+
default n
114+
help
115+
Some device types don't require the read client. Enabling this option may save some flash/ram.
116+
111117
config BUILD_CHIP_TESTS
112118
bool "Build CHIP tests"
113119
default n

‎examples/lighting-app/esp32/sdkconfig.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y
5858

5959
# Enable HKDF in mbedtls
6060
CONFIG_MBEDTLS_HKDF_C=y
61+
62+
# Disable Read Client
63+
CONFIG_DISABLE_READ_CLIENT=y

‎src/app/BUILD.gn

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ declare_args() {
4343
chip_im_force_fabric_quota_check = false
4444

4545
enable_eventlist_attribute = true
46+
chip_enable_read_client = true
4647
}
4748

4849
buildconfig_header("app_buildconfig") {
@@ -57,6 +58,7 @@ buildconfig_header("app_buildconfig") {
5758
"CHIP_CONFIG_PERSIST_SUBSCRIPTIONS=${chip_persist_subscriptions}",
5859
"CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE=${enable_eventlist_attribute}",
5960
"CHIP_CONFIG_ENABLE_ICD_SERVER=${chip_enable_icd_server}",
61+
"CHIP_CONFIG_ENABLE_READ_CLIENT=${chip_enable_read_client}",
6062
]
6163
}
6264

@@ -178,7 +180,6 @@ static_library("app") {
178180
"OperationalSessionSetup.cpp",
179181
"OperationalSessionSetup.h",
180182
"OperationalSessionSetupPool.h",
181-
"ReadClient.cpp",
182183
"ReadHandler.cpp",
183184
"RequiredPrivilege.cpp",
184185
"RequiredPrivilege.h",
@@ -206,6 +207,10 @@ static_library("app") {
206207
]
207208
}
208209

210+
if (chip_enable_read_client) {
211+
sources += [ "ReadClient.cpp" ]
212+
}
213+
209214
public_deps = [
210215
":app_config",
211216
"${chip_root}/src/access",

‎src/app/InteractionModelEngine.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -878,10 +878,12 @@ CHIP_ERROR InteractionModelEngine::OnMessageReceived(Messaging::ExchangeContext
878878
status =
879879
OnReadInitialRequest(apExchangeContext, aPayloadHeader, std::move(aPayload), ReadHandler::InteractionType::Subscribe);
880880
}
881+
#if CHIP_CONFIG_ENABLE_READ_CLIENT
881882
else if (aPayloadHeader.HasMessageType(Protocols::InteractionModel::MsgType::ReportData))
882883
{
883884
status = OnUnsolicitedReportData(apExchangeContext, aPayloadHeader, std::move(aPayload));
884885
}
886+
#endif // CHIP_CONFIG_ENABLE_READ_CLIENT
885887
else if (aPayloadHeader.HasMessageType(MsgType::TimedRequest))
886888
{
887889
OnTimedRequest(apExchangeContext, aPayloadHeader, std::move(aPayload), status);
@@ -1723,7 +1725,7 @@ void InteractionModelEngine::OnFabricRemoved(const FabricTable & fabricTable, Fa
17231725

17241726
return Loop::Continue;
17251727
});
1726-
1728+
#if CHIP_CONFIG_ENABLE_READ_CLIENT
17271729
for (auto * readClient = mpActiveReadClientList; readClient != nullptr; readClient = readClient->GetNextClient())
17281730
{
17291731
if (readClient->GetFabricIndex() == fabricIndex)
@@ -1732,6 +1734,7 @@ void InteractionModelEngine::OnFabricRemoved(const FabricTable & fabricTable, Fa
17321734
readClient->Close(CHIP_ERROR_IM_FABRIC_DELETED, false);
17331735
}
17341736
}
1737+
#endif // CHIP_CONFIG_ENABLE_READ_CLIENT
17351738

17361739
for (auto & handler : mWriteHandlers)
17371740
{

0 commit comments

Comments
 (0)
Please sign in to comment.