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

Implement ResetCounts command for Network Diagnostics Cluster #8679

Merged
merged 1 commit into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,29 @@
*/

#include <app/CommandHandler.h>
#include <app/common/gen/attributes/Accessors.h>
#include <app/util/af.h>

using namespace chip::app::Clusters;

bool emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj)
{
// TODO: Implement the ResetCounts in the platform layer.
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
EmberAfStatus status = EthernetNetworkDiagnostics::Attributes::SetPacketRxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset PacketRxCount attribute"));

status = EthernetNetworkDiagnostics::Attributes::SetPacketTxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset PacketTxCount attribute"));

status = EthernetNetworkDiagnostics::Attributes::SetTxErrCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset TxErrCount attribute"));

status = EthernetNetworkDiagnostics::Attributes::SetCollisionCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset CollisionCount attribute"));

status = EthernetNetworkDiagnostics::Attributes::SetOverrunCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset OverrunCount attribute"));

exit:
emberAfSendImmediateDefaultResponse(status);
return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
*/

#include <app/CommandHandler.h>
#include <app/common/gen/attributes/Accessors.h>
#include <app/util/af.h>

using namespace chip::app::Clusters;

bool emberAfThreadNetworkDiagnosticsClusterResetCountsCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj)
{
// TODO: Implement the ResetCounts in the platform layer.
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
EmberAfStatus status = ThreadNetworkDiagnostics::Attributes::SetOverrunCount(endpoint, 0);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogError(Zcl, "Failed to reset OverrunCount attribute");
}

emberAfSendImmediateDefaultResponse(status);
return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,36 @@
*/

#include <app/CommandHandler.h>
#include <app/common/gen/attributes/Accessors.h>
#include <app/util/af.h>

using namespace chip::app::Clusters;

bool emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj)
{
// TODO: Implement the ResetCounts in the platform layer.
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
EmberAfStatus status = WiFiNetworkDiagnostics::Attributes::SetBeaconLostCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset BeaconLostCount attribute"));

status = WiFiNetworkDiagnostics::Attributes::SetBeaconRxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset BeaconRxCount attribute"));

status = WiFiNetworkDiagnostics::Attributes::SetPacketMulticastRxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset PacketMulticastRxCount attribute"));

status = WiFiNetworkDiagnostics::Attributes::SetPacketMulticastTxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset PacketMulticastTxCount attribute"));

status = WiFiNetworkDiagnostics::Attributes::SetPacketUnicastRxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset PacketUnicastRxCount attribute"));

status = WiFiNetworkDiagnostics::Attributes::SetPacketUnicastTxCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset PacketUnicastTxCount attribute"));

status = WiFiNetworkDiagnostics::Attributes::SetOverrunCount(endpoint, 0);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to reset OverrunCount attribute"));

exit:
emberAfSendImmediateDefaultResponse(status);

return true;
}