Skip to content

Commit

Permalink
Stop depending on controller-clusters.zap state entirely, now that we…
Browse files Browse the repository at this point in the history
… can.
  • Loading branch information
bzbarsky-apple committed Apr 18, 2023
1 parent 8671f57 commit a42ddde
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 45 deletions.
12 changes: 6 additions & 6 deletions examples/darwin-framework-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{{> clusters_header}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
{{> cluster_header}}

Expand Down Expand Up @@ -250,12 +250,12 @@ public:
{{/if}}
{{/zcl_attributes_server}}
{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}

/*----------------------------------------------------------------------------*\
| Register all Clusters commands |
\*----------------------------------------------------------------------------*/
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
void registerCluster{{asUpperCamelCase name}}(Commands & commands)
{
Expand Down Expand Up @@ -307,7 +307,7 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands)
commands.Register(clusterName, clusterCommands);
}
{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}

void registerClusterAny(Commands & commands)
{
Expand All @@ -329,9 +329,9 @@ void registerClusterAny(Commands & commands)
void registerClusters(Commands & commands)
{
registerClusterAny(commands);
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
registerCluster{{asUpperCamelCase name}}(commands);
{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader &
{
switch (aPath.mClusterId)
{
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
case Clusters::{{asUpperCamelCase name}}::Id: {
using namespace Clusters::{{asUpperCamelCase name}};
Expand Down Expand Up @@ -47,7 +47,7 @@ id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader &
break;
}
{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}
default: {
*aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using chip::System::Clock::Timeout;
using chip::System::Clock::Seconds16;

// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects.
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
@implementation MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}}

Expand Down Expand Up @@ -349,6 +349,6 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio
@end
{{/if}}

{{/all_user_clusters}}
{{/zcl_clusters}}

// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
12 changes: 6 additions & 6 deletions src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

NS_ASSUME_NONNULL_BEGIN

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}


{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
Expand Down Expand Up @@ -72,9 +72,9 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio
@end
{{/if}}

{{/all_user_clusters}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#unless (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatClusterNameRemapping name))}}
{{#if (isSupported (compatClusterNameRemapping name))}}
{{availability (compatClusterNameRemapping name) deprecationMessage=(concat "Please use MTRBaseCluster" (asUpperCamelCase name preserveAcronyms=true))}}
Expand All @@ -83,7 +83,7 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio

{{/if}}
{{/unless}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#zcl_clusters}}
{{#zcl_enums}}
Expand Down Expand Up @@ -179,7 +179,7 @@ typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName bitm
{{/zcl_bitmaps}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name))
(isSupported (compatClusterNameRemapping name)))}}
@interface MTRBaseCluster{{compatClusterNameRemapping name}} (Deprecated)
Expand Down Expand Up @@ -234,6 +234,6 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio
@end

{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <zap-generated/CHIPClusters.h>

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}

{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} ()
Expand All @@ -16,4 +16,4 @@
@end
{{/if}}

{{/all_user_clusters}}
{{/zcl_clusters}}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{{#>MTRCallbackBridge type="vendor_id" isNullable=false ns="chip"}}VendorIdAttributeCallback{{/MTRCallbackBridge}}
{{#>MTRCallbackBridge type="vendor_id" isNullable=true ns="chip"}}NullableVendorIdAttributeCallback{{/MTRCallbackBridge}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_attributes_server removeKeys='isOptional'}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}
{{#if isArray}}
Expand All @@ -52,15 +52,15 @@
{{/if}}
{{/if}}
{{/zcl_attributes_server}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_command_responses}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{#>MTRCallbackBridge partial-type="Command" }}{{asUpperCamelCase ../../name preserveAcronyms=true}}Cluster{{asUpperCamelCase ../name preserveAcronyms=true}}Callback{{/MTRCallbackBridge}}
{{/if}}
{{/zcl_command_responses}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#zcl_clusters}}
{{#zcl_enums}}
Expand Down
16 changes: 8 additions & 8 deletions src/darwin/Framework/CHIP/templates/MTRCallbackBridge.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ typedef void (*DefaultSuccessCallbackType)(void *);
typedef void (*VendorIdAttributeCallback)(void *, chip::VendorId);
typedef void (*NullableVendorIdAttributeCallback)(void *, const chip::app::DataModel::Nullable<chip::VendorId> &);

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_command_responses}}
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}CallbackType)(void *, const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &);
{{/if}}
{{/zcl_command_responses}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#zcl_clusters}}
{{#zcl_enums}}
Expand All @@ -31,7 +31,7 @@ typedef void (*Nullable{{asUpperCamelCase parent.name preserveAcronyms=true}}Clu
{{/zcl_enums}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_attributes_server removeKeys='isOptional'}}
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}
{{#if isArray}}
Expand All @@ -46,7 +46,7 @@ typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCa
{{/if}}
{{/if}}
{{/zcl_attributes_server}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#>MTRCallbackBridge header="1" partial-type="Status" }}DefaultSuccessCallback{{/MTRCallbackBridge}}
{{#>MTRCallbackBridge header="1" partial-type="CommandStatus" }}CommandSuccessCallback{{/MTRCallbackBridge}}
Expand Down Expand Up @@ -79,7 +79,7 @@ typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCa
{{#>MTRCallbackBridge header="1" type="vendor_id" isNullable=false ns="chip"}}VendorIdAttributeCallback{{/MTRCallbackBridge}}
{{#>MTRCallbackBridge header="1" type="vendor_id" isNullable=true ns="chip"}}NullableVendorIdAttributeCallback{{/MTRCallbackBridge}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_attributes_server removeKeys='isOptional'}}
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}
{{#if isArray}}
Expand All @@ -94,15 +94,15 @@ typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCa
{{/if}}
{{/if}}
{{/zcl_attributes_server}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_command_responses}}
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{#>MTRCallbackBridge header="1" partial-type="Command" }}{{asUpperCamelCase ../../name preserveAcronyms=true}}Cluster{{asUpperCamelCase ../name preserveAcronyms=true}}Callback{{/MTRCallbackBridge}}
{{/if}}
{{/zcl_command_responses}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#zcl_clusters}}
{{#zcl_enums}}
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void MTRClustersLogCompletion(NSString *logPrefix, id value, NSError *err
}

// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects.
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
@implementation MTRCluster{{asUpperCamelCase name preserveAcronyms=true}}

Expand Down Expand Up @@ -291,6 +291,6 @@ MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID
@end
{{/if}}

{{/all_user_clusters}}
{{/zcl_clusters}}

// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
12 changes: 6 additions & 6 deletions src/darwin/Framework/CHIP/templates/MTRClusters.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

NS_ASSUME_NONNULL_BEGIN

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}


{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
Expand Down Expand Up @@ -59,9 +59,9 @@ NS_ASSUME_NONNULL_BEGIN
@end

{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#unless (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatClusterNameRemapping name))}}
{{#if (isSupported (compatClusterNameRemapping name))}}
{{availability (compatClusterNameRemapping name) deprecationMessage=(concat "Please use MTRCluster" (asUpperCamelCase name preserveAcronyms=true))}}
Expand All @@ -70,9 +70,9 @@ NS_ASSUME_NONNULL_BEGIN

{{/if}}
{{/unless}}
{{/all_user_clusters}}
{{/zcl_clusters}}

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name))
(isSupported (compatClusterNameRemapping name)))}}
@interface MTRCluster{{compatClusterNameRemapping name}} (Deprecated)
Expand Down Expand Up @@ -113,6 +113,6 @@ NS_ASSUME_NONNULL_BEGIN
@end

{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}

NS_ASSUME_NONNULL_END
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/templates/MTRClusters_Internal.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <zap-generated/CHIPClusters.h>

{{#all_user_clusters side='client'}}
{{#zcl_clusters}}

{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} ()
Expand All @@ -17,4 +17,4 @@
@end
{{/if}}

{{/all_user_clusters}}
{{/zcl_clusters}}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aRead
{
switch (aPath.mClusterId)
{
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
case Clusters::{{asUpperCamelCase name}}::Id: {
using namespace Clusters::{{asUpperCamelCase name}};
Expand Down Expand Up @@ -63,7 +63,7 @@ id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aRead
break;
}
{{/if}}
{{/all_user_clusters}}
{{/zcl_clusters}}
default: {
*aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB;
break;
Expand Down
7 changes: 4 additions & 3 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6566,9 +6566,10 @@
watchos: "9.5"
tvos: "16.5"
introduced:
attributes:
TimeSynchronization:
- DSTOffset
ids:
attributes:
TimeSynchronization:
- DSTOffset
command fields:
DiagnosticLogs:
RetrieveLogsRequest:
Expand Down

0 comments on commit a42ddde

Please sign in to comment.