<?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>OpenThread CoAP example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26135/openthread-coap-example</link><description>Hello,
I&amp;#39;m using the openthread border router (wpantund) along with another end device running the simple_coap_server example that exposes a &amp;quot;light&amp;quot; resource. 
 I have connectivity to the device and using the firefox copper plugin I can do a &amp;quot;PUT&amp;quot; to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 21 Oct 2017 17:45:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26135/openthread-coap-example" /><item><title>RE: OpenThread CoAP example</title><link>https://devzone.nordicsemi.com/thread/102990?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2017 17:45:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6196d905-96c3-419a-9c45-ec059c47e989</guid><dc:creator>Danny</dc:creator><description>&lt;p&gt;Thanks Lukasz!, that totally solved it.  Time to start adding some new resources!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenThread CoAP example</title><link>https://devzone.nordicsemi.com/thread/102989?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2017 11:52:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a21c154-c976-47f9-9396-e351ca2803dc</guid><dc:creator>Lukasz Duda</dc:creator><description>&lt;p&gt;Hello Danny,&lt;/p&gt;
&lt;p&gt;Thank you for trying out nRF5 SDK for Thread!&lt;/p&gt;
&lt;p&gt;The particular example that you used (&lt;code&gt;simple_coap_server&lt;/code&gt;) exposes only two resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/light&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/provisioning&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You received &lt;code&gt;4.04&lt;/code&gt; responses (&lt;code&gt;Not Found&lt;/code&gt;) for /&lt;code&gt;light/light_on&lt;/code&gt; or &lt;code&gt;/light/light_off&lt;/code&gt; resources since they do not exist.&lt;/p&gt;
&lt;p&gt;Simple coap server controls its led using payload of PUT request on /light resource. Accepted payload is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt; (Turn off the led)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1&lt;/code&gt; (Turn on the led)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2&lt;/code&gt; (Toggle the led)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that you can specify payload also in the copper plugin: Payload section -&amp;gt; Outgoing tab.
The difficult part is that Cooper plugin allows only to send ASCII string. However the example expects binary &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;1&lt;/code&gt; or &lt;code&gt;2&lt;/code&gt;, not character &amp;#39;0&amp;#39; which is binary &lt;code&gt;48&lt;/code&gt;. So i believe the easiest solution to use cooper would be to change &lt;code&gt;light_command_t&lt;/code&gt; enum in the &lt;code&gt;main.c&lt;/code&gt; to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef enum
{
    LIGHT_OFF = &amp;#39;0&amp;#39;, // originally was 0, (0 is different than ASCII &amp;#39;0&amp;#39; - which is 48)
    LIGHT_ON,
    LIGHT_TOGGLE
} light_command_t;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Of course it is possible to add a new resources: &lt;code&gt;/light/light_on&lt;/code&gt; and &lt;code&gt;/light/light_off&lt;/code&gt; by modyfing SDK&amp;#39;s example.&lt;/p&gt;
&lt;p&gt;We will try to change expected commands value to accept also ASCII characters in upcoming releases to make Cooper plugin easier to use.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>