From 7269448c9b81796d8733c2096224b38c192b627b Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 7 Dec 2021 16:58:51 -0800 Subject: [PATCH] Update basic information cluster to align with spec (#12695) * Update basic information cluster to align with spec * Run codegen --- .../chip/basic-information-cluster.xml | 10 -- .../python/chip/clusters/Objects.py | 39 -------- .../app-common/zap-generated/callback.h | 12 --- .../zap-generated/cluster-objects.cpp | 90 ----------------- .../zap-generated/cluster-objects.h | 99 ------------------- .../app-common/zap-generated/command-id.h | 3 - .../app-common/zap-generated/ids/Commands.h | 12 --- 7 files changed, 265 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml index bebb7f7404f88b..b4b330b3795f3d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml @@ -44,16 +44,6 @@ limitations under the License. Reachable UniqueID - - The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process. - - - The ShutDown event SHOULD be emitted by a Node prior to any orderly shutdown sequence on a best-effort basis. - - - The Leave event SHOULD be emitted by a Node prior to permanently leaving the Fabric. - - The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process. diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index da6be365ae6618..a8c7335bdd0e91 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -5178,19 +5178,6 @@ class Basic(Cluster): class Commands: - @dataclass - class StartUp(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x0028 - command_id: typing.ClassVar[int] = 0x0000 - is_client: typing.ClassVar[bool] = False - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields = [ - ]) - - @dataclass class MfgSpecificPing(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x0028 @@ -5204,32 +5191,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) - @dataclass - class ShutDown(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x0028 - command_id: typing.ClassVar[int] = 0x0001 - is_client: typing.ClassVar[bool] = False - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields = [ - ]) - - - @dataclass - class Leave(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x0028 - command_id: typing.ClassVar[int] = 0x0002 - is_client: typing.ClassVar[bool] = False - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields = [ - ]) - - class Attributes: @dataclass diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index d0e1af6c4b43cb..c0040cd82b2dfb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -13845,24 +13845,12 @@ bool emberAfBridgedActionsClusterDisableActionCallback( bool emberAfBridgedActionsClusterDisableActionWithDurationCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::BridgedActions::Commands::DisableActionWithDuration::DecodableType & commandData); -/** - * @brief Basic Cluster StartUp Command callback (from server) - */ -bool emberAfBasicClusterStartUpCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj); /** * @brief Basic Cluster MfgSpecificPing Command callback (from client) */ bool emberAfBasicClusterMfgSpecificPingCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Basic::Commands::MfgSpecificPing::DecodableType & commandData); -/** - * @brief Basic Cluster ShutDown Command callback (from server) - */ -bool emberAfBasicClusterShutDownCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj); -/** - * @brief Basic Cluster Leave Command callback (from server) - */ -bool emberAfBasicClusterLeaveCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj); /** * @brief OTA Software Update Provider Cluster QueryImage Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index a9669c96ce59de..86c94c23b1b72e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -4686,36 +4686,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) namespace Basic { namespace Commands { -namespace StartUp { -CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const -{ - TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; -} -} // namespace StartUp. namespace MfgSpecificPing { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { @@ -4746,66 +4716,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace MfgSpecificPing. -namespace ShutDown { -CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const -{ - TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; -} -} // namespace ShutDown. -namespace Leave { -CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const -{ - TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(reader.EnterContainer(outer)); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; - } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; -} -} // namespace Leave. } // namespace Commands namespace Events { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index c0e56a463be385..78df546cad4437 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -7009,57 +7009,14 @@ namespace Basic { namespace Commands { // Forward-declarations so we can reference these later. -namespace StartUp { -struct Type; -struct DecodableType; -} // namespace StartUp - namespace MfgSpecificPing { struct Type; struct DecodableType; } // namespace MfgSpecificPing -namespace ShutDown { -struct Type; -struct DecodableType; -} // namespace ShutDown - -namespace Leave { -struct Type; -struct DecodableType; -} // namespace Leave - } // namespace Commands namespace Commands { -namespace StartUp { -enum class Fields -{ -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::StartUp::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } - - CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::StartUp::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } - - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace StartUp namespace MfgSpecificPing { enum class Fields { @@ -7088,62 +7045,6 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MfgSpecificPing -namespace ShutDown { -enum class Fields -{ -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::ShutDown::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } - - CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::ShutDown::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } - - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace ShutDown -namespace Leave { -enum class Fields -{ -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::Leave::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } - - CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::Leave::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Basic::Id; } - - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace Leave } // namespace Commands namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/command-id.h b/zzz_generated/app-common/app-common/zap-generated/command-id.h index 026a12742a8f66..a2fc620ceb0e97 100644 --- a/zzz_generated/app-common/app-common/zap-generated/command-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/command-id.h @@ -156,10 +156,7 @@ #define ZCL_DISABLE_ACTION_WITH_DURATION_COMMAND_ID (0x0B) // Commands for cluster: Basic -#define ZCL_START_UP_COMMAND_ID (0x00) #define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00) -#define ZCL_SHUT_DOWN_COMMAND_ID (0x01) -#define ZCL_LEAVE_COMMAND_ID (0x02) // Commands for cluster: OTA Software Update Provider #define ZCL_QUERY_IMAGE_COMMAND_ID (0x00) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index fcb1790f1a92a2..6685c458c8cea8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -500,22 +500,10 @@ static constexpr CommandId Id = 0x0000000B; namespace Basic { namespace Commands { -namespace StartUp { -static constexpr CommandId Id = 0x00000000; -} // namespace StartUp - namespace MfgSpecificPing { static constexpr CommandId Id = 0x10020000; } // namespace MfgSpecificPing -namespace ShutDown { -static constexpr CommandId Id = 0x00000001; -} // namespace ShutDown - -namespace Leave { -static constexpr CommandId Id = 0x00000002; -} // namespace Leave - } // namespace Commands } // namespace Basic