<?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>Handover DFU connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21574/handover-dfu-connection</link><description>Hi, 
 Instead of initiating the DFU library in Android with an address is it possible to handover a existing GATT connection to a device already in DFU mode? 
 We have cases where we in our app is detecting devices in DFU mode. We haven&amp;#39;t experienced</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Apr 2017 11:22:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21574/handover-dfu-connection" /><item><title>RE: Handover DFU connection</title><link>https://devzone.nordicsemi.com/thread/84727?ContentTypeID=1</link><pubDate>Fri, 28 Apr 2017 11:22:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57283073-e07c-449f-ab99-4a11cbedd8f0</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t have to disconnect in your app before starting DFU. You will eventually get the onConnectionStateChanged callback with newState=DISCONNECTED when you just start the DFU. On Android every app may have a number of BluetoothGatt connections to a device. They all behave as they were the only one, but it doesn&amp;#39;t have to be true. The physical connection will be terminated when the last one of those is disconnected.&lt;/p&gt;
&lt;p&gt;So what you may do is, when you connect to your device (no matter if it&amp;#39;s in bootloader on in app mode), just start DFU providing the device address, as you do right now. The BluetoothGatt object of BluetoothGattCallback can&amp;#39;t be passed to the service, so handing over the existing connection object is not possible, but when you won&amp;#39;t disconnect before starting DFU the same physical connection will be used. Some time after you started DFU you may disconnect, when the library has already created its own connection object, but also you don&amp;#39;t have to. When DFU is completed (or the first part of it) you&amp;#39;ll get the disconnected event as it the device just disconnected itself.
You may actually sniff the packets in your app, your connection, sent by the device during DFU by calling setNotificationsEnabled(DFU Control Point char, true), but it may add some delays and I wouldn&amp;#39;t recommend it.&lt;/p&gt;
&lt;p&gt;Hope that helped.&lt;/p&gt;
&lt;p&gt;BR, Aleksander&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handover DFU connection</title><link>https://devzone.nordicsemi.com/thread/84725?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2017 12:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f6a831b-c1a8-4ab5-bc9d-65bcee8da4c7</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Great. Doing handover will in some case avoid user getting multiple fails in a row.&lt;/p&gt;
&lt;p&gt;Still we have really bad stats for the first try. All/most problems are related to connecting after a reset. That&amp;#39;s why I mentioned the sleep times that you are laborating with e.g. commit c1455e2b. Once DFU lib is connected it &amp;quot;always&amp;quot; goes well (if not going out-of-range, bt toggle, turning off phone).&lt;/p&gt;
&lt;p&gt;Are the stats according to expectations? What success/fail ratio should we expect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handover DFU connection</title><link>https://devzone.nordicsemi.com/thread/84724?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2017 12:33:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64a647de-c6dc-4b8a-8b70-d89c42808852</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;code&gt;About handover, our app has in some case (e.g. out-of-range) connected to the device in bootloader&lt;/code&gt; &lt;code&gt;mode. So it seems unnecessary to reset and enter bootloader, dfu mode again.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If the device already is in bootloader mode, then the DFU library will not trigger another reset. It reads the DFU version characteristic, which determines if the device is in application mode and a reset to the bootloader is necessary. Judging by the error log it could look like the nRF device encounters an error during the DFU procedure resulting in the  REMOTE DFU OPERATION FAILED error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handover DFU connection</title><link>https://devzone.nordicsemi.com/thread/84723?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2017 11:53:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42619156-76a8-44ed-865b-878dbaf124eb</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;About handover, our app has in some case (e.g. out-of-range) connected to the device in bootloader mode. So it seems unnecessary to reset and enter bootloader, dfu mode again.&lt;/p&gt;
&lt;p&gt;Regarding what goes wrong, our internal stats looks like this:&lt;/p&gt;
&lt;p&gt;(state, count, unique_devices, msg)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;successful, 940, 368, -&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;failed, 187, 48, DFU error: DFU DEVICE DISCONNECTED&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;failed, 4, 4, DFU error: REMOTE DFU OPERATION FAIL&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;failed, 2, 2, DFU error: BLUETOOTH ADAPTER DISABLE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;failed, 1, 1, DFU error: DFU SERVICE NOT FOUND&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;failed, 1, 1, DFU error: GATT INTERNAL ERROR&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Handover DFU connection</title><link>https://devzone.nordicsemi.com/thread/84726?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2017 10:59:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6a8930d-9892-4e7d-8bfc-4504e0a2f9fd</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Daniel,  I am not sure if it is possible to handover an existing connection, as the nRF device must reset in order to enter bootloader mode, which means that the connection has to be broken. Could you elaborate regarding the issues you&amp;#39;ve seen with handing over the address to the Android DFU Library?&lt;/p&gt;
&lt;p&gt;Could you elaborate&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>