<?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>nRF9160 DK + Azure IoT Hub Direct Method</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68453/nrf9160-dk-azure-iot-hub-direct-method</link><description>Hi. 
 
 I have several issues when trying to respond to Direct Methods (using v1.4.0 of the SDK): 
 In azure_iot_hub.c: 
 evt.data.method.rid = atoi(topic-&amp;gt;prop_bag[0].value); 
 1. rid is not an int, it&amp;#39;s a hex value (this affects everything, also sending</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Nov 2020 13:48:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68453/nrf9160-dk-azure-iot-hub-direct-method" /><item><title>RE: nRF9160 DK + Azure IoT Hub Direct Method</title><link>https://devzone.nordicsemi.com/thread/281826?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 13:48:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e418834-1a33-45da-8490-2c9e2e605b2d</guid><dc:creator>Loker</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I got everything working now (the fix on the parsing of the rid solved it - I didn&amp;#39;t use the topic.len when logging and assumed the error was still there).&lt;/p&gt;
&lt;p&gt;Thank you for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK + Azure IoT Hub Direct Method</title><link>https://devzone.nordicsemi.com/thread/281330?ContentTypeID=1</link><pubDate>Mon, 23 Nov 2020 13:34:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcb9b893-256e-49e2-ad50-2899b9472918</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;If the print function is not set up correctly hen this might happen, using the following setup:&lt;/p&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;printf(&amp;quot;Topic: %.*s\n&amp;quot;, evt-&amp;gt;topic.len, evt-&amp;gt;topic.str);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;should be a functioning solution unless there is something else that does not behave as it should.&amp;nbsp; If you still have a problem could you provide the code you are using ?&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK + Azure IoT Hub Direct Method</title><link>https://devzone.nordicsemi.com/thread/281067?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 10:17:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:757f674c-ea36-4eed-b4e4-368dceb0d696</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Looking in to the problem and will update you when we have a solution or&amp;nbsp;temporary workaround as soon as possible.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK + Azure IoT Hub Direct Method</title><link>https://devzone.nordicsemi.com/thread/280920?ContentTypeID=1</link><pubDate>Thu, 19 Nov 2020 14:03:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6fda1c1-5ac2-450c-acb0-083cbb0de064</guid><dc:creator>Loker</dc:creator><description>&lt;p&gt;Hi Jonathan, thanks!&lt;/p&gt;
&lt;p&gt;Your commit fixes the two first problems, but not the last problem. There&amp;#39;s a bug when mqtt_rx.c is parsing the incoming packet in mqtt_handle_packet. The buffer is not reset between packets. Every time a new Direct Method has a _shorter_ topic than the previous, the last char from the topic in the previous message is still in the buffer and becomes part of the (incorrectly) parsed topic.&lt;/p&gt;
&lt;p&gt;Here is an example:&lt;/p&gt;
&lt;p&gt;This is what mqtt_rx.c is parsing (incorrect):&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=1&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=2&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=32&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=42&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=5&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=65&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=7&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=87&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=9&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=a9&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=b9&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=c&lt;/p&gt;
&lt;p&gt;This is what Azure IoT Hub sent (what mqtt_rx.c should have parsed):&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=1&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=2&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=3&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=4&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=5&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=6&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=7&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=8&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=9&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=a&lt;br /&gt;Topic: $iothub/methods/POST/Open/?$rid=b&lt;br /&gt;Topic: $iothub/methods/POST/Close/?$rid=c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK + Azure IoT Hub Direct Method</title><link>https://devzone.nordicsemi.com/thread/280799?ContentTypeID=1</link><pubDate>Thu, 19 Nov 2020 09:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4178f76f-9323-46cf-be5f-ea960d51e01b</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi Loker,&lt;br /&gt;&lt;br /&gt;There is a pending commit here&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/3358"&gt;https://github.com/nrfconnect/sdk-nrf/pull/3358&lt;/a&gt;&amp;nbsp;on the Direct Method.&amp;nbsp;&lt;br /&gt;Hopefully this will solve your problems&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>