From a33a5732afdd213c97b4131f826ae9d8d3144ba6 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 7 Dec 2021 10:32:43 -0800 Subject: [PATCH 1/2] Update basic information cluster to align with spec --- .../zcl/data-model/chip/basic-information-cluster.xml | 10 ---------- 1 file changed, 10 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. From 5a8e014b82559aecb2709e59278427d37032b0da Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 7 Dec 2021 10:46:55 -0800 Subject: [PATCH 2/2] Run codegen --- .../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 --- 6 files changed, 255 deletions(-) diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index b23ed905ede963..30e892a464a7dd 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -5168,19 +5168,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 @@ -5194,32 +5181,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 b31e893698cac2..4caac56e0faa6c 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 1d8adae836a303..a89183e166fd7f 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 dccf050d5458c4..63f870d9812fe4 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 9c27f255f11fa4..045f05d162e850 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 b455c92ad3a917..fa128a47bb8942 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