<?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>Is there an OpenThread UDP interface that can be called in C?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85560/is-there-an-openthread-udp-interface-that-can-be-called-in-c</link><description>I&amp;#39;m trying to add custom functionality to the main.c file in openThread&amp;#39;s cli example. I need to use udp related functions, but the otUdpOpen function requires this pointer. 
 So is there an OpenThread UDP interface that can be called in C? Or may be</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Mar 2022 08:18:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85560/is-there-an-openthread-udp-interface-that-can-be-called-in-c" /><item><title>RE: Is there an OpenThread UDP interface that can be called in C?</title><link>https://devzone.nordicsemi.com/thread/357038?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 08:18:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53e64623-3127-424c-9079-fc9dca225447</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You did not mention anything about the context pointer in your original question, so I assumed you meant the otInstance pointer. You do not need to pass a context pointer, this can be set to NULL if you do not need any context, or you can pass any other object, as it is a void pointer. The context is normally used in the callback handler to map the callback to a specific operation, etc.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an OpenThread UDP interface that can be called in C?</title><link>https://devzone.nordicsemi.com/thread/357010?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 01:43:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76299497-ec89-4178-8610-3becc407f969</guid><dc:creator>kelly_he</dc:creator><description>&lt;p&gt;&lt;span&gt;Maybe I misunderstood what you meant.&amp;nbsp;Do you mean we can pass in a OT instance pointer as a context pointer?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Open a UDP/IPv6 socket.
 *
 * @param[in]  aInstance  A pointer to an OpenThread instance.
 * @param[in]  aSocket    A pointer to a UDP socket structure.
 * @param[in]  aCallback  A pointer to the application callback function.
 * @param[in]  aContext   A pointer to application-specific context.
 *
 * @retval OT_ERROR_NONE    Successfully opened the socket.
 * @retval OT_ERROR_FAILED  Failed to open the socket.
 *
 */
otError otUdpOpen(otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext);
&lt;/pre&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an OpenThread UDP interface that can be called in C?</title><link>https://devzone.nordicsemi.com/thread/356866?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 12:05:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9a76e65-efd4-4742-ba68-e9b3f62ca663</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you are using nRF Connect SDK, you can use the function &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1/include/net/openthread.h#L97-L103"&gt;openthread_get_default_instance&lt;/a&gt;&lt;span&gt;() to get the OpenThread instance.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;See &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.9.1/samples/openthread/coap_client/src/coap_client_utils.c#L66"&gt;example how it is used&lt;/a&gt; in the CoAP Client sample.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>