3333" *****************************************************************************/" ,
3434" " ,
3535" /**" ,
36- " * @file ${TM_FILENAME }" ,
36+ " * @defgroup ${TM_FILENAME_BASE }" ,
3737" * @brief TODO: Write brief for ${TM_FILENAME_BASE}" ,
3838" *" ,
3939" * TODO: Write component description for ${TM_FILENAME_BASE}" ,
135135 ],
136136 "description" : " Unity Test"
137137 },
138-
139- "Command Class handler C file" : {
138+ "Rust file" : {
140139 "prefix" : " zpc" ,
141- "scope" : " c,cpp " ,
140+ "scope" : " rust " ,
142141 "body" :[
143- " /******************************************************************************" ,
144- " * # License" ,
145- " * <b>Copyright ${CURRENT_YEAR} Silicon Laboratories Inc. www.silabs.com</b>" ,
146- " ******************************************************************************" ,
147- " * The licensor of this software is Silicon Laboratories Inc. Your use of this" ,
148- " * software is governed by the terms of Silicon Labs Master Software License" ,
149- " * Agreement (MSLA) available at" ,
150- " * www.silabs.com/about-us/legal/master-software-license-agreement. This" ,
151- " * software is distributed to you in Source Code format and is governed by the" ,
152- " * sections of the MSLA applicable to Source Code." ,
153- " *" ,
154- " *****************************************************************************/" ,
155- " " ,
156- " // Includes from this component" ,
157- " #include \" ${TM_FILENAME_BASE}.h\" " ,
158- " " ,
159- " // Generic includes" ,
160- " #include <assert.h>" ,
161- " #include <stdbool.h>" ,
162- " " ,
163- " // Includes from other components" ,
164- " #include \" ZW_classcmd.h\" " ,
165- " #include \" zwave_command_handler.h\" " ,
166- " #include \" zwave_controller_connection_info.h\" " ,
167- " #include \" zwave_controller_utils.h\" " ,
168- " #include \" zwave_rx.h\" " ,
169- " " ,
170- " #include \" attribute_store.h\" " ,
171- " #include \" attribute_store_helper.h\" " ,
172- " #include \" attribute_store_network_helper.h\" " ,
173- " #include \" attribute_resolver.h\" " ,
174- " " ,
175- " #include \" zwave_unid.h\" " ,
176- " " ,
177- " #include \" sl_log.h\" " ,
178- " #define LOG_TAG \" ${TM_FILENAME_BASE}\" " ,
179- " " ,
180- " " ,
181142 " ///////////////////////////////////////////////////////////////////////////////" ,
182- " // Private helper functions" ,
183- " ///////////////////////////////////////////////////////////////////////////////" ,
184- " " ,
185- " " ,
143+ " // # License" ,
144+ " // <b>Copyright ${CURRENT_YEAR} Silicon Laboratories Inc. www.silabs.com</b>" ,
186145 " ///////////////////////////////////////////////////////////////////////////////" ,
187- " // Command Handler functions" ,
146+ " // The licensor of this software is Silicon Laboratories Inc. Your use of this" ,
147+ " // software is governed by the terms of Silicon Labs Master Software License" ,
148+ " // Agreement (MSLA) available at" ,
149+ " // www.silabs.com/about-us/legal/master-software-license-agreement. This" ,
150+ " // software is distributed to you in Source Code format and is governed by the" ,
151+ " // sections of the MSLA applicable to Source Code." ,
152+ " //" ,
188153 " ///////////////////////////////////////////////////////////////////////////////" ,
189- " static sl_status_t" ,
190- " ${TM_FILENAME_BASE}_handle_xxx_command(" ,
191- " const zwave_controller_connection_info_t *connection_info," ,
192- " const uint8_t *frame_data," ,
193- " uint16_t frame_length)" ,
194- " {" ,
195- " if (frame_length < xxx ) {" ,
196- " // Frame too short?? Just ignore it and return SUCCESS to supervision" ,
197- " // Since it is a report." ,
198- " return SL_STATUS_OK;" ,
199- " }" ,
200- " " ,
201- " // Find the NodeID in the attribute store." ,
202- " attribute_store_node_t node_id_node" ,
203- " = attribute_store_network_helper_get_zwave_node_id_node(" ,
204- " connection_info->remote.node_id);" ,
205- " " ,
206- " // Save the data from this command" ,
207- " xxx" ,
208- " " ,
209- " return SL_STATUS_OK;" ,
210- " }" ,
211- " " ,
212- " " ,
213- " static sl_status_t ${TM_FILENAME_BASE}_handler(" ,
214- " const zwave_controller_connection_info_t *connection_info," ,
215- " const zwave_rx_receive_options_t *rx_options," ,
216- " const uint8_t *frame_data," ,
217- " uint16_t frame_length)" ,
218- " {" ,
219- " if (frame_length < 2) {" ,
220- " return SL_STATUS_NOT_SUPPORTED;" ,
221- " }" ,
222- " " ,
223- " if (frame_data[0] != xxx) {" ,
224- " return SL_STATUS_NOT_SUPPORTED;" ,
225- " }" ,
226- " " ,
227- " switch (frame_data[1]) {" ,
228- " case xxx:" ,
229- " return ${TM_FILENAME_BASE}_handle_xxx_command(" ,
230- " connection_info," ,
231- " frame_data," ,
232- " frame_length);" ,
233- " " ,
234- " default:" ,
235- " return SL_STATUS_NOT_SUPPORTED;" ,
236- " }" ,
237- " }" ,
238- " " ,
239- " ///////////////////////////////////////////////////////////////////////////////" ,
240- " // Attribute resolution functions" ,
241- " ///////////////////////////////////////////////////////////////////////////////" ,
242- " static sl_status_t ${TM_FILENAME_BASE}_get(" ,
243- " attribute_store_node_t node, uint8_t *frame, uint16_t *frame_len)" ,
244- " {" ,
245- " // Create a frame for the attribute resolver" ,
246- " xxx" ,
247- " " ,
248- " *frame_len = sizeof(xxx);" ,
249- " return SL_STATUS_OK;" ,
250- " }" ,
251- " " ,
252- " ///////////////////////////////////////////////////////////////////////////////" ,
253- " // Attribute update callbacks" ,
254- " ///////////////////////////////////////////////////////////////////////////////" ,
255- " static void ${TM_FILENAME_BASE}_on_version_attribute_update(" ,
256- " attribute_store_node_t updated_node, attribute_store_change_t change)" ,
257- " {" ,
258- " if (change == ATTRIBUTE_DELETED) {" ,
259- " return;" ,
260- " }" ,
261- " " ,
262- " // Check that we have the right type of attribute." ,
263- " assert(ATTRIBUTE_COMMAND_CLASS_xxx_VERSION" ,
264- " == attribute_store_get_node_type(updated_node));" ,
265- " " ,
266- " uint8_t supporting_node_version = 0;" ,
267- " attribute_store_read_value(updated_node," ,
268- " REPORTED_ATTRIBUTE," ,
269- " &supporting_node_version," ,
270- " sizeof(supporting_node_version));" ,
271- " " ,
272- " if (supporting_node_version == 0) {" ,
273- " // Wait for the version to be known." ,
274- " return;" ,
275- " }" ,
276- " " ,
277- " // Now we know we have a supporting node." ,
278- " // Check that the minimum attributes are created" ,
279- " attribute_store_node_t endpoint_node" ,
280- " = attribute_store_get_node_parent(updated_node);" ,
281- " " ,
282- " // Let the rest of the command class perform the job." ,
283- " attribute_store_type_t attribute_list[]" ,
284- " = {xxx};" ,
285- " attribute_store_add_if_missing(endpoint_node," ,
286- " attribute_list," ,
287- " COUNT_OF(attribute_list));" ,
288- " }" ,
289- " " ,
290- " ///////////////////////////////////////////////////////////////////////////////" ,
291- " // Public interface functions" ,
292- " ///////////////////////////////////////////////////////////////////////////////" ,
293- " sl_status_t ${TM_FILENAME_BASE}_init()" ,
294- " {" ,
295- " " ,
296- " // Register our handler to the Z-Wave CC framework:" ,
297- " zwave_command_handler_t handler;" ,
298- " handler.handler = ${TM_FILENAME_BASE}_handler;" ,
299- " handler.minimal_scheme" ,
300- " = ZWAVE_CONTROLLER_ENCAPSULATION_NETWORK_SCHEME;" ,
301- " handler.command_class = COMMAND_CLASS_xxx;" ,
302- " handler.version = xxx;" ,
303- " handler.support = false;" ,
304- " handler.control = false;" ,
305- " " ,
306- " zwave_command_handler_register_handler(handler);" ,
307- " " ,
308- " return SL_STATUS_OK;" ,
309- " }"
310154 ],
311- "description" : " Command Class handler C file"
312- },
313-
314-
155+ "description" : " UIC rust source file"
156+ },
315157}
0 commit comments