3 * Copyright (c) 2020 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
21 * @module Templating API: toplevel utility helpers
24 // Import Zcl helper from zap core
25 const helperZcl = require('../../../third_party/zap/repo/src-electron/generator/helper-zcl.js')
28 * Dummy helper that add a string to the templates showing
29 * if the strings matches. Use to demonstrate the use
30 * of ZAP helper within the chip-helper environment
32 * @param {*} str1 : First string to compare
33 * @param {*} str2 : Second string to comapre
35 function example_helper(str1, str2) {
36 if (helperZcl.isStrEqual(str1, str2)) {
37 return 'The two strings are identical'
39 return 'The two strings are different'
44 * Produces the top-of-the-file header for a C file.
46 * @returns The header content
48 function chip_header() {
52 * Copyright (c) 2020 Project CHIP Authors
54 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
56 * You may obtain a copy of the License at
58 * http://www.apache.org/licenses/LICENSE-2.0
60 * Unless required by applicable law or agreed to in writing, software
61 * distributed under the License is distributed on an "AS IS" BASIS,
62 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63 * See the License for the specific language governing permissions and
64 * limitations under the License.
68 // WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
70 // Note: these exports are public API. Templates that might have been created in the past and are
71 // available in the wild might depend on these names.
72 // If you rename the functions, you need to still maintain old exports list.
73 exports.chip_header = chip_header;
74 exports.example_helper = example_helper;