Skip to content

Commit

Permalink
Added cluster specific traces
Browse files Browse the repository at this point in the history
  • Loading branch information
shripad621git committed Jan 11, 2024
1 parent 636efca commit d25434b
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <protocols/interaction_model/Constants.h>
#include <setup_payload/SetupPayload.h>
#include <system/SystemClock.h>
#include <tracing/macros.h>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -82,6 +83,7 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(
app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::OpenCommissioningWindow::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("OpenCommissioningWindow", "AdministratorCommissioning");
auto commissioningTimeout = System::Clock::Seconds16(commandData.commissioningTimeout);
auto & pakeVerifier = commandData.PAKEPasscodeVerifier;
auto & discriminator = commandData.discriminator;
Expand Down Expand Up @@ -141,6 +143,7 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac
app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::OpenBasicCommissioningWindow::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("OpenBasicCommissioningWindow", "AdministratorCommissioning");
auto commissioningTimeout = System::Clock::Seconds16(commandData.commissioningTimeout);

Optional<StatusCode> status = Optional<StatusCode>::Missing();
Expand Down Expand Up @@ -187,6 +190,7 @@ bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(
app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::RevokeCommissioning::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("RevokeCommissioning", "AdministratorCommissioning");
ChipLogProgress(Zcl, "Received command to close commissioning window");

Server::GetInstance().GetFailSafeContext().ForceFailSafeTimerExpiry();
Expand Down
3 changes: 3 additions & 0 deletions src/app/clusters/basic-information/basic-information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <cstddef>
#include <cstring>
#include <tracing/macros.h>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -410,6 +411,7 @@ class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate
{
void OnStartUp(uint32_t softwareVersion) override
{
MATTER_TRACE_INSTANT("OnStartUp", "BasicInfo");
// The StartUp event SHALL be emitted by a Node after completing a boot or reboot process
ChipLogDetail(Zcl, "Emitting StartUp event");

Expand All @@ -429,6 +431,7 @@ class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate

void OnShutDown() override
{
MATTER_TRACE_INSTANT("OnShutDown", "BasicInfo");
// The ShutDown event SHOULD be emitted on a best-effort basis by a Node prior to any orderly shutdown sequence.
ChipLogDetail(Zcl, "Emitting ShutDown event");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <app/util/basic-types.h>
#include <lib/core/CHIPError.h>
#include <lib/support/logging/CHIPLogging.h>
#include <tracing/macros.h>

using namespace chip;
using namespace chip::app;
Expand All @@ -36,6 +37,7 @@ namespace {

void ReachableChanged(EndpointId endpointId)
{
MATTER_TRACE_INSTANT("ReachableChanged", "BridgeBasicInfo");
bool reachable = false;
if (EMBER_ZCL_STATUS_SUCCESS != Attributes::Reachable::Get(endpointId, &reachable))
{
Expand Down
10 changes: 10 additions & 0 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <app/util/config.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>
#include <tracing/macros.h>

#ifdef EMBER_AF_PLUGIN_SCENES
#include <app/clusters/scenes-server/scenes-server.h>
Expand Down Expand Up @@ -1354,6 +1355,7 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const
HueMoveMode moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride,
bool isEnhanced)
{
MATTER_TRACE_SCOPE("moveHue", "ColorControl");
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;
ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint);
Expand Down Expand Up @@ -1459,6 +1461,7 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons
uint16_t hue, HueDirection moveDirection, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced)
{
MATTER_TRACE_SCOPE("moveToHue", "ColorControl");
EndpointId endpoint = commandPath.mEndpointId;

Status status = Status::Success;
Expand Down Expand Up @@ -1593,6 +1596,7 @@ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * com
uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced)
{
MATTER_TRACE_SCOPE("moveToHueAndSaturation", "ColorControl");
// limit checking: hue and saturation are 0..254. Spec dictates we ignore
// this and report a constraint error.
if ((!isEnhanced && hue > MAX_HUE_VALUE) || saturation > MAX_SATURATION_VALUE)
Expand Down Expand Up @@ -1632,6 +1636,7 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const
HueStepMode stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced)
{
MATTER_TRACE_SCOPE("stepHue", "ColorControl");
EndpointId endpoint = commandPath.mEndpointId;

Status status = Status::Success;
Expand Down Expand Up @@ -1715,6 +1720,7 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const
bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::MoveSaturation::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("moveSaturation", "ColorControl");
auto & moveMode = commandData.moveMode;
auto & rate = commandData.rate;
auto & optionsMask = commandData.optionsMask;
Expand Down Expand Up @@ -1798,6 +1804,7 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj,
bool ColorControlServer::moveToSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::MoveToSaturation::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("moveToSaturatio", "ColorControl");
// limit checking: saturation is 0..254. Spec dictates we ignore
// this and report a malformed packet.
if (commandData.saturation > MAX_SATURATION_VALUE)
Expand All @@ -1822,6 +1829,7 @@ bool ColorControlServer::moveToSaturationCommand(app::CommandHandler * commandOb
bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::StepSaturation::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("stepSaturation", "ColorControl");
auto stepMode = commandData.stepMode;
uint8_t stepSize = commandData.stepSize;
uint8_t transitionTime = commandData.transitionTime;
Expand Down Expand Up @@ -1885,6 +1893,7 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj,
bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::ColorLoopSet::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("colorLoop", "ColorControl");
auto updateFlags = commandData.updateFlags;
auto action = commandData.action;
auto direction = commandData.direction;
Expand Down Expand Up @@ -2010,6 +2019,7 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons
*/
void ColorControlServer::updateHueSatCommand(EndpointId endpoint)
{
MATTER_TRACE_SCOPE("updateHueSat", "ColorControl");
ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint);
Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint);

Expand Down
7 changes: 7 additions & 0 deletions src/app/clusters/groups-server/groups-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <credentials/GroupDataProvider.h>
#include <inttypes.h>
#include <lib/support/CodeUtils.h>
#include <tracing/macros.h>

#ifdef EMBER_AF_PLUGIN_SCENES
#include <app/clusters/scenes-server/scenes-server.h>
Expand Down Expand Up @@ -141,6 +142,7 @@ void emberAfGroupsClusterServerInitCallback(EndpointId endpointId)
bool emberAfGroupsClusterAddGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::AddGroup::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("AddGroup", "Groups");
auto fabricIndex = commandObj->GetAccessingFabricIndex();
Groups::Commands::AddGroupResponse::Type response;

Expand All @@ -153,6 +155,7 @@ bool emberAfGroupsClusterAddGroupCallback(app::CommandHandler * commandObj, cons
bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::ViewGroup::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("ViewGroup", "Groups");
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto groupId = commandData.groupID;
GroupDataProvider * provider = GetGroupDataProvider();
Expand Down Expand Up @@ -255,6 +258,7 @@ struct GroupMembershipResponse
bool emberAfGroupsClusterGetGroupMembershipCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::GetGroupMembership::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("GetGroupMembership", "Groups");
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto * provider = GetGroupDataProvider();
Status status = Status::Failure;
Expand Down Expand Up @@ -284,6 +288,7 @@ bool emberAfGroupsClusterGetGroupMembershipCallback(app::CommandHandler * comman
bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::RemoveGroup::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("RemoveGroup", "Groups");
auto fabricIndex = commandObj->GetAccessingFabricIndex();
Groups::Commands::RemoveGroupResponse::Type response;

Expand All @@ -301,6 +306,7 @@ bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, c
bool emberAfGroupsClusterRemoveAllGroupsCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::RemoveAllGroups::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("RemoveAllGroups", "Groups");
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto * provider = GetGroupDataProvider();
Status status = Status::Failure;
Expand Down Expand Up @@ -341,6 +347,7 @@ bool emberAfGroupsClusterAddGroupIfIdentifyingCallback(app::CommandHandler * com
const app::ConcreteCommandPath & commandPath,
const Commands::AddGroupIfIdentifying::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("AddGroupIfIdentifying", "Groups");
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto groupId = commandData.groupID;
auto groupName = commandData.groupName;
Expand Down
3 changes: 3 additions & 0 deletions src/app/clusters/identify-server/identify-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <array>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#include <tracing/macros.h>

#if CHIP_DEVICE_LAYER_NONE
#error "identify requrires a device layer"
Expand Down Expand Up @@ -196,6 +197,7 @@ void MatterIdentifyClusterServerAttributeChangedCallback(const app::ConcreteAttr
bool emberAfIdentifyClusterIdentifyCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
const Commands::Identify::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("IdentifyCommand", "Identify");
auto & identifyTime = commandData.identifyTime;

// cmd Identify
Expand All @@ -207,6 +209,7 @@ bool emberAfIdentifyClusterIdentifyCallback(CommandHandler * commandObj, const C
bool emberAfIdentifyClusterTriggerEffectCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
const Commands::TriggerEffect::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("TriggerEffect", "Identify");
auto & effectIdentifier = commandData.effectIdentifier;
auto & effectVariant = commandData.effectVariant;

Expand Down
9 changes: 9 additions & 0 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <platform/CHIPDeviceConfig.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>
#include <tracing/macros.h>

#ifdef EMBER_AF_PLUGIN_SCENES
#include <app/clusters/scenes-server/scenes-server.h>
Expand Down Expand Up @@ -577,6 +578,7 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, chip::O
bool emberAfLevelControlClusterMoveToLevelCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::MoveToLevel::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("MoveToLevel", "LevelControl");
commandObj->AddStatus(commandPath, LevelControlServer::MoveToLevel(commandPath.mEndpointId, commandData));
return true;
}
Expand Down Expand Up @@ -621,6 +623,7 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler
const app::ConcreteCommandPath & commandPath,
const Commands::MoveToLevelWithOnOff::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("MoveToLevelWithOnOff", "LevelControl");
auto & level = commandData.level;
auto & transitionTime = commandData.transitionTime;
auto & optionsMask = commandData.optionsMask;
Expand Down Expand Up @@ -650,6 +653,7 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler
bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::Move::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("Move", "LevelControl");
auto & moveMode = commandData.moveMode;
auto & rate = commandData.rate;
auto & optionsMask = commandData.optionsMask;
Expand All @@ -674,6 +678,7 @@ bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, co
bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::MoveWithOnOff::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("MoveWithOnOff", "LevelControl");
auto & moveMode = commandData.moveMode;
auto & rate = commandData.rate;
auto & optionsMask = commandData.optionsMask;
Expand All @@ -698,6 +703,7 @@ bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * comma
bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::Step::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("Step", "LevelControl");
auto & stepMode = commandData.stepMode;
auto & stepSize = commandData.stepSize;
auto & transitionTime = commandData.transitionTime;
Expand All @@ -723,6 +729,7 @@ bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, co
bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::StepWithOnOff::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("StepWithOnOff", "LevelControl");
auto & stepMode = commandData.stepMode;
auto & stepSize = commandData.stepSize;
auto & transitionTime = commandData.transitionTime;
Expand All @@ -748,6 +755,7 @@ bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * comma
bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::Stop::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("Stop", "LevelControl");
auto & optionsMask = commandData.optionsMask;
auto & optionsOverride = commandData.optionsOverride;

Expand All @@ -760,6 +768,7 @@ bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, co
bool emberAfLevelControlClusterStopWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::StopWithOnOff::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("StopWithOnOff", "LevelControl");
auto & optionsMask = commandData.optionsMask;
auto & optionsOverride = commandData.optionsOverride;
ChipLogProgress(Zcl, "%s STOP_WITH_ON_OFF", "RX level-control:");
Expand Down
2 changes: 2 additions & 0 deletions src/app/clusters/low-power-server/low-power-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <app/util/config.h>
#include <platform/CHIPDeviceConfig.h>
#include <protocols/interaction_model/StatusCode.h>
#include <tracing/macros.h>

using namespace chip;
using namespace chip::app::Clusters;
Expand Down Expand Up @@ -93,6 +94,7 @@ void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate)
bool emberAfLowPowerClusterSleepCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
const Commands::Sleep::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("Sleep", "LowPower");
using Protocols::InteractionModel::Status;

EndpointId endpoint = commandPath.mEndpointId;
Expand Down
2 changes: 2 additions & 0 deletions src/app/clusters/mode-base-server/mode-base-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <app/reporting/reporting.h>
#include <app/util/attribute-storage.h>
#include <platform/DiagnosticDataProvider.h>
#include <tracing/macros.h>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -378,6 +379,7 @@ void Instance::UnregisterThisInstance()

void Instance::HandleChangeToMode(HandlerContext & ctx, const Commands::ChangeToMode::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("ChangeToMode", "ModeBase");
uint8_t newMode = commandData.newMode;

Commands::ChangeToModeResponse::Type response;
Expand Down
2 changes: 2 additions & 0 deletions src/app/clusters/mode-select-server/mode-select-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <app/util/util.h>
#include <lib/support/CodeUtils.h>
#include <platform/DiagnosticDataProvider.h>
#include <tracing/macros.h>

#ifdef EMBER_AF_PLUGIN_ON_OFF
#include <app/clusters/on-off-server/on-off-server.h>
Expand Down Expand Up @@ -98,6 +99,7 @@ CHIP_ERROR ModeSelectAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandler, const ConcreteCommandPath & commandPath,
const ModeSelect::Commands::ChangeToMode::DecodableType & commandData)
{
MATTER_TRACE_SCOPE("ChangeToMode", "ModeSelect");
ChipLogProgress(Zcl, "ModeSelect: Entering emberAfModeSelectClusterChangeToModeCallback");
EndpointId endpointId = commandPath.mEndpointId;
uint8_t newMode = commandData.newMode;
Expand Down
Loading

0 comments on commit d25434b

Please sign in to comment.