<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Read ZCL command field and then call default handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84686/read-zcl-command-field-and-then-call-default-handler</link><description>Hi, 
 I&amp;#39;m having some difficulties understanding how to manage commands in endpoint-specific callbacks. For example, when receiving a &amp;quot;ZB_ZCL_CMD_CONFIG_REPORT&amp;quot; I&amp;#39;m able to intercept the command by checking the &amp;quot; zb_zcl_parsed_hdr_t &amp;quot; structure. My doubt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Feb 2022 14:31:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84686/read-zcl-command-field-and-then-call-default-handler" /><item><title>RE: Read ZCL command field and then call default handler</title><link>https://devzone.nordicsemi.com/thread/354625?ContentTypeID=1</link><pubDate>Wed, 23 Feb 2022 14:31:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d146948-dbb6-4bc3-ba9a-c6708b92d573</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;From the team:&lt;/p&gt;
&lt;p&gt;Alright, I didn&amp;#39;t see that coming. This is doable but I haven&amp;#39;t tested this - be careful not to change things that shouldn&amp;#39;t be changed.&lt;br /&gt; &lt;br /&gt;One way to do this is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;There is always a reporting default configuration, after the device startup the measurement frequency should be adjusted to that.&lt;/li&gt;
&lt;li&gt;For runtime configuration changes, parse incoming ZCL command to look for Configure Reporting frame and once catched, schedule adjusting measurement frequency. Be careful and don&amp;#39;t parse the payload, left it to the stack.&lt;/li&gt;
&lt;li&gt;zb_zcl_reporting_info_t can be read (don&amp;#39;t make any changes in this structure!) to get minimum reporting interval, zb_zcl_find_reporting_info() should return a pointer to a structure corresponding to a temperature attribute.&lt;br /&gt; For this structure to be updated, the stack needs to process the received command - schedule adjusting measurement frequency after some delay.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;One thing to consider: reporting can be configured with minimum interval set to zero, so be aware of possible edge cases.&lt;br /&gt;Also, with change-based reporting it would be to an application to select the measurement frequency - minimum reporting interval doesn&amp;#39;t provide such information in this case.&lt;/p&gt;
&lt;p&gt;I would also suggest getting familiar with &lt;strong&gt;ZCL &lt;/strong&gt;&lt;b&gt;Specification&lt;/b&gt; (&lt;strong&gt;2.5.7 Configure Reporting Command)&lt;/strong&gt; to understand possible reporting configurations.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read ZCL command field and then call default handler</title><link>https://devzone.nordicsemi.com/thread/354385?ContentTypeID=1</link><pubDate>Tue, 22 Feb 2022 14:25:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:066f84a4-994b-435f-a6d4-0524bbd95cdc</guid><dc:creator>Valerio.Colombo</dc:creator><description>&lt;p&gt;Hi, thanks for the responses.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll explain what we&amp;#39;re trying to do so that you have some context. We are implementing some Zigbee sensors. Let&amp;rsquo;s take the example of a temperature sensor. We would like to take a measurement at a rate equal to the minimum reporting period, so as not to make useless measurements. In our case, the minimum reporting period is not known a priori but is discovered/configured at runtime. We would like to obtain it and use it to set our internal measurement frequency instead of hardcoding it.&lt;/p&gt;
&lt;p&gt;To rephrase, is&amp;nbsp;there&amp;#39;s some intended way to match the reporting frequency to the sensor measurement frequency at runtime?&lt;/p&gt;
&lt;p&gt;The problem could be solved also by reading the values from the &amp;quot;&lt;span&gt;zb_zcl_reporting_info_t&lt;/span&gt;&amp;quot; structure. To do so, a mechanism that notifies when the configuration has been done is needed.&lt;/p&gt;
&lt;p&gt;Is there a way to know when the reporting has been configured, without periodically checking the structure for changes?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Valerio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read ZCL command field and then call default handler</title><link>https://devzone.nordicsemi.com/thread/353796?ContentTypeID=1</link><pubDate>Fri, 18 Feb 2022 10:04:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92733549-e6a3-4f1b-af0d-035bfd8e8d0a</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The team doesn&amp;#39;t really understand what you try to achieve with what you are doing but this may explain some of the bits:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Why reading Configure Reporting cmd when this command should be handled by the Zigbee stack?&lt;br /&gt;&lt;br /&gt;Reporting is handled internally in the stack and it&amp;#39;s better to not mess with that to avoid unwanted behavior.&lt;br /&gt; Reading and parsing this command in the endpoint handler can cause problems, explained below:&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Parsing Configure Reporting cmd with &lt;code&gt;ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ&lt;/code&gt;&lt;span&gt; can modify the buffer the command is stored in.&lt;br /&gt; You can see that in details inside the &lt;/span&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Endpoint handlers are used to intercept ZCL frames coming to the specific endpoint and the value returned by the handler function tells the stack if this command should be further processed or not:&lt;br /&gt; &lt;code&gt;ZB_FALSE&lt;/code&gt; if stack should process it,&lt;br /&gt; &lt;code&gt;ZB_TRUE&lt;/code&gt; if the command was processed in the handler function and should not be processed by the stack.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Endpoint handlers are frequently used in &lt;strong&gt;Zigbee Shell&lt;/strong&gt; (&lt;strong&gt;cli agent&lt;/strong&gt; in nRF5 SDK) and there are few use cases implemented there. &lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/latest/nrf/libraries/zigbee/shell.html" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/zigbee/shell.html" rel="noopener noreferrer" target="_blank"&gt;Zigbee shell in NCS doc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When it comes to parsing the ZCL frame fields, the Zigbee &lt;strong&gt;endpoint logger&lt;/strong&gt; can be an example implementation of that. &lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/latest/nrf/libraries/zigbee/zigbee_logger_eprxzcl.html" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/zigbee/zigbee_logger_eprxzcl.html" rel="noopener noreferrer" target="_blank"&gt;Zigbee endpoint logger in NCS doc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In general, ZBOSS documentation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/zboss/3.11.1.0/using_zigbee__z_c_l.html#process_zcl_cmd" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.11.1.0/using_zigbee__z_c_l.html#process_zcl_cmd" rel="noopener noreferrer" target="_blank"&gt;Regarding endpoint handlers and configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/zboss/3.11.1.0/using_zigbee__z_c_l.html#zcl_cmd_parse" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.11.1.0/using_zigbee__z_c_l.html#zcl_cmd_parse" rel="noopener noreferrer" target="_blank"&gt;Parsing ZCL commands&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read ZCL command field and then call default handler</title><link>https://devzone.nordicsemi.com/thread/353648?ContentTypeID=1</link><pubDate>Thu, 17 Feb 2022 14:28:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c14ef19-24f0-4619-a355-71f7508d9903</guid><dc:creator>Valerio.Colombo</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tried the suggested code and it reads successfully the fields of the reporting command request. But as I feared, when I propagate the command to the default handler, by returning ZB_FALSE, I see from the&amp;nbsp;&lt;span&gt;traces captured with Wireshark that the configuration request response is malformed. I attach the log and a screenshot of the trace.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Valerio&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/configure_5F00_reporting_5F00_error.pcapng"&gt;devzone.nordicsemi.com/.../configure_5F00_reporting_5F00_error.pcapng&lt;/a&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1280x480/__key/communityserver-discussions-components-files/4/Configuration_5F00_error.png" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read ZCL command field and then call default handler</title><link>https://devzone.nordicsemi.com/thread/352921?ContentTypeID=1</link><pubDate>Mon, 14 Feb 2022 14:02:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25c44f19-b5b2-4de5-802e-9fca28428a98</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Usually, with callbacks for ZCL commands you would use zb_zcl_device_callback_param_t in the callback function to get the data, but you can&amp;#39;t use this with the configure reporting command. I think the best method is to use&amp;nbsp;&lt;/span&gt;&lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/zboss/3.11.1.0/group__cfg__reporting__cmd.html#ga9236a56e74f5f8715869aa94590416fc" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.11.1.0/group__cfg__reporting__cmd.html#ga9236a56e74f5f8715869aa94590416fc" rel="noopener noreferrer" target="_blank"&gt;ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ&lt;/a&gt;&lt;span&gt;&amp;nbsp;to parse the configure reporting command:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;zb_zcl_configure_reporting_req_t *config_rep_req;
ZB_ZCL_GENERAL_GET_NEXT_CONFIGURE_REPORTING_REQ(bufid, config_rep_req);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You should then be able to get the min and max interval from config_rep_req (&lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/zboss/3.11.1.0/structzb__zcl__configure__reporting__req__s.html" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.11.1.0/structzb__zcl__configure__reporting__req__s.html" rel="noopener noreferrer" target="_blank"&gt;zb_zcl_configure_reporting_req_s&lt;/a&gt;):&lt;/p&gt;
&lt;p&gt;config_rep_req-&amp;gt;u.clnt.min_interval&lt;/p&gt;
&lt;p&gt;config_rep_req-&amp;gt;u.clnt.max_interval&lt;/p&gt;
&lt;p&gt;There&amp;#39;s more information on this here:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/zboss/3.11.1.0/group__cfg__reporting__cmd.html" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.11.1.0/group__cfg__reporting__cmd.html" rel="noopener noreferrer" target="_blank"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.11.1.0/group__cfg__reporting__cmd.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>