<?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>Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70222/reading-command-payload-in-zigbee-callback</link><description>Hello all! 
 
 I have been modifying the door_lock_nus example to add the set pin command (0x05 from zcl reference). So I have modified the zigbee callback to read the new command, and I am doing it right with: 
 
 The procces is as follows: 
 1.- Start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Feb 2021 14:47:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70222/reading-command-payload-in-zigbee-callback" /><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/293809?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 14:47:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcb54be7-0314-4c82-99dc-3a9d056d9c1f</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should be able to use the code I posted in a coordinator that does not use CLI as well.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/293729?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 10:58:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a48c0ca-8671-4fb8-806c-bf74995dfc02</guid><dc:creator>mazis</dc:creator><description>&lt;p&gt;Just one last questuin Marte, I was using the CLI agent tool for the early stages of the development but now I switched to the final coordinator. The final coordinator is not a NRF52840DK board and I am experimenting some issues with the interview.&lt;/p&gt;
&lt;p&gt;My question is if the code you posted could be used in a ZCL callback? Do I have to modify something?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/293319?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 12:12:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3c13788-97b5-455b-b6f1-09ac3817fa05</guid><dc:creator>mazis</dc:creator><description>&lt;p&gt;Thank you Marte!&lt;/p&gt;
&lt;p&gt;I will give the code a try in a few days. So if it works fine, I would mark your answer as verified.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/292460?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 12:17:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42683fce-af4e-4864-956f-2eca7f564a56</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry for the late reply, but I finally heard back from the Zigbee team:&lt;/p&gt;
&lt;p&gt;The code for checking the command is in the right direction. The command payload can be obtained by reading the buffer passed into the callback by its id (bufid), just like in the case of obtaining the command type.&lt;/p&gt;
&lt;p&gt;In the code listed below you can find the most straightforward way to obtain the command payload. (param is bufid in this code)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
switch (cmd_info-&amp;gt;cmd_id) {
    case ZB_ZCL_CMD_DOOR_LOCK_SET_PIN_CODE: {
        zb_uint8_t cmd_len = zb_buf_len(param);
        zb_uint8_t *pin_payload = (zb_uint8_t*) zb_buf_begin(param);
 
        LOG_INF(&amp;quot;Command set pin has len of %u&amp;quot;, cmd_len);
 
        for (int i = 0; i &amp;lt; cmd_len; i++)
        {
            LOG_INF(&amp;quot;Payload[%u] %u&amp;quot;, i, pin_payload[i]); 
        }
        break;
    }
    default:
        LOG_INF(&amp;quot;Received unknown command!&amp;quot;);
        break;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you are using CLI Agent tool, then correct syntax for sending a command with a payload would be:&amp;nbsp;zcl cmd f4ce3693d838e02b 1 0101 -p 0104 05&amp;nbsp;&lt;/span&gt;&lt;b&gt;-l&lt;/b&gt;&lt;span&gt;&amp;nbsp;0x000000001234.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Without &amp;quot;-l&amp;quot;, the command will not contain any payload.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Marte&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/290181?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 10:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7e8e46d-68c5-4272-a189-8d4cd217b6a6</guid><dc:creator>mazis</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know if I am right because I am very new into Zigbee, but I think I am using an endpoint handler. The code I&amp;#39;m using is this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;zb_zcl_parsed_hdr_t *cmd_info = ZB_BUF_GET_PARAM(bufid, zb_zcl_parsed_hdr_t);

switch (cmd_info -&amp;gt; cmd_id)
    {
        case ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR:
            ...
            break;

        case ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR:
            ...
            break;

        case ZB_ZCL_CMD_DOOR_LOCK_SET_PIN_CODE:
            ...
            break;

        default:
            ...
            break;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To set the commands handler I am using this code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ZB_AF_SET_ENDPOINT_HANDLER(ZB_ZCL_CLUSTER_ID_DOOR_LOCK, ep_cb);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope it helps.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/290178?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 09:52:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6117806c-38f6-400d-8fee-3ce2219a1742</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It would help to know what type of Zigbee callback you&amp;#39;re using. Is it endpoint handler? ZCL callback?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/290016?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2021 13:42:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a993eaeb-ccbf-4f88-a8af-f7d5ed32b892</guid><dc:creator>mazis</dc:creator><description>&lt;p&gt;Thank you very much, I&amp;#39;ll be waiting for answers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/289678?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 10:36:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a29e8eaf-5c37-471c-aee7-97eced07f739</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry for the delay. I ended up having to ask our Zigbee team internally, which I did early last week. I still haven&amp;#39;t gotten a response from them as they have a lot to do right now, but I&amp;#39;ll let you know as soon as I hear back from them.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading command payload in zigbee callback</title><link>https://devzone.nordicsemi.com/thread/288200?ContentTypeID=1</link><pubDate>Fri, 08 Jan 2021 14:00:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7db7c56-7def-4b41-8bdf-310b4381e08e</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have started looking into your case and will come back to you early next week.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>