Skip to content

Commit

Permalink
Add ChipLogFormatMEI/ChipLogValueMEI (#8375)
Browse files Browse the repository at this point in the history
* Add ChipLogFormatMEI/ChipLogValueMEI and use it

* Update gen/ folders
  • Loading branch information
vivien-apple authored and pull[bot] committed Sep 1, 2021
1 parent 8f21a03 commit d1da41e
Show file tree
Hide file tree
Showing 54 changed files with 589 additions and 396 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,8 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut
uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength);
if (!chip::CanCastTo<uint16_t>(totalSize))
{
ChipLogError(Zcl, "Cluster %" PRIx32 ": Size of attribute %" PRIx32 " is too large.", clusterId, attributeId);
ChipLogError(Zcl, "Cluster " ChipLogFormatMEI ": Size of attribute " ChipLogFormatMEI " is too large.",
ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId));
return 0;
}

Expand Down
24 changes: 15 additions & 9 deletions examples/bridge-app/bridge-common/gen/IMClusterCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id,
Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command %" PRIx32 " for cluster %" PRIx32, aCommandId, Clusters::DiagnosticLogs::Id);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(Clusters::DiagnosticLogs::Id));
return;
}
}
Expand Down Expand Up @@ -334,7 +335,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id,
Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command %" PRIx32 " for cluster %" PRIx32, aCommandId, Clusters::GeneralCommissioning::Id);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(Clusters::GeneralCommissioning::Id));
return;
}
}
Expand Down Expand Up @@ -865,7 +867,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id,
Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command %" PRIx32 " for cluster %" PRIx32, aCommandId, Clusters::LevelControl::Id);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(Clusters::LevelControl::Id));
return;
}
}
Expand Down Expand Up @@ -1553,7 +1556,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id,
Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command %" PRIx32 " for cluster %" PRIx32, aCommandId, Clusters::NetworkCommissioning::Id);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(Clusters::NetworkCommissioning::Id));
return;
}
}
Expand Down Expand Up @@ -1623,7 +1627,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id,
Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command %" PRIx32 " for cluster %" PRIx32, aCommandId, Clusters::OnOff::Id);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(Clusters::OnOff::Id));
return;
}
}
Expand Down Expand Up @@ -2130,7 +2135,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id,
Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command %" PRIx32 " for cluster %" PRIx32, aCommandId, Clusters::OperationalCredentials::Id);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(Clusters::OperationalCredentials::Id));
return;
}
}
Expand Down Expand Up @@ -2163,8 +2169,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
chip::TLV::TLVReader & aReader, CommandHandler * apCommandObj)
{
ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx32 " Command=%" PRIx32 " Endpoint=%" PRIx16, aClusterId,
aCommandId, aEndPointId);
ChipLogDetail(Zcl, "Received Cluster Command: Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " Endpoint=%" PRIx16,
ChipLogValueMEI(aClusterId), ChipLogValueMEI(aCommandId), aEndPointId);
Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
TLV::TLVType dataTlvType;
SuccessOrExit(aReader.EnterContainer(dataTlvType));
Expand Down Expand Up @@ -2222,7 +2228,7 @@ void DispatchSingleClusterResponseCommand(chip::ClusterId aClusterId, chip::Comm
(chip::app::CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogError(Zcl, "Unknown cluster %" PRIx32, aClusterId);
ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aClusterId));
break;
}
exit:
Expand Down
3 changes: 2 additions & 1 deletion examples/bridge-app/bridge-common/gen/attribute-size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut
uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength);
if (!chip::CanCastTo<uint16_t>(totalSize))
{
ChipLogError(Zcl, "Cluster %" PRIx32 ": Size of attribute %" PRIx32 " is too large.", clusterId, attributeId);
ChipLogError(Zcl, "Cluster " ChipLogFormatMEI ": Size of attribute " ChipLogFormatMEI " is too large.",
ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId));
return 0;
}

Expand Down
5 changes: 3 additions & 2 deletions examples/chip-tool/commands/clusters/ModelCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ using namespace ::chip;
void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
chip::TLV::TLVReader & aReader, Command * apCommandObj)
{
ChipLogDetail(Controller, "Received Cluster Command: Cluster=%" PRIx32 " Command=%" PRIx32 " Endpoint=%" PRIx16, aClusterId,
aCommandId, aEndPointId);
ChipLogDetail(Controller,
"Received Cluster Command: Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " Endpoint=%" PRIx16,
ChipLogValueMEI(aClusterId), ChipLogValueMEI(aCommandId), aEndPointId);
ChipLogError(
Controller,
"Default DispatchSingleClusterCommand is called, this should be replaced by actual dispatched for cluster commands");
Expand Down
29 changes: 16 additions & 13 deletions examples/lighting-app/efr32/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,46 @@

#include "LightingManager.h"

#include <app/common/gen/attribute-id.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/ids/Attributes.h>
#include <app/common/gen/ids/Clusters.h>
#include <app/util/af-types.h>

using namespace ::chip;
using namespace ::chip::app::Clusters;

void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
{
if (clusterId == ZCL_ON_OFF_CLUSTER_ID)
if (clusterId == OnOff::Id)
{
if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
if (attributeId != OnOff::Attributes::Ids::OnOff)
{
ChipLogError(Zcl, "ON OFF attribute ID: 0x%" PRIx32 " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
attributeId, type, *value, size);
ChipLogError(Zcl, "ON OFF attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
ChipLogValueMEI(attributeId), type, *value, size);
return;
}

LightMgr().InitiateAction(AppEvent::kEventType_Light, *value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION);
}
else if (clusterId == ZCL_LEVEL_CONTROL_CLUSTER_ID)
else if (clusterId == LevelControl::Id)
{
ChipLogProgress(Zcl, "Level Control attribute ID: 0x%" PRIx32 " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
attributeId, type, *value, size);
ChipLogProgress(Zcl,
"Level Control attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
ChipLogValueMEI(attributeId), type, *value, size);

// WIP Apply attribute change to Light
}
else if (clusterId == ZCL_COLOR_CONTROL_CLUSTER_ID)
else if (clusterId == ColorControl::Id)
{
ChipLogProgress(Zcl, "Color Control attribute ID: 0x%" PRIx32 " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
attributeId, type, *value, size);
ChipLogProgress(Zcl,
"Color Control attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
ChipLogValueMEI(attributeId), type, *value, size);

// WIP Apply attribute change to Light
}
else
{
ChipLogProgress(Zcl, "Unknown Cluster ID: 0x%" PRIx32, clusterId);
ChipLogProgress(Zcl, "Unknown Cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
}
}

Expand Down
13 changes: 7 additions & 6 deletions examples/lighting-app/k32w/main/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@
#include "AppTask.h"
#include "LightingManager.h"

#include <app/common/gen/attribute-id.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/ids/Attributes.h>
#include <app/common/gen/ids/Clusters.h>
#include <app/util/af-types.h>
#include <app/util/af.h>

using namespace ::chip;
using namespace ::chip::app::Clusters;

void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
{
if (clusterId != ZCL_ON_OFF_CLUSTER_ID)
if (clusterId != OnOff::Id)
{
ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
return;
}

if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
if (attributeId != OnOff::Attributes::Ids::OnOff)
{
ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
}

Expand Down
Loading

0 comments on commit d1da41e

Please sign in to comment.