Skip to content

Commit 9895713

Browse files
erjiaqingpull[bot]
authored andcommitted
[nwprov] Add missing debugText and index to some synchronous commands (#16676)
* [nwprov] Add missing debugText and index to some synchronous commands * string search / replace for platform code * Run codegen * Address comments * Update examples * Fix * Fix * Fix * Fix * Run Codegen
1 parent b90d509 commit 9895713

File tree

54 files changed

+346
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+346
-104
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,8 @@ server cluster NetworkCommissioning = 49 {
21082108

21092109
response struct NetworkConfigResponse {
21102110
NetworkCommissioningStatus networkingStatus = 0;
2111-
CHAR_STRING debugText = 1;
2111+
optional CHAR_STRING debugText = 1;
2112+
optional INT8U networkIndex = 2;
21122113
}
21132114

21142115
response struct ConnectNetworkResponse {

examples/bridge-app/bridge-common/bridge-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ server cluster NetworkCommissioning = 49 {
628628

629629
response struct NetworkConfigResponse {
630630
NetworkCommissioningStatus networkingStatus = 0;
631-
CHAR_STRING debugText = 1;
631+
optional CHAR_STRING debugText = 1;
632+
optional INT8U networkIndex = 2;
632633
}
633634

634635
response struct ConnectNetworkResponse {

examples/door-lock-app/door-lock-common/door-lock-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,8 @@ server cluster NetworkCommissioning = 49 {
10251025

10261026
response struct NetworkConfigResponse {
10271027
NetworkCommissioningStatus networkingStatus = 0;
1028-
CHAR_STRING debugText = 1;
1028+
optional CHAR_STRING debugText = 1;
1029+
optional INT8U networkIndex = 2;
10291030
}
10301031

10311032
response struct ConnectNetworkResponse {

examples/light-switch-app/light-switch-common/light-switch-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,8 @@ server cluster NetworkCommissioning = 49 {
917917

918918
response struct NetworkConfigResponse {
919919
NetworkCommissioningStatus networkingStatus = 0;
920-
CHAR_STRING debugText = 1;
920+
optional CHAR_STRING debugText = 1;
921+
optional INT8U networkIndex = 2;
921922
}
922923

923924
response struct ConnectNetworkResponse {

examples/lighting-app/lighting-common/lighting-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,8 @@ server cluster NetworkCommissioning = 49 {
988988

989989
response struct NetworkConfigResponse {
990990
NetworkCommissioningStatus networkingStatus = 0;
991-
CHAR_STRING debugText = 1;
991+
optional CHAR_STRING debugText = 1;
992+
optional INT8U networkIndex = 2;
992993
}
993994

994995
response struct ConnectNetworkResponse {

examples/lock-app/lock-common/lock-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ server cluster NetworkCommissioning = 49 {
481481

482482
response struct NetworkConfigResponse {
483483
NetworkCommissioningStatus networkingStatus = 0;
484-
CHAR_STRING debugText = 1;
484+
optional CHAR_STRING debugText = 1;
485+
optional INT8U networkIndex = 2;
485486
}
486487

487488
response struct ConnectNetworkResponse {

examples/log-source-app/log-source-common/log-source-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ server cluster NetworkCommissioning = 49 {
272272

273273
response struct NetworkConfigResponse {
274274
NetworkCommissioningStatus networkingStatus = 0;
275-
CHAR_STRING debugText = 1;
275+
optional CHAR_STRING debugText = 1;
276+
optional INT8U networkIndex = 2;
276277
}
277278

278279
response struct ConnectNetworkResponse {

examples/ota-provider-app/ota-provider-common/ota-provider-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ server cluster NetworkCommissioning = 49 {
345345

346346
response struct NetworkConfigResponse {
347347
NetworkCommissioningStatus networkingStatus = 0;
348-
CHAR_STRING debugText = 1;
348+
optional CHAR_STRING debugText = 1;
349+
optional INT8U networkIndex = 2;
349350
}
350351

351352
response struct ConnectNetworkResponse {

examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ server cluster NetworkCommissioning = 49 {
318318

319319
response struct NetworkConfigResponse {
320320
NetworkCommissioningStatus networkingStatus = 0;
321-
CHAR_STRING debugText = 1;
321+
optional CHAR_STRING debugText = 1;
322+
optional INT8U networkIndex = 2;
322323
}
323324

324325
response struct ConnectNetworkResponse {

examples/placeholder/linux/apps/app1/config.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,8 @@ server cluster NetworkCommissioning = 49 {
11751175

11761176
response struct NetworkConfigResponse {
11771177
NetworkCommissioningStatus networkingStatus = 0;
1178-
CHAR_STRING debugText = 1;
1178+
optional CHAR_STRING debugText = 1;
1179+
optional INT8U networkIndex = 2;
11791180
}
11801181

11811182
response struct ConnectNetworkResponse {

examples/placeholder/linux/apps/app2/config.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,8 @@ server cluster NetworkCommissioning = 49 {
11751175

11761176
response struct NetworkConfigResponse {
11771177
NetworkCommissioningStatus networkingStatus = 0;
1178-
CHAR_STRING debugText = 1;
1178+
optional CHAR_STRING debugText = 1;
1179+
optional INT8U networkIndex = 2;
11791180
}
11801181

11811182
response struct ConnectNetworkResponse {

examples/pump-app/pump-common/pump-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ server cluster NetworkCommissioning = 49 {
728728

729729
response struct NetworkConfigResponse {
730730
NetworkCommissioningStatus networkingStatus = 0;
731-
CHAR_STRING debugText = 1;
731+
optional CHAR_STRING debugText = 1;
732+
optional INT8U networkIndex = 2;
732733
}
733734

734735
response struct ConnectNetworkResponse {

examples/pump-controller-app/pump-controller-common/pump-controller-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ server cluster NetworkCommissioning = 49 {
639639

640640
response struct NetworkConfigResponse {
641641
NetworkCommissioningStatus networkingStatus = 0;
642-
CHAR_STRING debugText = 1;
642+
optional CHAR_STRING debugText = 1;
643+
optional INT8U networkIndex = 2;
643644
}
644645

645646
response struct ConnectNetworkResponse {

examples/temperature-measurement-app/esp32/main/temperature-measurement.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ server cluster NetworkCommissioning = 49 {
474474

475475
response struct NetworkConfigResponse {
476476
NetworkCommissioningStatus networkingStatus = 0;
477-
CHAR_STRING debugText = 1;
477+
optional CHAR_STRING debugText = 1;
478+
optional INT8U networkIndex = 2;
478479
}
479480

480481
response struct ConnectNetworkResponse {

examples/thermostat/thermostat-common/thermostat.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,8 @@ server cluster NetworkCommissioning = 49 {
649649

650650
response struct NetworkConfigResponse {
651651
NetworkCommissioningStatus networkingStatus = 0;
652-
CHAR_STRING debugText = 1;
652+
optional CHAR_STRING debugText = 1;
653+
optional INT8U networkIndex = 2;
653654
}
654655

655656
response struct ConnectNetworkResponse {

examples/tv-app/tv-common/tv-app.matter

+4-2
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,8 @@ client cluster NetworkCommissioning = 49 {
11871187

11881188
response struct NetworkConfigResponse {
11891189
NetworkCommissioningStatus networkingStatus = 0;
1190-
CHAR_STRING debugText = 1;
1190+
optional CHAR_STRING debugText = 1;
1191+
optional INT8U networkIndex = 2;
11911192
}
11921193

11931194
response struct ConnectNetworkResponse {
@@ -1312,7 +1313,8 @@ server cluster NetworkCommissioning = 49 {
13121313

13131314
response struct NetworkConfigResponse {
13141315
NetworkCommissioningStatus networkingStatus = 0;
1315-
CHAR_STRING debugText = 1;
1316+
optional CHAR_STRING debugText = 1;
1317+
optional INT8U networkIndex = 2;
13161318
}
13171319

13181320
response struct ConnectNetworkResponse {

examples/tv-casting-app/tv-casting-common/tv-casting-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,8 @@ server cluster NetworkCommissioning = 49 {
13381338

13391339
response struct NetworkConfigResponse {
13401340
NetworkCommissioningStatus networkingStatus = 0;
1341-
CHAR_STRING debugText = 1;
1341+
optional CHAR_STRING debugText = 1;
1342+
optional INT8U networkIndex = 2;
13421343
}
13431344

13441345
response struct ConnectNetworkResponse {

examples/window-app/common/window-app.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ server cluster NetworkCommissioning = 49 {
494494

495495
response struct NetworkConfigResponse {
496496
NetworkCommissioningStatus networkingStatus = 0;
497-
CHAR_STRING debugText = 1;
497+
optional CHAR_STRING debugText = 1;
498+
optional INT8U networkIndex = 2;
498499
}
499500

500501
response struct ConnectNetworkResponse {

src/app/clusters/network-commissioning/network-commissioning.cpp

+49-4
Original file line numberDiff line numberDiff line change
@@ -286,27 +286,66 @@ void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetw
286286
}
287287
}
288288

289+
namespace {
290+
291+
void FillDebugTextAndNetworkIndex(Commands::NetworkConfigResponse::Type & response, MutableCharSpan debugText, uint8_t networkIndex)
292+
{
293+
if (debugText.size() > 0)
294+
{
295+
response.debugText.SetValue(CharSpan(debugText.data(), debugText.size()));
296+
}
297+
if (response.networkingStatus == NetworkCommissioningStatus::kSuccess)
298+
{
299+
response.networkIndex.SetValue(networkIndex);
300+
}
301+
}
302+
303+
} // namespace
304+
289305
void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req)
290306
{
291307
MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning");
292308
Commands::NetworkConfigResponse::Type response;
293-
response.networkingStatus = ToClusterObjectEnum(mpDriver.Get<WiFiDriver *>()->AddOrUpdateNetwork(req.ssid, req.credentials));
309+
MutableCharSpan debugText;
310+
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
311+
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
312+
debugText = MutableCharSpan(debugTextBuffer);
313+
#endif
314+
uint8_t outNetworkIndex = 0;
315+
response.networkingStatus = ToClusterObjectEnum(
316+
mpDriver.Get<WiFiDriver *>()->AddOrUpdateNetwork(req.ssid, req.credentials, debugText, outNetworkIndex));
317+
FillDebugTextAndNetworkIndex(response, debugText, outNetworkIndex);
294318
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
295319
}
296320

297321
void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req)
298322
{
299323
MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning");
300324
Commands::NetworkConfigResponse::Type response;
301-
response.networkingStatus = ToClusterObjectEnum(mpDriver.Get<ThreadDriver *>()->AddOrUpdateNetwork(req.operationalDataset));
325+
MutableCharSpan debugText;
326+
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
327+
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
328+
debugText = MutableCharSpan(debugTextBuffer);
329+
#endif
330+
uint8_t outNetworkIndex = 0;
331+
response.networkingStatus =
332+
ToClusterObjectEnum(mpDriver.Get<ThreadDriver *>()->AddOrUpdateNetwork(req.operationalDataset, debugText, outNetworkIndex));
333+
FillDebugTextAndNetworkIndex(response, debugText, outNetworkIndex);
302334
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
303335
}
304336

305337
void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveNetwork::DecodableType & req)
306338
{
307339
MATTER_TRACE_EVENT_SCOPE("HandleRemoveNetwork", "NetworkCommissioning");
308340
Commands::NetworkConfigResponse::Type response;
309-
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->RemoveNetwork(req.networkID));
341+
MutableCharSpan debugText;
342+
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
343+
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
344+
debugText = MutableCharSpan(debugTextBuffer);
345+
#endif
346+
uint8_t outNetworkIndex = 0;
347+
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->RemoveNetwork(req.networkID, debugText, outNetworkIndex));
348+
FillDebugTextAndNetworkIndex(response, debugText, outNetworkIndex);
310349
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
311350
}
312351

@@ -330,7 +369,13 @@ void Instance::HandleReorderNetwork(HandlerContext & ctx, const Commands::Reorde
330369
{
331370
MATTER_TRACE_EVENT_SCOPE("HandleReorderNetwork", "NetworkCommissioning");
332371
Commands::NetworkConfigResponse::Type response;
333-
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->ReorderNetwork(req.networkID, req.networkIndex));
372+
MutableCharSpan debugText;
373+
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
374+
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
375+
debugText = MutableCharSpan(debugTextBuffer);
376+
#endif
377+
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->ReorderNetwork(req.networkID, req.networkIndex, debugText));
378+
FillDebugTextAndNetworkIndex(response, debugText, req.networkIndex);
334379
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
335380
}
336381

src/app/zap-templates/zcl/data-model/chip/commissioning.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ limitations under the License.
122122
<command source="server" code="0x05" name="NetworkConfigResponse" optional="true" cli="chip network_commissioning addwifiresponse">
123123
<description>TODO</description>
124124
<arg name="NetworkingStatus" type="NetworkCommissioningStatus"/>
125-
<arg name="DebugText" type="CHAR_STRING"/>
125+
<arg name="DebugText" type="CHAR_STRING" optional="true" />
126+
<arg name="NetworkIndex" type="INT8U" optional="true" />
126127
</command>
127128
<command source="client" code="0x06" name="ConnectNetwork" optional="false" response="ConnectNetworkResponse" cli="chip network_commissioning connectnetwork">
128129
<description>TODO</description>

src/controller/data_model/controller-clusters.matter

+2-1
Original file line numberDiff line numberDiff line change
@@ -2505,7 +2505,8 @@ client cluster NetworkCommissioning = 49 {
25052505

25062506
response struct NetworkConfigResponse {
25072507
NetworkCommissioningStatus networkingStatus = 0;
2508-
CHAR_STRING debugText = 1;
2508+
optional CHAR_STRING debugText = 1;
2509+
optional INT8U networkIndex = 2;
25092510
}
25102511

25112512
response struct ConnectNetworkResponse {

src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp

+29-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java

+7-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/python/chip/clusters/Objects.py

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)