Skip to content

Commit f05b65e

Browse files
authored
Decouple ember functions from general commissioning cluster (#36836)
* Decouple ember functions from general commissioning cluster * Address review comments * Rename gAttrAccess * Remove new added log info * Flag SetTCAcknowledgements command * Revert "Flag SetTCAcknowledgements command" This reverts commit 90de8a12f6b99dfe9419eebbdc95508e52db62d0. * Add the original debug log back
1 parent b880c14 commit f05b65e

File tree

5 files changed

+130
-250
lines changed

5 files changed

+130
-250
lines changed

scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/IMClusterCommandHandler.cpp

-59
Original file line numberDiff line numberDiff line change
@@ -545,62 +545,6 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP
545545

546546
} // namespace FaultInjection
547547

548-
namespace GeneralCommissioning {
549-
550-
void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv)
551-
{
552-
CHIP_ERROR TLVError = CHIP_NO_ERROR;
553-
bool wasHandled = false;
554-
{
555-
switch (aCommandPath.mCommandId)
556-
{
557-
case Commands::ArmFailSafe::Id: {
558-
Commands::ArmFailSafe::DecodableType commandData;
559-
TLVError = DataModel::Decode(aDataTlv, commandData);
560-
if (TLVError == CHIP_NO_ERROR)
561-
{
562-
wasHandled = emberAfGeneralCommissioningClusterArmFailSafeCallback(apCommandObj, aCommandPath, commandData);
563-
}
564-
break;
565-
}
566-
case Commands::SetRegulatoryConfig::Id: {
567-
Commands::SetRegulatoryConfig::DecodableType commandData;
568-
TLVError = DataModel::Decode(aDataTlv, commandData);
569-
if (TLVError == CHIP_NO_ERROR)
570-
{
571-
wasHandled = emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(apCommandObj, aCommandPath, commandData);
572-
}
573-
break;
574-
}
575-
case Commands::CommissioningComplete::Id: {
576-
Commands::CommissioningComplete::DecodableType commandData;
577-
TLVError = DataModel::Decode(aDataTlv, commandData);
578-
if (TLVError == CHIP_NO_ERROR)
579-
{
580-
wasHandled =
581-
emberAfGeneralCommissioningClusterCommissioningCompleteCallback(apCommandObj, aCommandPath, commandData);
582-
}
583-
break;
584-
}
585-
default: {
586-
// Unrecognized command ID, error status will apply.
587-
apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand);
588-
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI,
589-
ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId));
590-
return;
591-
}
592-
}
593-
}
594-
595-
if (CHIP_NO_ERROR != TLVError || !wasHandled)
596-
{
597-
apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand);
598-
ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format());
599-
}
600-
}
601-
602-
} // namespace GeneralCommissioning
603-
604548
namespace GeneralDiagnostics {
605549

606550
void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv)
@@ -1958,9 +1902,6 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV:
19581902
case Clusters::FaultInjection::Id:
19591903
Clusters::FaultInjection::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
19601904
break;
1961-
case Clusters::GeneralCommissioning::Id:
1962-
Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
1963-
break;
19641905
case Clusters::GeneralDiagnostics::Id:
19651906
Clusters::GeneralDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
19661907
break;

scripts/tools/zap/tests/outputs/lighting-app/app-templates/IMClusterCommandHandler.cpp

-59
Original file line numberDiff line numberDiff line change
@@ -369,62 +369,6 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP
369369

370370
} // namespace EthernetNetworkDiagnostics
371371

372-
namespace GeneralCommissioning {
373-
374-
void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv)
375-
{
376-
CHIP_ERROR TLVError = CHIP_NO_ERROR;
377-
bool wasHandled = false;
378-
{
379-
switch (aCommandPath.mCommandId)
380-
{
381-
case Commands::ArmFailSafe::Id: {
382-
Commands::ArmFailSafe::DecodableType commandData;
383-
TLVError = DataModel::Decode(aDataTlv, commandData);
384-
if (TLVError == CHIP_NO_ERROR)
385-
{
386-
wasHandled = emberAfGeneralCommissioningClusterArmFailSafeCallback(apCommandObj, aCommandPath, commandData);
387-
}
388-
break;
389-
}
390-
case Commands::SetRegulatoryConfig::Id: {
391-
Commands::SetRegulatoryConfig::DecodableType commandData;
392-
TLVError = DataModel::Decode(aDataTlv, commandData);
393-
if (TLVError == CHIP_NO_ERROR)
394-
{
395-
wasHandled = emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(apCommandObj, aCommandPath, commandData);
396-
}
397-
break;
398-
}
399-
case Commands::CommissioningComplete::Id: {
400-
Commands::CommissioningComplete::DecodableType commandData;
401-
TLVError = DataModel::Decode(aDataTlv, commandData);
402-
if (TLVError == CHIP_NO_ERROR)
403-
{
404-
wasHandled =
405-
emberAfGeneralCommissioningClusterCommissioningCompleteCallback(apCommandObj, aCommandPath, commandData);
406-
}
407-
break;
408-
}
409-
default: {
410-
// Unrecognized command ID, error status will apply.
411-
apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand);
412-
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI,
413-
ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId));
414-
return;
415-
}
416-
}
417-
}
418-
419-
if (CHIP_NO_ERROR != TLVError || !wasHandled)
420-
{
421-
apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand);
422-
ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format());
423-
}
424-
}
425-
426-
} // namespace GeneralCommissioning
427-
428372
namespace GeneralDiagnostics {
429373

430374
void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv)
@@ -1115,9 +1059,6 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV:
11151059
case Clusters::EthernetNetworkDiagnostics::Id:
11161060
Clusters::EthernetNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
11171061
break;
1118-
case Clusters::GeneralCommissioning::Id:
1119-
Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
1120-
break;
11211062
case Clusters::GeneralDiagnostics::Id:
11221063
Clusters::GeneralDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
11231064
break;

0 commit comments

Comments
 (0)