diff --git a/examples/all-clusters-app/all-clusters-common/gen/af-structs.h b/examples/all-clusters-app/all-clusters-common/gen/af-structs.h index 6d04f3faa8e82d..02960bec60ddfb 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/af-structs.h +++ b/examples/all-clusters-app/all-clusters-common/gen/af-structs.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/att-storage.h b/examples/all-clusters-app/all-clusters-common/gen/att-storage.h index 7572c8cbc338fb..74b44d6111b3e4 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/att-storage.h +++ b/examples/all-clusters-app/all-clusters-common/gen/att-storage.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h index 648809ca67cd83..8e35a7980d4be4 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.h b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.h index 8d8659ee7ece2e..bb47a0da942954 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.h +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-type.h b/examples/all-clusters-app/all-clusters-common/gen/attribute-type.h index bc5d1bae34b365..d457711be7c0fc 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/attribute-type.h +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-type.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp index 8800211673c58c..985eb196a6ad60 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.h b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.h index c1b06642f07ac9..43164ad576bfa8 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.h +++ b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index e8214b31cc4718..a333cb52b82ebd 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index 8e9a076da715b0..29f62581d7f8bd 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h b/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h index f1b0c4633a2b14..61b4a6e19d91c6 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h +++ b/examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h index c341b079be401d..e52db3604816ec 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/cluster-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/command-id.h b/examples/all-clusters-app/all-clusters-common/gen/command-id.h index cc63eff3ebc90b..1cdcdcea1441e7 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/command-id.h +++ b/examples/all-clusters-app/all-clusters-common/gen/command-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/enums.h b/examples/all-clusters-app/all-clusters-common/gen/enums.h index 07c2881e641e97..29fdca56a326f9 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/enums.h +++ b/examples/all-clusters-app/all-clusters-common/gen/enums.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h index 47d7891fd24ac7..0bd1135acf5bda 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h index a37d7fb0495995..776e55544c7cd4 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h +++ b/examples/all-clusters-app/all-clusters-common/gen/print-cluster.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/af-structs.h b/examples/lighting-app/lighting-common/gen/af-structs.h index 6d04f3faa8e82d..02960bec60ddfb 100644 --- a/examples/lighting-app/lighting-common/gen/af-structs.h +++ b/examples/lighting-app/lighting-common/gen/af-structs.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/att-storage.h b/examples/lighting-app/lighting-common/gen/att-storage.h index 7572c8cbc338fb..74b44d6111b3e4 100644 --- a/examples/lighting-app/lighting-common/gen/att-storage.h +++ b/examples/lighting-app/lighting-common/gen/att-storage.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/attribute-id.h b/examples/lighting-app/lighting-common/gen/attribute-id.h index 648809ca67cd83..8e35a7980d4be4 100644 --- a/examples/lighting-app/lighting-common/gen/attribute-id.h +++ b/examples/lighting-app/lighting-common/gen/attribute-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/attribute-size.h b/examples/lighting-app/lighting-common/gen/attribute-size.h index 8d8659ee7ece2e..bb47a0da942954 100644 --- a/examples/lighting-app/lighting-common/gen/attribute-size.h +++ b/examples/lighting-app/lighting-common/gen/attribute-size.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/attribute-type.h b/examples/lighting-app/lighting-common/gen/attribute-type.h index bc5d1bae34b365..d457711be7c0fc 100644 --- a/examples/lighting-app/lighting-common/gen/attribute-type.h +++ b/examples/lighting-app/lighting-common/gen/attribute-type.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/call-command-handler.cpp b/examples/lighting-app/lighting-common/gen/call-command-handler.cpp index 0b9ff9100e931b..f177ad441c6909 100644 --- a/examples/lighting-app/lighting-common/gen/call-command-handler.cpp +++ b/examples/lighting-app/lighting-common/gen/call-command-handler.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/call-command-handler.h b/examples/lighting-app/lighting-common/gen/call-command-handler.h index c1b06642f07ac9..43164ad576bfa8 100644 --- a/examples/lighting-app/lighting-common/gen/call-command-handler.h +++ b/examples/lighting-app/lighting-common/gen/call-command-handler.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/callback-stub.cpp b/examples/lighting-app/lighting-common/gen/callback-stub.cpp index 232854b0ab82d5..2fdef872d8c4c4 100644 --- a/examples/lighting-app/lighting-common/gen/callback-stub.cpp +++ b/examples/lighting-app/lighting-common/gen/callback-stub.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/callback.h b/examples/lighting-app/lighting-common/gen/callback.h index 3172c588538880..d9a7391fb52899 100644 --- a/examples/lighting-app/lighting-common/gen/callback.h +++ b/examples/lighting-app/lighting-common/gen/callback.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/client-command-macro.h b/examples/lighting-app/lighting-common/gen/client-command-macro.h index f1b0c4633a2b14..61b4a6e19d91c6 100644 --- a/examples/lighting-app/lighting-common/gen/client-command-macro.h +++ b/examples/lighting-app/lighting-common/gen/client-command-macro.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/cluster-id.h b/examples/lighting-app/lighting-common/gen/cluster-id.h index c341b079be401d..e52db3604816ec 100644 --- a/examples/lighting-app/lighting-common/gen/cluster-id.h +++ b/examples/lighting-app/lighting-common/gen/cluster-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/command-id.h b/examples/lighting-app/lighting-common/gen/command-id.h index 940258f4527aa5..1cdcdcea1441e7 100644 --- a/examples/lighting-app/lighting-common/gen/command-id.h +++ b/examples/lighting-app/lighting-common/gen/command-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors @@ -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) diff --git a/examples/lighting-app/lighting-common/gen/enums.h b/examples/lighting-app/lighting-common/gen/enums.h index 07c2881e641e97..29fdca56a326f9 100644 --- a/examples/lighting-app/lighting-common/gen/enums.h +++ b/examples/lighting-app/lighting-common/gen/enums.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/gen_config.h b/examples/lighting-app/lighting-common/gen/gen_config.h index e4245962b8d1b5..ec6a2529108f34 100644 --- a/examples/lighting-app/lighting-common/gen/gen_config.h +++ b/examples/lighting-app/lighting-common/gen/gen_config.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lighting-app/lighting-common/gen/print-cluster.h b/examples/lighting-app/lighting-common/gen/print-cluster.h index a37d7fb0495995..776e55544c7cd4 100644 --- a/examples/lighting-app/lighting-common/gen/print-cluster.h +++ b/examples/lighting-app/lighting-common/gen/print-cluster.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/af-structs.h b/examples/lock-app/lock-common/gen/af-structs.h index 6d04f3faa8e82d..02960bec60ddfb 100644 --- a/examples/lock-app/lock-common/gen/af-structs.h +++ b/examples/lock-app/lock-common/gen/af-structs.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/att-storage.h b/examples/lock-app/lock-common/gen/att-storage.h index 7572c8cbc338fb..74b44d6111b3e4 100644 --- a/examples/lock-app/lock-common/gen/att-storage.h +++ b/examples/lock-app/lock-common/gen/att-storage.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/attribute-id.h b/examples/lock-app/lock-common/gen/attribute-id.h index 648809ca67cd83..8e35a7980d4be4 100644 --- a/examples/lock-app/lock-common/gen/attribute-id.h +++ b/examples/lock-app/lock-common/gen/attribute-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/attribute-size.h b/examples/lock-app/lock-common/gen/attribute-size.h index 8d8659ee7ece2e..bb47a0da942954 100644 --- a/examples/lock-app/lock-common/gen/attribute-size.h +++ b/examples/lock-app/lock-common/gen/attribute-size.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/attribute-type.h b/examples/lock-app/lock-common/gen/attribute-type.h index bc5d1bae34b365..d457711be7c0fc 100644 --- a/examples/lock-app/lock-common/gen/attribute-type.h +++ b/examples/lock-app/lock-common/gen/attribute-type.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/call-command-handler.cpp b/examples/lock-app/lock-common/gen/call-command-handler.cpp index b4313f5129d251..6f1235aeedf742 100644 --- a/examples/lock-app/lock-common/gen/call-command-handler.cpp +++ b/examples/lock-app/lock-common/gen/call-command-handler.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/call-command-handler.h b/examples/lock-app/lock-common/gen/call-command-handler.h index c1b06642f07ac9..43164ad576bfa8 100644 --- a/examples/lock-app/lock-common/gen/call-command-handler.h +++ b/examples/lock-app/lock-common/gen/call-command-handler.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/callback-stub.cpp b/examples/lock-app/lock-common/gen/callback-stub.cpp index 6f597e18afb113..38608e2ee7d29b 100644 --- a/examples/lock-app/lock-common/gen/callback-stub.cpp +++ b/examples/lock-app/lock-common/gen/callback-stub.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/callback.h b/examples/lock-app/lock-common/gen/callback.h index 17c21dfad82831..3bc4bcaacaf8a2 100644 --- a/examples/lock-app/lock-common/gen/callback.h +++ b/examples/lock-app/lock-common/gen/callback.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/client-command-macro.h b/examples/lock-app/lock-common/gen/client-command-macro.h index f1b0c4633a2b14..61b4a6e19d91c6 100644 --- a/examples/lock-app/lock-common/gen/client-command-macro.h +++ b/examples/lock-app/lock-common/gen/client-command-macro.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/cluster-id.h b/examples/lock-app/lock-common/gen/cluster-id.h index c341b079be401d..e52db3604816ec 100644 --- a/examples/lock-app/lock-common/gen/cluster-id.h +++ b/examples/lock-app/lock-common/gen/cluster-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/command-id.h b/examples/lock-app/lock-common/gen/command-id.h index 940258f4527aa5..1cdcdcea1441e7 100644 --- a/examples/lock-app/lock-common/gen/command-id.h +++ b/examples/lock-app/lock-common/gen/command-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors @@ -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) diff --git a/examples/lock-app/lock-common/gen/enums.h b/examples/lock-app/lock-common/gen/enums.h index 07c2881e641e97..29fdca56a326f9 100644 --- a/examples/lock-app/lock-common/gen/enums.h +++ b/examples/lock-app/lock-common/gen/enums.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/gen_config.h b/examples/lock-app/lock-common/gen/gen_config.h index 3367d0a31442fe..7a769cf83c75ab 100644 --- a/examples/lock-app/lock-common/gen/gen_config.h +++ b/examples/lock-app/lock-common/gen/gen_config.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/lock-app/lock-common/gen/print-cluster.h b/examples/lock-app/lock-common/gen/print-cluster.h index a37d7fb0495995..776e55544c7cd4 100644 --- a/examples/lock-app/lock-common/gen/print-cluster.h +++ b/examples/lock-app/lock-common/gen/print-cluster.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/af-structs.h b/examples/temperature-measurement-app/esp32/main/gen/af-structs.h index 6d04f3faa8e82d..02960bec60ddfb 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/af-structs.h +++ b/examples/temperature-measurement-app/esp32/main/gen/af-structs.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/att-storage.h b/examples/temperature-measurement-app/esp32/main/gen/att-storage.h index 7572c8cbc338fb..74b44d6111b3e4 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/att-storage.h +++ b/examples/temperature-measurement-app/esp32/main/gen/att-storage.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h index 648809ca67cd83..8e35a7980d4be4 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-size.h b/examples/temperature-measurement-app/esp32/main/gen/attribute-size.h index 8d8659ee7ece2e..bb47a0da942954 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/attribute-size.h +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-size.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-type.h b/examples/temperature-measurement-app/esp32/main/gen/attribute-type.h index bc5d1bae34b365..d457711be7c0fc 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/attribute-type.h +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-type.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.cpp b/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.cpp index 38afdd93327e0f..cba1ff3e46b4a7 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.cpp +++ b/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.h b/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.h index c1b06642f07ac9..43164ad576bfa8 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.h +++ b/examples/temperature-measurement-app/esp32/main/gen/call-command-handler.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp b/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp index 83d63878f3d686..ac3b13aacbb381 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp +++ b/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/callback.h b/examples/temperature-measurement-app/esp32/main/gen/callback.h index 888e1699860951..7829b19e66d717 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/callback.h +++ b/examples/temperature-measurement-app/esp32/main/gen/callback.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h b/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h index f1b0c4633a2b14..61b4a6e19d91c6 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h +++ b/examples/temperature-measurement-app/esp32/main/gen/client-command-macro.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h index c341b079be401d..e52db3604816ec 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/cluster-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/command-id.h b/examples/temperature-measurement-app/esp32/main/gen/command-id.h index 940258f4527aa5..1cdcdcea1441e7 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/command-id.h +++ b/examples/temperature-measurement-app/esp32/main/gen/command-id.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors @@ -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) diff --git a/examples/temperature-measurement-app/esp32/main/gen/enums.h b/examples/temperature-measurement-app/esp32/main/gen/enums.h index 07c2881e641e97..29fdca56a326f9 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/enums.h +++ b/examples/temperature-measurement-app/esp32/main/gen/enums.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/gen_config.h b/examples/temperature-measurement-app/esp32/main/gen/gen_config.h index f1181271d7879d..f1ae11d45c4a52 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/gen_config.h +++ b/examples/temperature-measurement-app/esp32/main/gen/gen_config.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h index a37d7fb0495995..776e55544c7cd4 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h +++ b/examples/temperature-measurement-app/esp32/main/gen/print-cluster.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/scripts/tools/zap_configure.sh b/scripts/tools/zap_configure.sh index 7212aa3f216ba6..eed5cab06befab 100755 --- a/scripts/tools/zap_configure.sh +++ b/scripts/tools/zap_configure.sh @@ -18,4 +18,4 @@ cd ./third_party/zap/repo/ -node ./src-script/zap-start.js --logToStdout --gen ../../../src/app/zap-templates/chip-templates.json +node ./src-script/zap-start.js --logToStdout --gen ../../../src/app/zap-templates/app-templates.json diff --git a/scripts/tools/zap_generate.sh b/scripts/tools/zap_generate.sh index b630b32cd848ee..f336e355cfdc65 100755 --- a/scripts/tools/zap_generate.sh +++ b/scripts/tools/zap_generate.sh @@ -32,4 +32,9 @@ if [ ! -d "$OUTPUT_DIRECTORY" ]; then fi cd ./third_party/zap/repo/ -node ./src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../../src/app/zap-templates/chip-templates.json -i "$FILE_PATH" -o "$OUTPUT_DIRECTORY" +node ./src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../../src/app/zap-templates/app-templates.json -i "$FILE_PATH" -o "$OUTPUT_DIRECTORY" + +# Check if clang-format is available +if command -v clang-format &>/dev/null; then + clang-format -i "$OUTPUT_DIRECTORY"* +fi diff --git a/scripts/tools/zap_generate_chip.sh b/scripts/tools/zap_generate_chip.sh new file mode 100755 index 00000000000000..12275cc859840e --- /dev/null +++ b/scripts/tools/zap_generate_chip.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +cd ./third_party/zap/repo/ +node ./src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../../src/app/zap-templates/chip-templates.json -i ../../../examples/all-clusters-app/all-clusters-common/all-clusters-app.zap -o ../../../ diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 9100921b8a89f8..62c2e1551f2324 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -31,5 +31,7 @@ print('This script must be called from the root of the chip directory') exit(1) +os.system("./scripts/tools/zap_generate_chip.sh") + for path in Path('./examples').rglob('*.zap'): os.system("./scripts/tools/zap_generate.sh " + str(path)) diff --git a/src/app/chip-zcl-zpro-codec-api.h b/src/app/chip-zcl-zpro-codec-api.h index 88a4a4e488db81..d935cb0440418d 100644 --- a/src/app/chip-zcl-zpro-codec-api.h +++ b/src/app/chip-zcl-zpro-codec-api.h @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/src/app/encoder.cpp b/src/app/encoder.cpp index cf095883cae187..2369e9f848440b 100644 --- a/src/app/encoder.cpp +++ b/src/app/encoder.cpp @@ -1,4 +1,3 @@ - /* * * Copyright (c) 2020 Project CHIP Authors diff --git a/src/app/zap-templates/README.md b/src/app/zap-templates/README.md index 0b51ba643be11c..4b7450d673ff69 100644 --- a/src/app/zap-templates/README.md +++ b/src/app/zap-templates/README.md @@ -12,14 +12,15 @@ Run ZAP with UI to configure endpoints and clusters ``` cd ./third_party/zap/repo/ -node src-script/zap-start.js --logToStdout --gen ../../../src/app/zap-templates/chip-templates.json +node src-script/zap-start.js --logToStdout --gen ../../../src/app/zap-templates/app/templates.json ``` Generate files in headless mode ``` cd ./third_party/zap/repo/ -node src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../../src/app/zap-templates/chip-templates.json -i -o +node src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../../src/app/zap-templates/app-templates.json -i -o +node src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../../../src/app/zap-templates/chip-templates.json -i -o ../../../ ``` For more information please see the documentation under `docs/` in diff --git a/src/app/zap-templates/app-templates.json b/src/app/zap-templates/app-templates.json new file mode 100644 index 00000000000000..3d67fbccdc99a3 --- /dev/null +++ b/src/app/zap-templates/app-templates.json @@ -0,0 +1,93 @@ +{ + "name": "CHIP Application templates", + "version": "chip-v1", + "helpers": ["common/StringHelper.js", "templates/app/helper.js"], + "override": "common/override.js", + "partials": [ + { + "name": "header", + "path": "partials/header.zapt" + }, + { + "name": "command_handler_cluster_commands", + "path": "partials/command_handler_cluster_commands.zapt" + } + ], + "templates": [ + { + "path": "templates/app/af-structs.zapt", + "name": "ZCL af-structs header", + "output": "af-structs.h" + }, + { + "path": "templates/app/att-storage.zapt", + "name": "ZCL att-storage header", + "output": "att-storage.h" + }, + { + "path": "templates/app/attribute-id.zapt", + "name": "ZCL attribute-id header", + "output": "attribute-id.h" + }, + { + "path": "templates/app/attribute-type.zapt", + "name": "ZCL attribute-type header", + "output": "attribute-type.h" + }, + { + "path": "templates/app/attribute-size.zapt", + "name": "ZCL attribute-size header", + "output": "attribute-size.h" + }, + { + "path": "templates/app/call-command-handler-src.zapt", + "name": "ZCL call-command-handler source", + "output": "call-command-handler.cpp" + }, + { + "path": "templates/app/call-command-handler.zapt", + "name": "ZCL call-command-handler header", + "output": "call-command-handler.h" + }, + { + "path": "templates/app/callback-stub-src.zapt", + "name": "ZCL callback-stub source", + "output": "callback-stub.cpp" + }, + { + "path": "templates/app/callback.zapt", + "name": "ZCL callback header", + "output": "callback.h" + }, + { + "path": "templates/app/client-command-macro.zapt", + "name": "ZCL client command", + "output": "client-command-macro.h" + }, + { + "path": "templates/app/cluster-id.zapt", + "name": "ZCL cluster-id header", + "output": "cluster-id.h" + }, + { + "path": "templates/app/command-id.zapt", + "name": "ZCL command-id header", + "output": "command-id.h" + }, + { + "path": "templates/app/enums.zapt", + "name": "ZCL enums header", + "output": "enums.h" + }, + { + "path": "templates/app/gen_config.zapt", + "name": "ZCL gen_config header", + "output": "gen_config.h" + }, + { + "path": "templates/app/print-cluster.zapt", + "name": "ZCL print-cluster header", + "output": "print-cluster.h" + } + ] +} diff --git a/src/app/zap-templates/chip-templates.json b/src/app/zap-templates/chip-templates.json index 5755a930b0928a..b122ffea16312b 100644 --- a/src/app/zap-templates/chip-templates.json +++ b/src/app/zap-templates/chip-templates.json @@ -1,9 +1,17 @@ { - "name": "CHIP templates", + "name": "CHIP Runtime templates", "version": "chip-v1", - "helpers": ["helper-chip.js"], - "override": "override.js", + "helpers": [ + "partials/helper.js", + "common/StringHelper.js", + "templates/chip/helper.js" + ], + "override": "common/override.js", "partials": [ + { + "name": "header", + "path": "partials/header.zapt" + }, { "name": "clusters_header", "path": "partials/clusters_header.zapt" @@ -11,87 +19,18 @@ { "name": "cluster_header", "path": "partials/cluster_header.zapt" - }, - { - "name": "command_handler_cluster_commands", - "path": "partials/command_handler_cluster_commands.zapt" } ], "templates": [ { - "path": "af-structs.zapt", - "name": "ZCL af-structs header", - "output": "af-structs.h" - }, - { - "path": "att-storage.zapt", - "name": "ZCL att-storage header", - "output": "att-storage.h" - }, - { - "path": "attribute-id.zapt", - "name": "ZCL attribute-id header", - "output": "attribute-id.h" - }, - { - "path": "attribute-type.zapt", - "name": "ZCL attribute-type header", - "output": "attribute-type.h" - }, - { - "path": "attribute-size.zapt", - "name": "ZCL attribute-size header", - "output": "attribute-size.h" - }, - { - "path": "call-command-handler-src.zapt", - "name": "ZCL call-command-handler source", - "output": "call-command-handler.cpp" - }, - { - "path": "call-command-handler.zapt", - "name": "ZCL call-command-handler header", - "output": "call-command-handler.h" - }, - { - "path": "callback-stub-src.zapt", - "name": "ZCL callback-stub source", - "output": "callback-stub.cpp" - }, - { - "path": "callback.zapt", - "name": "ZCL callback header", - "output": "callback.h" - }, - { - "path": "client-command-macro.zapt", - "name": "ZCL client command", - "output": "client-command-macro.h" - }, - { - "path": "cluster-id.zapt", - "name": "ZCL cluster-id header", - "output": "cluster-id.h" - }, - { - "path": "command-id.zapt", - "name": "ZCL command-id header", - "output": "command-id.h" - }, - { - "path": "enums.zapt", - "name": "ZCL enums header", - "output": "enums.h" - }, - { - "path": "gen_config.zapt", - "name": "ZCL gen_config header", - "output": "gen_config.h" + "path": "templates/chip/chip-zcl-zpro-codec-api.zapt", + "name": "CHIP ZCL API Header", + "output": "src/app/chip-zcl-zpro-codec-api.h" }, { - "path": "print-cluster.zapt", - "name": "ZCL print-cluster header", - "output": "print-cluster.h" + "path": "templates/chip/encoder-src.zapt", + "name": "CHIP ZCL API", + "output": "src/app/encoder.cpp" } ] } diff --git a/src/app/zap-templates/common/StringHelper.js b/src/app/zap-templates/common/StringHelper.js new file mode 100644 index 00000000000000..c456c167bc3364 --- /dev/null +++ b/src/app/zap-templates/common/StringHelper.js @@ -0,0 +1,41 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const stringShortTypes = [ 'CHAR_STRING', 'OCTET_STRING' ]; +const stringLongTypes = [ 'LONG_CHAR_STRING', 'LONG_OCTET_STRING' ]; + +function isShortString(type) +{ + return stringShortTypes.includes(type); +} + +function isLongString(type) +{ + return stringLongTypes.includes(type); +} + +function isString(type) +{ + return isShortString(type) || isLongString(type); +} + +// +// Module exports +// +exports.isString = isString; +exports.isShortString = isShortString; +exports.isLongString = isLongString; diff --git a/src/app/zap-templates/override.js b/src/app/zap-templates/common/override.js similarity index 100% rename from src/app/zap-templates/override.js rename to src/app/zap-templates/common/override.js diff --git a/src/app/zap-templates/partials/header.zapt b/src/app/zap-templates/partials/header.zapt new file mode 100644 index 00000000000000..583960d1d0520a --- /dev/null +++ b/src/app/zap-templates/partials/header.zapt @@ -0,0 +1,16 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/src/app/zap-templates/partials/helper.js b/src/app/zap-templates/partials/helper.js new file mode 100644 index 00000000000000..f98c69e1e5c7c7 --- /dev/null +++ b/src/app/zap-templates/partials/helper.js @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function pad(label, len, ch = ' ') +{ + return label.padEnd(len, ch); +} + +function concat() +{ + let str = '' + for (let arg in arguments) + { + if (typeof arguments[arg] != 'object') { + str += arguments[arg]; + } + } + return str +} + +// +// Module exports +// +exports.pad = pad; +exports.concat = concat; diff --git a/src/app/zap-templates/af-structs.zapt b/src/app/zap-templates/templates/app/af-structs.zapt similarity index 97% rename from src/app/zap-templates/af-structs.zapt rename to src/app/zap-templates/templates/app/af-structs.zapt index 59dcfb754d584c..248cb9a8546442 100644 --- a/src/app/zap-templates/af-structs.zapt +++ b/src/app/zap-templates/templates/app/af-structs.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/att-storage.zapt b/src/app/zap-templates/templates/app/att-storage.zapt similarity index 99% rename from src/app/zap-templates/att-storage.zapt rename to src/app/zap-templates/templates/app/att-storage.zapt index b0491aa268a312..ed664f5f20cc7f 100644 --- a/src/app/zap-templates/att-storage.zapt +++ b/src/app/zap-templates/templates/app/att-storage.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/attribute-id.zapt b/src/app/zap-templates/templates/app/attribute-id.zapt similarity index 96% rename from src/app/zap-templates/attribute-id.zapt rename to src/app/zap-templates/templates/app/attribute-id.zapt index 203aa4c1a22f19..1b463bebf2d9a9 100644 --- a/src/app/zap-templates/attribute-id.zapt +++ b/src/app/zap-templates/templates/app/attribute-id.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/attribute-size.zapt b/src/app/zap-templates/templates/app/attribute-size.zapt similarity index 92% rename from src/app/zap-templates/attribute-size.zapt rename to src/app/zap-templates/templates/app/attribute-size.zapt index 0c802d586e8e9b..489dca0b893f68 100644 --- a/src/app/zap-templates/attribute-size.zapt +++ b/src/app/zap-templates/templates/app/attribute-size.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/attribute-type.zapt b/src/app/zap-templates/templates/app/attribute-type.zapt similarity index 92% rename from src/app/zap-templates/attribute-type.zapt rename to src/app/zap-templates/templates/app/attribute-type.zapt index c41da3019762d8..bc0e3fb7d2bee2 100644 --- a/src/app/zap-templates/attribute-type.zapt +++ b/src/app/zap-templates/templates/app/attribute-type.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/call-command-handler-src.zapt b/src/app/zap-templates/templates/app/call-command-handler-src.zapt similarity index 99% rename from src/app/zap-templates/call-command-handler-src.zapt rename to src/app/zap-templates/templates/app/call-command-handler-src.zapt index cf409f85f9446d..0f7313f4858c40 100644 --- a/src/app/zap-templates/call-command-handler-src.zapt +++ b/src/app/zap-templates/templates/app/call-command-handler-src.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} #include diff --git a/src/app/zap-templates/call-command-handler.zapt b/src/app/zap-templates/templates/app/call-command-handler.zapt similarity index 80% rename from src/app/zap-templates/call-command-handler.zapt rename to src/app/zap-templates/templates/app/call-command-handler.zapt index 6ab97918f1a89c..a57e126e3feb47 100644 --- a/src/app/zap-templates/call-command-handler.zapt +++ b/src/app/zap-templates/templates/app/call-command-handler.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/callback-stub-src.zapt b/src/app/zap-templates/templates/app/callback-stub-src.zapt similarity index 99% rename from src/app/zap-templates/callback-stub-src.zapt rename to src/app/zap-templates/templates/app/callback-stub-src.zapt index f73a3f658fc4e3..59fd45389523d1 100644 --- a/src/app/zap-templates/callback-stub-src.zapt +++ b/src/app/zap-templates/templates/app/callback-stub-src.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} #include "callback.h" #include "cluster-id.h" diff --git a/src/app/zap-templates/callback.zapt b/src/app/zap-templates/templates/app/callback.zapt similarity index 99% rename from src/app/zap-templates/callback.zapt rename to src/app/zap-templates/templates/app/callback.zapt index 2348c6fa870532..bd0bd8b2539c13 100644 --- a/src/app/zap-templates/callback.zapt +++ b/src/app/zap-templates/templates/app/callback.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/client-command-macro.zapt b/src/app/zap-templates/templates/app/client-command-macro.zapt similarity index 98% rename from src/app/zap-templates/client-command-macro.zapt rename to src/app/zap-templates/templates/app/client-command-macro.zapt index 04334521bd0120..e3f1518e20a679 100644 --- a/src/app/zap-templates/client-command-macro.zapt +++ b/src/app/zap-templates/templates/app/client-command-macro.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/cluster-id.zapt b/src/app/zap-templates/templates/app/cluster-id.zapt similarity index 91% rename from src/app/zap-templates/cluster-id.zapt rename to src/app/zap-templates/templates/app/cluster-id.zapt index 4331eb3b5ffe90..a89272d6bc99a5 100644 --- a/src/app/zap-templates/cluster-id.zapt +++ b/src/app/zap-templates/templates/app/cluster-id.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/command-id.zapt b/src/app/zap-templates/templates/app/command-id.zapt similarity index 96% rename from src/app/zap-templates/command-id.zapt rename to src/app/zap-templates/templates/app/command-id.zapt index 74a95c5a707fbe..9b6045feeac130 100644 --- a/src/app/zap-templates/command-id.zapt +++ b/src/app/zap-templates/templates/app/command-id.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/endpoint_config.zapt b/src/app/zap-templates/templates/app/endpoint_config.zapt similarity index 80% rename from src/app/zap-templates/endpoint_config.zapt rename to src/app/zap-templates/templates/app/endpoint_config.zapt index fba147fa7ab0d7..31f598c459370b 100644 --- a/src/app/zap-templates/endpoint_config.zapt +++ b/src/app/zap-templates/templates/app/endpoint_config.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/enums.zapt b/src/app/zap-templates/templates/app/enums.zapt similarity index 97% rename from src/app/zap-templates/enums.zapt rename to src/app/zap-templates/templates/app/enums.zapt index 729329ae2aa38d..2ae4602d5a1762 100644 --- a/src/app/zap-templates/enums.zapt +++ b/src/app/zap-templates/templates/app/enums.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/gen_config.zapt b/src/app/zap-templates/templates/app/gen_config.zapt similarity index 99% rename from src/app/zap-templates/gen_config.zapt rename to src/app/zap-templates/templates/app/gen_config.zapt index 67c3ad1fc10591..e573ff8328665a 100644 --- a/src/app/zap-templates/gen_config.zapt +++ b/src/app/zap-templates/templates/app/gen_config.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js new file mode 100644 index 00000000000000..ef4441c569c6dc --- /dev/null +++ b/src/app/zap-templates/templates/app/helper.js @@ -0,0 +1,194 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import helpers from zap core +const zapPath = '../../../../../third_party/zap/repo/src-electron/'; +const queryImpexp = require(zapPath + 'db/query-impexp.js') +const templateUtil = require(zapPath + 'generator/template-util.js') +const zclHelper = require(zapPath + 'generator/helper-zcl.js') +const zclQuery = require(zapPath + 'db/query-zcl.js') + +const StringHelper = require('../../common/StringHelper.js'); + +/** + * Check if the cluster (name) has any enabled manufacturer commands. This works only inside + * cluster block helpers. + * + * @param {*} name : Cluster name + * @param {*} side : Cluster side + * @param {*} options + * @returns True if cluster has enabled commands otherwise false + */ +function user_cluster_has_enabled_manufacturer_command(name, side, options) +{ + return queryImpexp.exportendPointTypeIds(this.global.db, this.global.sessionId) + .then((endpointTypes) => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(this.global.db, endpointTypes)) + .then((endpointsAndClusters) => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters( + this.global.db, endpointsAndClusters)) + .then((endpointCommands) => { + return !!endpointCommands.find(cmd => cmd.mfgCode && zclHelper.isStrEqual(name, cmd.clusterName) + && zclHelper.isCommandAvailable(side, cmd.incoming, cmd.outgoing, cmd.commandSource, cmd.name)); + }) +} + +function asValueIfNotPresent(type, isArray) +{ + if (StringHelper.isString(type) || isArray) { + return 'NULL'; + } + + function fn(pkgId) + { + const options = { 'hash' : {} }; + return zclHelper.asUnderlyingZclType.call(this, type, options).then(zclType => { + switch (zclType) { + case 'uint8_t': + return 'UINT8_MAX'; + case 'uint16_t': + return 'UINT16_MAX'; + case 'uint32_t': + return 'UINT32_MAX'; + default: + error = 'Unhandled underlying type ' + zclType + ' for original type ' + type; + throw error; + } + }) + } + + const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); + return templateUtil.templatePromise(this.global, promise) +} + +// TODO Expose the readTypeLength as an additional member field of {{asUnderlyingZclType}} instead +// of having to call this method separately. +function asReadTypeLength(type) +{ + const db = this.global.db; + + if (StringHelper.isShortString(type)) { + return '1u'; + } + + if (StringHelper.isLongString(type)) { + return '2u'; + } + + function fn(pkgId) + { + const defaultResolver = zclQuery.selectAtomicType(db, pkgId, type); + + const enumResolver = zclHelper.isEnum(db, type, pkgId).then(result => { + return result == 'unknown' ? null : zclQuery.selectEnumByName(db, type, pkgId).then(rec => { + return zclQuery.selectAtomicType(db, pkgId, rec.type); + }); + }); + + const bitmapResolver = zclHelper.isBitmap(db, type, pkgId).then(result => { + return result == 'unknown' ? null : zclQuery.selectBitmapByName(db, pkgId, type).then(rec => { + return zclQuery.selectAtomicType(db, pkgId, rec.type); + }); + }); + + const typeResolver = Promise.all([ defaultResolver, enumResolver, bitmapResolver ]); + return typeResolver.then(types => (types.find(type => type)).size); + } + + const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); + return templateUtil.templatePromise(this.global, promise) +} + +// TODO Expose the readType as an additional member field of {{asUnderlyingZclType}} instead +// of having to call this method separately. +function asReadType(type) +{ + if (StringHelper.isShortString(type)) { + return 'String'; + } + + if (StringHelper.isLongString(type)) { + return 'LongString'; + } + + function fn(pkgId) + { + const options = { 'hash' : {} }; + return zclHelper.asUnderlyingZclType.call(this, type, options).then(zclType => { + switch (zclType) { + case 'int8_t': + case 'uint8_t': + return 'Int8u'; + case 'int16_t': + case 'uint16_t': + return 'Int16u'; + case 'int24_t': + case 'uint24_t': + return 'Int24u'; + case 'int32_t': + case 'uint32_t': + return 'Int32u'; + case 'int64_t': + case 'uint64_t': + return 'Int64u'; + default: + error = 'Unhandled underlying type ' + zclType + ' for original type ' + type; + throw error; + } + }) + } + + const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); + return templateUtil.templatePromise(this.global, promise) +} + +/** + * Returns CHIP specific type for ZCL framework + * This function is flawed since it relies on the + * type label for CHIP type conversion. CHIP specific XML should have the + * correct type directly embedded inside. + * + * @param {*} label : The xml label of the type. + * @param {*} type : The xml type to be converted + */ +function asChipUnderlyingType(label, type) +{ + + if (zclHelper.isStrEqual(label, "endpoint")) { + return 'chip::EndpointId'; + } else if (zclHelper.isStrEqual(label, "endpointId")) { + return 'chip::EndpointId'; + } else if (zclHelper.isStrEqual(type, "CLUSTER_ID")) { + return 'chip::ClusterId'; + } else if (zclHelper.isStrEqual(type, "ATTRIBUTE_ID")) { + return 'chip::AttributeId'; + } else if (zclHelper.isStrEqual(label, "groupId")) { + return 'chip::GroupId'; + } else if (zclHelper.isStrEqual(label, "commandId")) { + return 'chip::CommandId'; + } else { + const options = { 'hash' : {} }; + return zclHelper.asUnderlyingZclType.call(this, type, options); + } +} + +// +// Module exports +// +exports.asReadType = asReadType; +exports.asReadTypeLength = asReadTypeLength; +exports.asValueIfNotPresent = asValueIfNotPresent; +exports.asChipUnderlyingType = asChipUnderlyingType; +exports.user_cluster_has_enabled_manufacturer_command = user_cluster_has_enabled_manufacturer_command; diff --git a/src/app/zap-templates/print-cluster.zapt b/src/app/zap-templates/templates/app/print-cluster.zapt similarity index 98% rename from src/app/zap-templates/print-cluster.zapt rename to src/app/zap-templates/templates/app/print-cluster.zapt index 7bed5cca10f338..6b9a41db9b3f08 100644 --- a/src/app/zap-templates/print-cluster.zapt +++ b/src/app/zap-templates/templates/app/print-cluster.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/chip-zcl-zpro-codec-api.zapt b/src/app/zap-templates/templates/chip/chip-zcl-zpro-codec-api.zapt similarity index 99% rename from src/app/zap-templates/chip-zcl-zpro-codec-api.zapt rename to src/app/zap-templates/templates/chip/chip-zcl-zpro-codec-api.zapt index dff22916ca3f61..8f349efb714a05 100644 --- a/src/app/zap-templates/chip-zcl-zpro-codec-api.zapt +++ b/src/app/zap-templates/templates/chip/chip-zcl-zpro-codec-api.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} // Prevent multiple inclusion #pragma once diff --git a/src/app/zap-templates/encoder-src.zapt b/src/app/zap-templates/templates/chip/encoder-src.zapt similarity index 99% rename from src/app/zap-templates/encoder-src.zapt rename to src/app/zap-templates/templates/chip/encoder-src.zapt index 422b97fe821698..a1a7de6c6662f6 100644 --- a/src/app/zap-templates/encoder-src.zapt +++ b/src/app/zap-templates/templates/chip/encoder-src.zapt @@ -1,4 +1,4 @@ -{{chip_header}} +{{> header}} #include "chip-zcl-zpro-codec.h" diff --git a/src/app/zap-templates/helper-chip.js b/src/app/zap-templates/templates/chip/helper.js similarity index 54% rename from src/app/zap-templates/helper-chip.js rename to src/app/zap-templates/templates/chip/helper.js index e5c00210b0df3e..5c647d8fef528f 100644 --- a/src/app/zap-templates/helper-chip.js +++ b/src/app/zap-templates/templates/chip/helper.js @@ -15,220 +15,15 @@ * limitations under the License. */ -/** - * This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial} - * - * @module Templating API: toplevel utility helpers - */ - // Import helpers from zap core -const zapPath = '../../../third_party/zap/repo/src-electron/'; -const cHelper = require(zapPath + 'generator/helper-c.js') -const zclHelper = require(zapPath + 'generator/helper-zcl.js') -const zclQuery = require(zapPath + 'db/query-zcl.js') +const zapPath = '../../../../../third_party/zap/repo/src-electron/'; const queryConfig = require(zapPath + 'db/query-config.js') const queryImpexp = require(zapPath + 'db/query-impexp.js') const templateUtil = require(zapPath + 'generator/template-util.js') +const zclHelper = require(zapPath + 'generator/helper-zcl.js') +const zclQuery = require(zapPath + 'db/query-zcl.js') -/** - * Produces the top-of-the-file header for a C file. - * - * @returns The header content - */ -function chip_header() -{ - return ` - /* - * - * Copyright (c) 2020 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */`; -} - -const stringShortTypes = [ 'CHAR_STRING', 'OCTET_STRING' ]; -const stringLongTypes = [ 'LONG_CHAR_STRING', 'LONG_OCTET_STRING' ]; - -function isShortString(type) -{ - return stringShortTypes.includes(type); -} - -function isLongString(type) -{ - return stringLongTypes.includes(type); -} - -function isString(type) -{ - return isShortString(type) || isLongString(type); -} - -function asValueIfNotPresent(type, isArray) -{ - if (isString(type) || isArray) { - return 'NULL'; - } - - function fn(pkgId) - { - const options = { 'hash' : {} }; - return zclHelper.asUnderlyingZclType.call(this, type, options).then(zclType => { - switch (zclType) { - case 'uint8_t': - return 'UINT8_MAX'; - case 'uint16_t': - return 'UINT16_MAX'; - case 'uint32_t': - return 'UINT32_MAX'; - default: - error = 'Unhandled underlying type ' + zclType + ' for original type ' + type; - throw error; - } - }) - } - - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise) -} - -// TODO Expose the readTypeLength as an additional member field of {{asUnderlyingZclType}} instead -// of having to call this method separately. -function asReadTypeLength(type) -{ - const db = this.global.db; - - if (isShortString(type)) { - return '1u'; - } - - if (isLongString(type)) { - return '2u'; - } - - function fn(pkgId) - { - const defaultResolver = zclQuery.selectAtomicType(db, pkgId, type); - - const enumResolver = zclHelper.isEnum(db, type, pkgId).then(result => { - return result == 'unknown' ? null : zclQuery.selectEnumByName(db, type, pkgId).then(rec => { - return zclQuery.selectAtomicType(db, pkgId, rec.type); - }); - }); - - const bitmapResolver = zclHelper.isBitmap(db, type, pkgId).then(result => { - return result == 'unknown' ? null : zclQuery.selectBitmapByName(db, pkgId, type).then(rec => { - return zclQuery.selectAtomicType(db, pkgId, rec.type); - }); - }); - - const typeResolver = Promise.all([ defaultResolver, enumResolver, bitmapResolver ]); - return typeResolver.then(types => (types.find(type => type)).size); - } - - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise) -} - -// TODO Expose the readType as an additional member field of {{asUnderlyingZclType}} instead -// of having to call this method separately. -function asReadType(type) -{ - if (isShortString(type)) { - return 'String'; - } - - if (isLongString(type)) { - return 'LongString'; - } - - function fn(pkgId) - { - const options = { 'hash' : {} }; - return zclHelper.asUnderlyingZclType.call(this, type, options).then(zclType => { - switch (zclType) { - case 'int8_t': - case 'uint8_t': - return 'Int8u'; - case 'int16_t': - case 'uint16_t': - return 'Int16u'; - case 'int24_t': - case 'uint24_t': - return 'Int24u'; - case 'int32_t': - case 'uint32_t': - return 'Int32u'; - case 'int64_t': - case 'uint64_t': - return 'Int64u'; - default: - error = 'Unhandled underlying type ' + zclType + ' for original type ' + type; - throw error; - } - }) - } - - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise) -} - -/** - * Returns CHIP specific type for ZCL framework - * This function is flawed since it relies on the - * type label for CHIP type conversion. CHIP specific XML should have the - * correct type directly embedded inside. - * - * @param {*} label : The xml label of the type. - * @param {*} type : The xml type to be converted - */ -function asChipUnderlyingType(label, type) -{ - - if (zclHelper.isStrEqual(label, "endpoint")) { - return 'chip::EndpointId' - } else if (zclHelper.isStrEqual(label, "endpointId")) { - return 'chip::EndpointId' - } else if (zclHelper.isStrEqual(type, "CLUSTER_ID")) { - return 'chip::ClusterId' - } else if (zclHelper.isStrEqual(type, "ATTRIBUTE_ID")) { - return 'chip::AttributeId' - } else if (zclHelper.isStrEqual(label, "groupId")) { - return 'chip::GroupId' - } else if (zclHelper.isStrEqual(label, "commandId")) { - return 'chip::CommandId' - } else { - const options = { 'hash' : {} }; - return zclHelper.asUnderlyingZclType.call(this, type, options) - } -} - -function pad(label, len, ch = ' ') -{ - return label.padEnd(len, ch) -} - -function concat() -{ - let str = '' - for (let arg in arguments) - { - if (typeof arguments[arg] != 'object') { - str += arguments[arg] - } - } - return str -} +const StringHelper = require('../../common/StringHelper.js'); /** * This method converts a ZCL type to the length expected for the @@ -357,7 +152,7 @@ function chip_server_cluster_command_arguments(options) { return Promise.all(args.map(arg => collectItem.call(this, arg, pkgId))).then(items => items.flat()).then(items => { return Promise.all(items.map(item => { - if (isString(item.type)) { + if (StringHelper.isString(item.type)) { // Enhanced the command argument with 'chipType' for conveniences. item.chipType = 'char *'; return item; @@ -474,11 +269,17 @@ function chip_server_cluster_attributes(options) return getAttributes.call(this, pkgId, options).then(atts => { atts = atts.filter(att => att.clusterCode == clusterCode && att.side == clusterSide); atts.forEach(att => { - if (att.writable || att.reportable.included) { + const sameAttributes = atts.filter(att2 => att.name == att2.name); + let isWritable = !!sameAttributes.find(att2 => att2.writable); + let isReportable = !!sameAttributes.find(att2 => att2.reportable.included); + if (isWritable || isReportable) { att.chipTypePutLength = asPutLength(att.chipType); att.chipTypePutCastType = asPutCastType(att.chipType); + att.writable = isWritable; + att.reportable.included = isReportable; } }) + atts = atts.filter((att, index) => atts.findIndex(att2 => att.name == att2.name) == index); return templateUtil.collectBlocks(atts, options, this); }) } @@ -525,27 +326,6 @@ function isReportableAttribute(options) return this.reportable.included == 1; } -/** - * Check if the cluster (name) has any enabled manufacturer commands. This works only inside - * cluster block helpers. - * - * @param {*} name : Cluster name - * @param {*} side : Cluster side - * @param {*} options - * @returns True if cluster has enabled commands otherwise false - */ -function user_cluster_has_enabled_manufacturer_command(name, side, options) -{ - return queryImpexp.exportendPointTypeIds(this.global.db, this.global.sessionId) - .then((endpointTypes) => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(this.global.db, endpointTypes)) - .then((endpointsAndClusters) => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters( - this.global.db, endpointsAndClusters)) - .then((endpointCommands) => { - return !!endpointCommands.find(cmd => cmd.mfgCode && zclHelper.isStrEqual(name, cmd.clusterName) - && zclHelper.isCommandAvailable(side, cmd.incoming, cmd.outgoing, cmd.commandSource, cmd.name)); - }) -} - /** * Returns if a given command is manufacturer specific * @@ -565,27 +345,15 @@ function isManufacturerSpecificCommand() return !!this.mfgCode; } -// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! // -// Note: these exports are public API. Templates that might have been created in the past and are -// available in the wild might depend on these names. -// If you rename the functions, you need to still maintain old exports list. -exports.chip_header = chip_header; -exports.isString = isString; -exports.pad = pad -exports.concat = concat -exports.asReadType = asReadType; -exports.asReadTypeLength = asReadTypeLength; -exports.asValueIfNotPresent = asValueIfNotPresent; -exports.asChipUnderlyingType = asChipUnderlyingType; - -exports.chip_server_clusters = chip_server_clusters; -exports.chip_server_cluster_commands = chip_server_cluster_commands; -exports.chip_server_cluster_command_arguments = chip_server_cluster_command_arguments -exports.isSignedType = isSignedType; -exports.isDiscreteType = isDiscreteType; -exports.chip_server_cluster_attributes = chip_server_cluster_attributes; -exports.isWritableAttribute = isWritableAttribute; -exports.isReportableAttribute = isReportableAttribute; -exports.user_cluster_has_enabled_manufacturer_command = user_cluster_has_enabled_manufacturer_command; -exports.isManufacturerSpecificCommand = isManufacturerSpecificCommand; +// Module exports +// +exports.chip_server_clusters = chip_server_clusters; +exports.chip_server_cluster_commands = chip_server_cluster_commands; +exports.chip_server_cluster_command_arguments = chip_server_cluster_command_arguments +exports.isSignedType = isSignedType; +exports.isDiscreteType = isDiscreteType; +exports.chip_server_cluster_attributes = chip_server_cluster_attributes; +exports.isWritableAttribute = isWritableAttribute; +exports.isReportableAttribute = isReportableAttribute; +exports.isManufacturerSpecificCommand = isManufacturerSpecificCommand;