<?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>COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98573/coap-observe-option-with-coap-get-request-in-nrf5-sdk-with-openthrea</link><description>I&amp;#39;m trying to implement COAP observe functionality in my code, but I keep getting an &amp;#39;ASSERTION FAILED&amp;#39; error when I try to append the observe option to the COAP request. Can someone help me figure out what&amp;#39;s causing this error and how to fix it?&amp;quot;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 May 2023 15:01:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98573/coap-observe-option-with-coap-get-request-in-nrf5-sdk-with-openthrea" /><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/424344?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 15:01:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5884901e-aa87-4ebd-a441-6a8e84680821</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;I have verified that COAP server which is running on OTBR is sending data to an end device whenever the observed resource is modified but somehow callback on the end device is not triggering. Please see the last two lines:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1683558071476v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/424343?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 14:57:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:103d7b48-4be8-430f-b1fc-96b8be1b24c7</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;I am using the built-in COAP APIs of Openthread.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/424292?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 13:13:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cb4dc6a-e1bc-40e1-84e8-42d5ac1880b2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I do not have a first hand experience in this but&amp;nbsp;it seems that it is definitely supported in Zephyr CoAP API: &lt;a title="https://developer.nordicsemi.com/nrf_connect_sdk/doc/2.3.0/zephyr/connectivity/networking/api/coap.html" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/zephyr/connectivity/networking/api/coap.html" rel="noopener noreferrer" target="_blank"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/zephyr/connectivity/networking/api/coap.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And the IoT SDK CoAP library in nRF5 SDK: &lt;a title="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_iot_coap_addon_observe.html?cp=9_5_1_3_24_1_2_1_0" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_iot_coap_addon_observe.html?cp=9_5_1_3_24_1_2_1_0" rel="noopener noreferrer" target="_blank"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_iot_coap_addon_observe.html?cp=9_5_1_3_24_1_2_1_0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/424058?ContentTypeID=1</link><pubDate>Fri, 05 May 2023 15:24:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a9d9f50-caf6-449b-a708-458f06e10828</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;is COAP observe support only available in nRF5 SDK for thread as mentioned here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/33660/coap-observe-with-thread-sdk"&gt;devzone.nordicsemi.com/.../coap-observe-with-thread-sdk&lt;/a&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1683300280902v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/424054?ContentTypeID=1</link><pubDate>Fri, 05 May 2023 15:03:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cba132f-5447-4a75-81ee-5664b472b77b</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;We are getting a response fro our COAP server after sending observe request to the server that the device is added to the observers list but not getting updates after that. I think the callback is not triggering. Please check this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void coap_get_handler(void                * p_context,
                                 otMessage           * p_message,
                                 const otMessageInfo * p_message_info,
                                 otError              aResult)
{
    (void)p_context;
    (void)p_message;
    (void)p_message_info;
    char     config[1024];
    uint16_t config_length = 0;

    uint16_t lenght = otMessageRead(p_message, otMessageGetOffset(p_message), config, 1024);
    config[lenght] = &amp;#39;\0&amp;#39;;
    NRF_LOG_INFO(&amp;quot;Received CoAP message: %s\r\n&amp;quot;, config);
}

/** @COAP Get Request from EMQX Serve.
 */
 void send_coap_get_request(void)
{
    char            payload_buffer[128];
    otError         error;
    otMessage     * p_request;
    otMessageInfo   message_info;
    otInstance    * p_instance = thread_ot_instance_get();

    if (m_associated == false)
    {
        return;
    }

    do
    {
        NRF_LOG_INFO(&amp;quot;Sending CoAP Get Request\r\n&amp;quot;);
        p_request = otCoapNewMessage(p_instance, NULL);
        if (p_request == NULL)
        {
            NRF_LOG_INFO(&amp;quot;Failed to allocate message for CoAP Request\r\n&amp;quot;);
            break;
        }

        otCoapMessageGenerateToken(p_request, 4);
        otCoapMessageInit(p_request, OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_GET);
        
     
        error = otCoapMessageAppendObserveOption(p_request, 0);
        NRF_LOG_INFO(&amp;quot;otCoapMessageAppendObserveOption erro: %d\r\n&amp;quot;, error);
        ASSERT(error == OT_ERROR_NONE);

         error = otCoapMessageAppendUriPathOptions(p_request, CLOUD_URI_PATH2);
         ASSERT(error == OT_ERROR_NONE);


        error = otCoapMessageSetPayloadMarker(p_request);
        ASSERT(error == OT_ERROR_NONE);

        memset(&amp;amp;message_info, 0, sizeof(message_info));
        message_info.mPeerPort = OT_DEFAULT_COAP_PORT;

        error = otIp6AddressFromString(GCP_COAP_IOT_CORE_SERVER_ADDRESS, &amp;amp;message_info.mPeerAddr);
        ASSERT(error == OT_ERROR_NONE);

        
        
        error = otCoapSendRequest(p_instance, p_request, &amp;amp;message_info, coap_get_handler, p_instance);
        if ((error == OT_ERROR_NONE))
        NRF_LOG_INFO(&amp;quot;Sent CoAP Request\r\n&amp;quot;);

    } while (false);

    if ((error != OT_ERROR_NONE) &amp;amp;&amp;amp; (p_request != NULL))
    {
        NRF_LOG_INFO(&amp;quot;Failed to send CoAP Request: %d\r\n&amp;quot;, error);
        otMessageFree(p_request);
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420387?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 06:48:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a23b777-d819-452a-b1df-099b6735f277</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;And which implementation does your server use?&lt;/p&gt;
&lt;p&gt;And it may be the same answer, check the server&amp;#39;s API doc how to use the RFC7641 function, guess this extension is supported.&lt;/p&gt;
&lt;p&gt;Maybe it&amp;#39;s a good idea, to start with a coap-server and coap-client, which is known as working and working demos are provided. At least in my experience, it&amp;#39;s always a good idea to reduce the &amp;quot;risk of failures&amp;quot; by starting using &amp;quot;known working components&amp;quot; and then replace, step by stop the working components with the intended components.&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re able to capture the traffic on one of the nodes (see my tutorial &lt;a href="https://github.com/eclipse-californium/californium/wiki/Logs-and-IP-Capturing-%E2%80%90-How-To-Provide-The-Right-Information#ip-capturing"&gt;IP capturing&lt;/a&gt; , requires to run unix at one of the nodes) and provide the capture (NO pictures!) here, I will have a look in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420349?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 20:52:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:965a5c29-e606-4435-ad88-5688223918f9</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;I am able to resolve above issue and not getting any error.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1681419090416v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but I am not observing resource values on nRF52840 after resource values change on the COAP server.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420334?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 16:41:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a26e83f5-e10b-4b1f-8304-7d354581845f</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;I guess you need to read the API doc (even if I&amp;#39;m not common to that specific API).&lt;/p&gt;
&lt;p&gt;Especially &amp;quot;tiny C&amp;quot; implementations of coap need to assemble the message in the right order. That follows usually &lt;a href="https://www.rfc-editor.org/rfc/rfc7252#section-3"&gt;RFC 7252 - 3 Message Format&lt;/a&gt; . Very rough create the message with the type and code, add token, add options (in order of the option number, see &lt;a href="https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#option-numbers"&gt;IANA CoAP option numbers&lt;/a&gt; ) and then the payload starting with the payload marker. But that&amp;#39;s just an assumption, you need to read the API docu.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420313?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 15:16:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4679ba11-fc53-4fba-bebc-4de989d0a829</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1681398990255v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420310?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 15:10:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6beb145e-0f43-4029-be00-c4929eac6ca7</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;this is the error number I am getting with&amp;nbsp;&lt;span&gt;otCoapMessageAppendObserveOption.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1681398631718v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420013?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 14:37:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebc061d9-4057-4de1-a76b-c0c58a13c6df</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;If you have a another ticket discussing the same thing, then you should close one of these. Maybe we can close this ticket.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/420011?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 14:36:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2accede5-f928-4789-bcb1-f1dd14278c9b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;div&gt;Can you try to use&amp;nbsp;&lt;u&gt;&lt;a title="https://infocenter.nordicsemi.com/topic/sdk_tz_v4.2.0/group__api-coap.html#ga0b4ec5ec8d715161b2cf56c5dc5e203a" href="https://infocenter.nordicsemi.com/topic/sdk_tz_v4.2.0/group__api-coap.html#ga0b4ec5ec8d715161b2cf56c5dc5e203a" rel="noopener noreferrer" target="_blank"&gt;&lt;span&gt;otCoapMessageAppendObserveOption&lt;/span&gt;&lt;/a&gt;()&lt;/u&gt; instead?&lt;/div&gt;
&lt;div&gt;If that does not help then like &lt;a href="https://devzone.nordicsemi.com/members/achimkraus"&gt;Achim Kraus&lt;/a&gt;&amp;nbsp;mentioned, you need to provide us the error number and/or context of this happening.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/419973?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 13:10:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb1db0c9-8a45-4b1b-bf4d-71afc97b5c34</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;Just as hint:&lt;/p&gt;
&lt;p&gt;The assert reports on &amp;quot;main.c: 109&amp;quot;, but only you know, which line in your snippet above is the 109. Maybe you add that as comment into the snippet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/419946?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 12:08:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01597e63-0785-40ad-9d8f-377e7c782123</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;I am getting same response to my other tickets also.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/419943?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 12:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acffd75c-c123-4c2c-bf80-7e7a1a91d16c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am not sure, I have asked my colleagues to help&amp;nbsp;understanding the failure from the assert context. Will update this thread once I hear from them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: COAP Observe option with COAP get request in nRF5 SDK with openthrea</title><link>https://devzone.nordicsemi.com/thread/419456?ContentTypeID=1</link><pubDate>Sun, 09 Apr 2023 12:01:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a87eaa58-743f-42b1-8cf6-9eab5e64ec3c</guid><dc:creator>BilalAliAhmad</dc:creator><description>&lt;p&gt;I want to make coap request similar to this request which I made through coap-client libcoap example from openthread coap end device:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1681041663698v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>