| {{> header}} |
| // This file is generated from clusters-Commands.h.zapt |
| |
| #pragma once |
| |
| #include <app/data-model/DecodableList.h> |
| #include <app/data-model/List.h> |
| #include <app/data-model/Nullable.h> |
| #include <app/data-model/NullObject.h> |
| #include <lib/core/DataModelTypes.h> |
| #include <lib/core/Optional.h> |
| #include <lib/core/TLV.h> |
| #include <lib/support/BitMask.h> |
| |
| #include <clusters/shared/Enums.h> |
| #include <clusters/shared/Structs.h> |
| |
| #include <clusters/{{asUpperCamelCase name}}/ClusterId.h> |
| #include <clusters/{{asUpperCamelCase name}}/CommandIds.h> |
| #include <clusters/{{asUpperCamelCase name}}/Enums.h> |
| #include <clusters/{{asUpperCamelCase name}}/Structs.h> |
| |
| #include <cstdint> |
| |
| namespace chip { |
| namespace app { |
| namespace Clusters { |
| namespace {{asUpperCamelCase name}} { |
| {{#zcl_commands}} |
| {{#first}} |
| namespace Commands { |
| // Forward-declarations so we can reference these later. |
| {{/first}} |
| |
| namespace {{asUpperCamelCase name}} { |
| struct Type; |
| struct DecodableType; |
| } // namespace {{asUpperCamelCase name}} |
| {{#last}} |
| |
| } // namespace Commands |
| {{/last}} |
| {{/zcl_commands}} |
| |
| {{#zcl_commands}} |
| {{#first}} |
| namespace Commands { |
| {{/first}} |
| namespace {{asUpperCamelCase name}} { |
| enum class Fields : uint8_t { |
| {{#zcl_command_arguments}} |
| k{{asUpperCamelCase label}} = {{fieldIdentifier}}, |
| {{/zcl_command_arguments}} |
| }; |
| |
| struct Type |
| { |
| public: |
| // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand |
| static constexpr CommandId GetCommandId() { return Commands::{{asUpperCamelCase name}}::Id; } |
| static constexpr ClusterId GetClusterId() { return Clusters::{{asUpperCamelCase parent.name}}::Id; } |
| static constexpr bool kIsFabricScoped = {{isFabricScoped}}; |
| |
| {{#zcl_command_arguments}} |
| {{zapTypeToEncodableClusterObjectType type cluster=../../name}} {{asLowerCamelCase label}}{{> cluster_objects_field_init cluster=../../name}}; |
| {{/zcl_command_arguments}} |
| |
| |
| {{#if isFabricScoped~}} |
| {{#if (isServer source)}} |
| CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const; |
| CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; |
| {{else}} |
| CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; |
| {{/if}} |
| {{else}} |
| CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; |
| {{/if}} |
| |
| using ResponseType = |
| {{~#if responseName}} |
| Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase responseName}}::DecodableType; |
| {{else}} |
| DataModel::NullObjectType; |
| {{/if}} |
| |
| static constexpr bool MustUseTimedInvoke() { return {{mustUseTimedInvoke}}; } |
| }; |
| |
| struct DecodableType { |
| public: |
| static constexpr CommandId GetCommandId() { return Commands::{{asUpperCamelCase name}}::Id; } |
| static constexpr ClusterId GetClusterId() { return Clusters::{{asUpperCamelCase parent.name}}::Id; } |
| static constexpr bool kIsFabricScoped = {{isFabricScoped}}; |
| |
| {{#zcl_command_arguments}} |
| {{zapTypeToDecodableClusterObjectType type cluster=../../name}} {{asLowerCamelCase label}}{{> cluster_objects_field_init cluster=../../name}}; |
| {{/zcl_command_arguments}} |
| |
| {{#if isFabricScoped~}} |
| {{#if (isClient source)}} |
| CHIP_ERROR Decode(TLV::TLVReader &reader, FabricIndex aAccessingFabricIndex); |
| {{else}} |
| CHIP_ERROR Decode(TLV::TLVReader &reader); |
| {{/if}} |
| {{else}} |
| CHIP_ERROR Decode(TLV::TLVReader &reader); |
| {{/if}} |
| }; |
| }; // namespace {{asUpperCamelCase name}} |
| {{#last}} |
| } // namespace Commands |
| {{/last}} |
| {{/zcl_commands}} |
| } // namespace {{asUpperCamelCase name}} |
| } // namespace Clusters |
| } // namespace app |
| } // namespace chip |