Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nwprov] Add missing debugText and index to some synchronous commands #16676

Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/bridge-app/bridge-common/bridge-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/door-lock-app/door-lock-common/door-lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/lighting-app/lighting-common/lighting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/lock-app/lock-common/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/pump-app/pump-common/pump-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/thermostat/thermostat-common/thermostat.matter
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
6 changes: 4 additions & 2 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,8 @@ client cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down Expand Up @@ -1312,7 +1313,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
3 changes: 2 additions & 1 deletion examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ server cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
53 changes: 49 additions & 4 deletions src/app/clusters/network-commissioning/network-commissioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,66 @@ void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetw
}
}

namespace {

void FillDebugTextAndNetworkIndex(Commands::NetworkConfigResponse::Type & response, MutableCharSpan debugText, uint8_t networkIndex)
{
if (debugText.size() > 0)
{
response.debugText.SetValue(CharSpan(debugText.data(), debugText.size()));
}
if (response.networkingStatus == NetworkCommissioningStatus::kSuccess)
{
response.networkIndex.SetValue(networkIndex);
}
}

} // namespace

void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning");
Commands::NetworkConfigResponse::Type response;
response.networkingStatus = ToClusterObjectEnum(mpDriver.Get<WiFiDriver *>()->AddOrUpdateNetwork(req.ssid, req.credentials));
MutableCharSpan debugText;
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
debugText = MutableCharSpan(debugTextBuffer);
#endif
uint8_t outNetworkIndex = 0;
response.networkingStatus = ToClusterObjectEnum(
mpDriver.Get<WiFiDriver *>()->AddOrUpdateNetwork(req.ssid, req.credentials, debugText, outNetworkIndex));
FillDebugTextAndNetworkIndex(response, debugText, outNetworkIndex);
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
}

void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning");
Commands::NetworkConfigResponse::Type response;
response.networkingStatus = ToClusterObjectEnum(mpDriver.Get<ThreadDriver *>()->AddOrUpdateNetwork(req.operationalDataset));
MutableCharSpan debugText;
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
debugText = MutableCharSpan(debugTextBuffer);
#endif
uint8_t outNetworkIndex = 0;
response.networkingStatus =
ToClusterObjectEnum(mpDriver.Get<ThreadDriver *>()->AddOrUpdateNetwork(req.operationalDataset, debugText, outNetworkIndex));
FillDebugTextAndNetworkIndex(response, debugText, outNetworkIndex);
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
}

void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveNetwork::DecodableType & req)
{
MATTER_TRACE_EVENT_SCOPE("HandleRemoveNetwork", "NetworkCommissioning");
Commands::NetworkConfigResponse::Type response;
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->RemoveNetwork(req.networkID));
MutableCharSpan debugText;
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
debugText = MutableCharSpan(debugTextBuffer);
#endif
uint8_t outNetworkIndex = 0;
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->RemoveNetwork(req.networkID, debugText, outNetworkIndex));
FillDebugTextAndNetworkIndex(response, debugText, outNetworkIndex);
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
}

Expand All @@ -330,7 +369,13 @@ void Instance::HandleReorderNetwork(HandlerContext & ctx, const Commands::Reorde
{
MATTER_TRACE_EVENT_SCOPE("HandleReorderNetwork", "NetworkCommissioning");
Commands::NetworkConfigResponse::Type response;
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->ReorderNetwork(req.networkID, req.networkIndex));
MutableCharSpan debugText;
#if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE
char debugTextBuffer[CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE];
debugText = MutableCharSpan(debugTextBuffer);
#endif
response.networkingStatus = ToClusterObjectEnum(mpWirelessDriver->ReorderNetwork(req.networkID, req.networkIndex, debugText));
FillDebugTextAndNetworkIndex(response, debugText, req.networkIndex);
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
}

Expand Down
3 changes: 2 additions & 1 deletion src/app/zap-templates/zcl/data-model/chip/commissioning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ limitations under the License.
<command source="server" code="0x05" name="NetworkConfigResponse" optional="true" cli="chip network_commissioning addwifiresponse">
<description>TODO</description>
<arg name="NetworkingStatus" type="NetworkCommissioningStatus"/>
<arg name="DebugText" type="CHAR_STRING"/>
<arg name="DebugText" type="CHAR_STRING" optional="true" />
<arg name="NetworkIndex" type="INT8U" optional="true" />
</command>
<command source="client" code="0x06" name="ConnectNetwork" optional="false" response="ConnectNetworkResponse" cli="chip network_commissioning connectnetwork">
<description>TODO</description>
Expand Down
3 changes: 2 additions & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,8 @@ client cluster NetworkCommissioning = 49 {

response struct NetworkConfigResponse {
NetworkCommissioningStatus networkingStatus = 0;
CHAR_STRING debugText = 1;
optional CHAR_STRING debugText = 1;
optional INT8U networkIndex = 2;
}

response struct ConnectNetworkResponse {
Expand Down
33 changes: 29 additions & 4 deletions src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/controller/python/chip/clusters/Objects.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading