<?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>[nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48890/nrf52840-with-zigbee-how-to-append-user-data-append-to-ha-profile</link><description>Hi, 
 I am developing a system similar to door lock system. 
 In our system, user data should transmit from ZED(or ZR) to ZC. 
 So i modified the ZB_ZCL_ON_OFF_SEND_REQ macro to add user data. 
 With wireshark, packet size is ok (includes the user data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Jun 2019 05:27:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48890/nrf52840-with-zigbee-how-to-append-user-data-append-to-ha-profile" /><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194987?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 05:27:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ed8f1b9-719c-4a74-9034-79eaddb8cfa7</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I appreciate for your detailed reply and suggestion.&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194960?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 19:16:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a941a20b-bcd5-46d3-b758-c3430bd7f284</guid><dc:creator>tomchy</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;as the next step, you may also look into the CLI ping command implementation. It looks like it does exactly the thing that you want to achieve - presents how to send a hand-crafted, raw ZCL packet via Zigbee.&lt;/p&gt;
&lt;p&gt;Over time it got quite complicated (you may want to look inside previous SDKs to check that), so it might not be that easy to understand what&amp;#39;s going on inside &amp;quot;cli_agent_ep_handler_ping&amp;quot; (the endpoint handler), but the most important piece is right at the beginning of the function:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    zb_buf_t * p_zcl_cmd_buf = (zb_buf_t *)ZB_BUF_FROM_REF(param);
    zb_zcl_parsed_hdr_t * p_cmd_info = ZB_GET_BUF_PARAM(p_zcl_cmd_buf, zb_zcl_parsed_hdr_t);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;There are two pointers - one of them (p_zcl_cmd_buf) gives you the access to the payload of the received ZCL packet, the other one (p_cmd_info) gives you all additional data from ZCL header and other, lower layers headers you may need (RSSI, addresses, endpoints, cluster ID, profile ID, command ID, sequence number etc.).&lt;/p&gt;
&lt;p&gt;Note that whatever you do inside endpoint handler - you should behave according to the specification. If someone requests a default response - you should send one. Returning ZB_TRUE means that everything related to that packet got processed inside the application (i.e. the buffer got reused or freed), and no further processing will be performed. If you plan to return ZB_FALSE, please remember not to modify the packet, or recover the initial state of the buffer before returning (like endianness). The endpoint handler is a very powerful tool and must be used with care.&lt;/p&gt;
&lt;p&gt;If you plan to implement a custom cluster, the right place to start is to look at the zb_zcl_pressure_measurement.c. This time the profile and cluster ID will be checked automatically by the stack and your role will be to implement all three handlers passed to &amp;quot;zb_zcl_add_cluster_handlers(...)&amp;quot; call. The idea is pretty much the same - you get the payload at the beginning of the buffer and additional data in &amp;quot;buf_param&amp;quot;. Using this approach will keep your code clean, much closer to the way other Zigbee devices expect it to be and reusable in further projects.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Tomchy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194422?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 14:23:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b924c27-4b2e-4b86-a727-d3bb8d4d7669</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;I got the answer.&lt;/p&gt;
&lt;p&gt;ZB_BUF_BEGIN returns start address of user supplied data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194421?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 14:15:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf63138c-2559-461f-a32b-e0eb19d8cf1e</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Now registered handler is called when packet is received.&lt;/p&gt;
&lt;p&gt;But i cannot find how to locate &amp;quot;user supplied data&amp;quot;.&lt;/p&gt;
&lt;p&gt;Where can i find clues about this ?&lt;/p&gt;
&lt;p&gt;With HA, ZB_ZCL_CLUSTER_ID_ON_OFF command with additional data i added,&lt;/p&gt;
&lt;p&gt;how can access the data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194393?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 13:10:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70eda873-b1b8-4f34-bd02-25643e133b87</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/marjeris-romero"&gt;msromero&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Sorry for posting too many.&lt;/p&gt;
&lt;p&gt;Ignore above posts. I will debug and test more deeply and let you know the process.&lt;/p&gt;
&lt;p&gt;Thansk.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194388?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 13:03:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f776146b-fb1a-425f-811d-a41036c0d11a</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;EP handler is called successfully.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Instead of using &amp;quot;&lt;/span&gt;&lt;span&gt;NRF_ZIGBEE_EP_HANDLER_REGISTER(attr, cli_agent_ep_handler_attr)&amp;quot;,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;call &amp;quot;ZB_AF_SET_ENDPOINT_HANDLER(10,cli_agent_ep_handler_attr)&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and cli_agent_ep_handler_attr is called normally.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But get_attr_table_row_by_sn return &amp;quot;-1&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is the problem ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-------------------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;static zb_uint8_t cli_agent_ep_handler_attr(zb_uint8_t param)&lt;br /&gt;{&lt;br /&gt; zb_buf_t * p_zcl_cmd_buf = (zb_buf_t *)ZB_BUF_FROM_REF(param);&lt;br /&gt; zb_zcl_parsed_hdr_t * p_cmd_info = ZB_GET_BUF_PARAM(p_zcl_cmd_buf, zb_zcl_parsed_hdr_t);&lt;br /&gt; zb_int8_t row;&lt;/p&gt;
&lt;p&gt;/* Get the row in the requests table according by the sequence number */&lt;br /&gt; row = get_attr_table_row_by_sn(p_cmd_info-&amp;gt;seq_number);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194359?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 12:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74d95297-e2eb-48f6-8cbb-ad0802c2e8c0</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;For registering an endpoint handler you should use&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v3.1.0%2Fgroup__af__api.html&amp;amp;anchor=ga549b0a17bcf5d9788c23882d68298142"&gt;&lt;span&gt;ZB_AF_SET_&lt;span&gt;ENDPOINT&lt;/span&gt;_&lt;span&gt;HANDLER()&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the CLI example the NRF_ZIGBEE_EP_HANDLER_REGISTER is just a macro for storing multiple endpoint handlers (NRF_SECTION_ITEM_REGISTER) and they are registered using ZB_AF_SET_ENDPOINT_HANDLER() in main.c.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Try then to add a nrf log info message inside your handler function to test if the handler is being called or not. &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;Marjeris&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194354?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 12:21:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30bd05ad-89fc-4681-b414-1f5b9f76ae81</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The generated ld file does not include section &amp;quot;.zb_ep_handlers&amp;quot; which contain new end point handler i registered.&lt;/p&gt;
&lt;p&gt;Adding codes in main.c, is there something to do for section management ?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;PS&amp;gt;&lt;/p&gt;
&lt;p&gt;I added zb_ep_handers section information in xml file. and after that map file generated zb_ep_handlers normally.&lt;/p&gt;
&lt;p&gt;but registered handler is not called.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;-------- in map file --------&lt;/p&gt;
&lt;p&gt;.zb_ep_handlers&lt;br /&gt; 0x0000000000037c34 0x4&lt;br /&gt; 0x0000000000037c34 __zb_ep_handlers_start__ = .&lt;br /&gt; 0x0000000000037c34 __start_zb_ep_handlers = __zb_ep_handlers_start__&lt;br /&gt; *(.zb_ep_handlers*)&lt;br /&gt; .zb_ep_handlers&lt;br /&gt; 0x0000000000037c34 0x4 Output/zigbee_light_coordinator_pca10056 Release/Obj/main.o&lt;br /&gt; 0x0000000000037c34 zb_ep_attr&lt;br /&gt; 0x0000000000037c38 __zb_ep_handlers_end__ = (__zb_ep_handlers_start__ + SIZEOF (.zb_ep_handlers))&lt;br /&gt; 0x0000000000000004 __zb_ep_handlers_size__ = SIZEOF (.zb_ep_handlers)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194339?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 11:56:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3121e7de-d6c8-4158-81d8-914e1272c931</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I added ep handler register sentence and related functions in main.c.&lt;/p&gt;
&lt;p&gt;but the handler is not called when packet is received.&lt;/p&gt;
&lt;p&gt;My code is coordinator side.&lt;/p&gt;
&lt;p&gt;Pls help me.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;===============================================================&lt;/p&gt;
&lt;p&gt;NRF_ZIGBEE_EP_HANDLER_REGISTER(attr, cli_agent_ep_handler_attr);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194294?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 10:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b35ee7e7-f3ee-4553-94bc-fee9b3e71f02</guid><dc:creator>embedholic</dc:creator><description>&lt;p&gt;Examples are not many. So i just think that data will be followed to&amp;nbsp; data8.&lt;/p&gt;
&lt;p&gt;I just dumped after data8 and not found.&lt;/p&gt;
&lt;p&gt;Maybe my appended data is not copied to call back parameter field.&lt;/p&gt;
&lt;p&gt;As you suggested, i will reference zigbee_cli_cmd_attr.c&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;if (cluster_id == ZB_ZCL_CLUSTER_ID_ON_OFF)&lt;br /&gt; {&lt;br /&gt; uint8_t value = p_device_cb_param-&amp;gt;cb_param.set_attr_value_param.values.data8;&lt;/p&gt;
&lt;p&gt;uint8_t *p = (uint8_t *)&amp;amp;&lt;span&gt;p_device_cb_param-&amp;gt;cb_param.set_attr_value_param.values.data8; // I access like this..but failed.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 with zigbee] How to append user data append to HA profile ?</title><link>https://devzone.nordicsemi.com/thread/194292?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 10:26:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:141b22c4-f602-4256-a8e7-42bc755d49ea</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you explain a bit more about why you are not able to extract the appended user data? How are you implementing this right now?&lt;/p&gt;
&lt;p&gt;Since the payload is not what is expected for an on/off cluster you need to register an endpoint handler to intercept every frame coming to the endpoint and parse the data yourself.&lt;/p&gt;
&lt;p&gt;You can take a look at how it&amp;#39;s handled in the zigbee_cli_cmd_attr.c file in the CLI example, as we handle reading attributes the same way.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>