Skip to content

Commit

Permalink
Add a dedicated configuration file to generate 'src/app/encoder.cpp' …
Browse files Browse the repository at this point in the history
…and 'src/app/chip-zcl-zpro-codec-api.h'

Problem

So far `src/app/chip-zcl-zpro-codec-api.h` and `src/app/encoder.cpp` has been generated
using times to times by manually adding the related templates to to the `chip-templates.json` and
removing it before checking-in the code since this code does not really belongs to application folders.

It is error prone. An in fact I broken it with project-chip#4155 since attributes appears multiple times because of
the second endpoint.

This PR splits the `zap-templates` folder in two, with one folder for the examples and one fodler for
chip related code.

Summary of changes
 * Split `zap-templates` folder in two
 * Split `helper-chip.js` into multiple helpers and move those helpers where they belongs
 * Add a new `scripts/tools/zap_generate_chip.sh` script to generate the `src/app` content
 * Add `scripts/tools/zap_generate_chip.sh` to `scripts/tools/zap_regen_all.py`
 * Create a partial for the licensing `header` instead of relying on js for it
 * Fix the attribute issue mentioned above
 * Remove `asChipUnderlyingType` since it relies on `asUnderlyingZclType` and we should be able to fix the issue directly once project-chip#4192 lands and it really does not introduce any problem to remove it
  • Loading branch information
vivien-apple committed Dec 15, 2020
1 parent f60ffc5 commit 5da58db
Show file tree
Hide file tree
Showing 93 changed files with 466 additions and 438 deletions.
11 changes: 5 additions & 6 deletions examples/all-clusters-app/all-clusters-common/gen/af-structs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down Expand Up @@ -88,7 +87,7 @@ typedef struct _DebtPayload
typedef struct _DeviceInformationRecord
{
uint64_t ieeeAddress;
chip::EndpointId endpointId;
uint8_t endpointId;
uint16_t profileId;
uint16_t deviceId;
uint8_t version;
Expand All @@ -107,7 +106,7 @@ typedef struct _DiscoverAttributesInfoRecord
typedef struct _EndpointInformationRecord
{
uint16_t networkAddress;
chip::EndpointId endpointId;
uint8_t endpointId;
uint16_t profileId;
uint16_t deviceId;
uint8_t version;
Expand Down Expand Up @@ -153,7 +152,7 @@ typedef struct _GpTranslationTableUpdateTranslation
{
uint8_t index;
uint8_t gpdCommandId;
chip::EndpointId endpoint;
uint8_t endpoint;
uint16_t profile;
uint16_t cluster;
uint8_t zigbeeCommandId;
Expand All @@ -164,7 +163,7 @@ typedef struct _GpTranslationTableUpdateTranslation
// Struct for GroupInformationRecord
typedef struct _GroupInformationRecord
{
chip::GroupId groupId;
uint16_t groupId;
uint8_t groupType;
} EmberAfGroupInformationRecord;

Expand Down Expand Up @@ -195,7 +194,7 @@ typedef struct _NodeInformation
{
uint16_t uid;
uint16_t address;
chip::EndpointId endpoint;
uint8_t endpoint;
uint8_t * nickname;
} EmberAfNodeInformation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/all-clusters-common/gen/enums.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
11 changes: 5 additions & 6 deletions examples/lighting-app/lighting-common/gen/af-structs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down Expand Up @@ -88,7 +87,7 @@ typedef struct _DebtPayload
typedef struct _DeviceInformationRecord
{
uint64_t ieeeAddress;
chip::EndpointId endpointId;
uint8_t endpointId;
uint16_t profileId;
uint16_t deviceId;
uint8_t version;
Expand All @@ -107,7 +106,7 @@ typedef struct _DiscoverAttributesInfoRecord
typedef struct _EndpointInformationRecord
{
uint16_t networkAddress;
chip::EndpointId endpointId;
uint8_t endpointId;
uint16_t profileId;
uint16_t deviceId;
uint8_t version;
Expand Down Expand Up @@ -153,7 +152,7 @@ typedef struct _GpTranslationTableUpdateTranslation
{
uint8_t index;
uint8_t gpdCommandId;
chip::EndpointId endpoint;
uint8_t endpoint;
uint16_t profile;
uint16_t cluster;
uint8_t zigbeeCommandId;
Expand All @@ -164,7 +163,7 @@ typedef struct _GpTranslationTableUpdateTranslation
// Struct for GroupInformationRecord
typedef struct _GroupInformationRecord
{
chip::GroupId groupId;
uint16_t groupId;
uint8_t groupType;
} EmberAfGroupInformationRecord;

Expand Down Expand Up @@ -195,7 +194,7 @@ typedef struct _NodeInformation
{
uint16_t uid;
uint16_t address;
chip::EndpointId endpoint;
uint8_t endpoint;
uint8_t * nickname;
} EmberAfNodeInformation;

Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/att-storage.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/attribute-id.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/attribute-size.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/attribute-type.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/callback.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/cluster-id.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/lighting-common/gen/command-id.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down Expand Up @@ -46,6 +45,7 @@

// Commands for cluster: Basic
#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)

// Commands for cluster: Identify
#define ZCL_IDENTIFY_COMMAND_ID (0x00)
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/enums.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/gen_config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/gen/print-cluster.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
11 changes: 5 additions & 6 deletions examples/lock-app/lock-common/gen/af-structs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down Expand Up @@ -88,7 +87,7 @@ typedef struct _DebtPayload
typedef struct _DeviceInformationRecord
{
uint64_t ieeeAddress;
chip::EndpointId endpointId;
uint8_t endpointId;
uint16_t profileId;
uint16_t deviceId;
uint8_t version;
Expand All @@ -107,7 +106,7 @@ typedef struct _DiscoverAttributesInfoRecord
typedef struct _EndpointInformationRecord
{
uint16_t networkAddress;
chip::EndpointId endpointId;
uint8_t endpointId;
uint16_t profileId;
uint16_t deviceId;
uint8_t version;
Expand Down Expand Up @@ -153,7 +152,7 @@ typedef struct _GpTranslationTableUpdateTranslation
{
uint8_t index;
uint8_t gpdCommandId;
chip::EndpointId endpoint;
uint8_t endpoint;
uint16_t profile;
uint16_t cluster;
uint8_t zigbeeCommandId;
Expand All @@ -164,7 +163,7 @@ typedef struct _GpTranslationTableUpdateTranslation
// Struct for GroupInformationRecord
typedef struct _GroupInformationRecord
{
chip::GroupId groupId;
uint16_t groupId;
uint8_t groupType;
} EmberAfGroupInformationRecord;

Expand Down Expand Up @@ -195,7 +194,7 @@ typedef struct _NodeInformation
{
uint16_t uid;
uint16_t address;
chip::EndpointId endpoint;
uint8_t endpoint;
uint8_t * nickname;
} EmberAfNodeInformation;

Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/att-storage.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/attribute-id.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/attribute-size.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/attribute-type.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/call-command-handler.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/call-command-handler.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/callback-stub.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/callback.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/client-command-macro.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/cluster-id.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/lock-common/gen/command-id.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down Expand Up @@ -46,6 +45,7 @@

// Commands for cluster: Basic
#define ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID (0x00)
#define ZCL_MFG_SPECIFIC_PING_COMMAND_ID (0x00)

// Commands for cluster: Identify
#define ZCL_IDENTIFY_COMMAND_ID (0x00)
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/enums.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/gen_config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/gen/print-cluster.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
*
* Copyright (c) 2020 Project CHIP Authors
Expand Down
Loading

0 comments on commit 5da58db

Please sign in to comment.