<?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 MQTT Mqtt.c Last will and testamenet</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93986/nrf9160-mqtt-mqtt-c-last-will-and-testamenet</link><description>Hello, 
 Im currently Implementing Last will and Testament message on my device, Im not using the AWS Libraries here. 
 
 Any suggestions on how to Implement this feature? (See prj.conf below) 
 
 
 Ignore the following lines ... 
 
 CONFIG_AWS_IOT =y</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Nov 2022 10:21:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93986/nrf9160-mqtt-mqtt-c-last-will-and-testamenet" /><item><title>RE: nrf9160 MQTT Mqtt.c Last will and testamenet</title><link>https://devzone.nordicsemi.com/thread/396605?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2022 10:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df250dd8-e4b5-4c43-b0c3-ff68dde71ba9</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi David&lt;/p&gt;
&lt;p&gt;You can add this wherever you initialize the client.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As an example, in the mqtt_simple example you could add this code &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/nrf9160/mqtt_simple/src/main.c#L435"&gt;here&lt;/a&gt;, as a part of the client_init(..) function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 MQTT Mqtt.c Last will and testamenet</title><link>https://devzone.nordicsemi.com/thread/396470?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2022 16:08:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb5811a9-e94d-4fc6-be7f-9b6442b6384d</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Thank you Torbj&amp;oslash;rn,&lt;/p&gt;
&lt;p&gt;Do you have any idea where I should Implement this?&lt;/p&gt;
&lt;p&gt;In the client or the broker connection?&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 MQTT Mqtt.c Last will and testamenet</title><link>https://devzone.nordicsemi.com/thread/396392?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2022 11:42:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44a8b6fb-6ee8-4702-9b6a-5a80f93b6d39</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi David&lt;/p&gt;
&lt;p&gt;There aren&amp;#39;t any good examples for this unfortunately, but the implementation in the AWS driver shows you how to&amp;nbsp;set it up:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if defined(CONFIG_AWS_IOT_LAST_WILL)
    static struct mqtt_topic last_will_topic = {
        .topic.utf8 = CONFIG_AWS_IOT_LAST_WILL_TOPIC,
        .topic.size = sizeof(CONFIG_AWS_IOT_LAST_WILL_TOPIC) - 1,
        .qos = MQTT_QOS_0_AT_MOST_ONCE
    };
    static struct mqtt_utf8 last_will_message = {
        .utf8 = CONFIG_AWS_IOT_LAST_WILL_MESSAGE,
        .size = sizeof(CONFIG_AWS_IOT_LAST_WILL_MESSAGE) - 1
    };
    client-&amp;gt;will_topic = &amp;amp;last_will_topic;
    client-&amp;gt;will_message = &amp;amp;last_will_message;
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You should be able to add the same code snippet to your own project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>