<?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>iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64906/ios-application-connecting-in-the-background</link><description>I&amp;#39;m using SDK 15.3.0 and SoftDevice 6.1.1 running on an nRF52832. 
 The iOS application works correctly when it is running in the foreground. It is able to connect and bond to the nRF. 
 After it has bonded, if I try to connect in the background, I&amp;#39;m</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Aug 2020 11:17:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64906/ios-application-connecting-in-the-background" /><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/266973?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2020 11:17:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efee7762-b5ab-478b-bec9-0bbbbeced66f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jeff,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s great that now you found the root cause. I&amp;#39;m glad that I can help a little bit.&amp;nbsp;The sniffer traces were very useful.&amp;nbsp;&lt;br /&gt;Good luck with the project !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/266812?ContentTypeID=1</link><pubDate>Thu, 27 Aug 2020 16:37:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fbfd4c5-1dfe-4b23-a795-5e1ebbc6728e</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Just wanted to follow up and report that the extra security request was the issue.&lt;/p&gt;
&lt;p&gt;Our application, before creating a bond, requires a signed token from the mobile app.&amp;nbsp; The logic of&amp;nbsp;how that&amp;nbsp;token was processed in our firmware was incorrect and causing a security request when it shouldn&amp;#39;t have been asking for one.&lt;/p&gt;
&lt;p&gt;Thanks for the help!&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/266333?ContentTypeID=1</link><pubDate>Tue, 25 Aug 2020 20:30:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d3e4979-cfe3-4805-9985-ab0d8679382f</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll look into what&amp;#39;s causing that extra security request.&amp;nbsp; Thanks for pointing me in that direction.&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265958?ContentTypeID=1</link><pubDate>Mon, 24 Aug 2020 11:51:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f91910a-9826-40c1-a00f-46d03ede48b1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jeff,&amp;nbsp;&lt;br /&gt;On the 2nd sniffer trace I can see that the slave sent a security&amp;nbsp;request (packet 918) when the link is already encrypted. This is pretty strange. Usually the slave shouldn&amp;#39;t do that. Did you hardcode the slave/peripheral to do that ?&lt;br /&gt;And in general the slave shouldn&amp;#39;t send security request at all. This is a requirement in the Apple accessories guidelines. Please have a look at section 35.10 Pairing here&amp;nbsp;&lt;a href="https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf"&gt;https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The slave/peripheral should leave the connection open and if pairing is required let the central read/write to a characteristic that has encryption requirement, response with&amp;nbsp; Insufficient Authentication error code (already automatically handled by the softdevice). Then the phone will continue to encrypt the link.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265599?ContentTypeID=1</link><pubDate>Thu, 20 Aug 2020 14:53:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5feea029-bf56-4730-ab2e-2864730cee67</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve attached another pair of sniffer logs.&lt;/p&gt;
&lt;p&gt;The first shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;an initial pairing with iOS in the foreground&lt;/li&gt;
&lt;li&gt;disconnected from the device.&lt;/li&gt;
&lt;li&gt;reconnected to the device&lt;/li&gt;
&lt;li&gt;disconnected from the device.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/iOS_2D00_initial_2D00_pairing.pcapng"&gt;devzone.nordicsemi.com/.../iOS_2D00_initial_2D00_pairing.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The second shows another failed attempt at the connection in the background.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/iOS_2D00_background_2D00_connection_2D00_failed.pcapng"&gt;devzone.nordicsemi.com/.../iOS_2D00_background_2D00_connection_2D00_failed.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265561?ContentTypeID=1</link><pubDate>Thu, 20 Aug 2020 12:47:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95b256e4-da39-4267-a4ce-de1c3ec4be47</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jeff,&amp;nbsp;&lt;br /&gt;It looked like the Slave requested the link to be&amp;nbsp;bonded and the phone just rejected it.&lt;br /&gt;I&amp;#39;m not 100% sure why the phone did this. But have you got the link encrypted (bonded) before that ? Could you capture that connection and exchange as well ? (in one shot)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the phone and the device had not been paired before that I think&amp;nbsp;the rejection&amp;nbsp;makes sense. The phone doesn&amp;#39;t want the end user to be disturbed by an app in the background to popup and ask for pairing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265406?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 17:16:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd426e29-fa13-4e1b-9d46-496d95240676</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;Hung,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve attached a sniffer trace that I captured of the issue.&amp;nbsp; Packet 1995 shows the pairing failure.&lt;/p&gt;
&lt;p&gt;Let me know what you think.&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/iOS_2D00_background_5F00_connection.pcapng"&gt;devzone.nordicsemi.com/.../iOS_2D00_background_5F00_connection.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265180?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 16:36:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2df25ca3-a069-4c4d-bd22-4cc4a40301ad</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve verified that the bond information is being stored and recognized on a foreground connection:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:01:52.276,306] &amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x10.
[00:01:52.276,397] &amp;lt;debug&amp;gt; nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
[00:01:52.276,428] &amp;lt;debug&amp;gt; nrf_ble_gatt: Updating data length to 251 on connection 0x0.
[00:01:52.276,550] &amp;lt;debug&amp;gt; peer_manager_handler: Event PM_EVT_BONDED_PEER_CONNECTED
[00:01:52.276,550] &amp;lt;debug&amp;gt; peer_manager_handler: Previously bonded peer connected: role: Peripheral, conn_handle: 0, peer_id: 0
[00:01:52.276,580] &amp;lt;debug&amp;gt; peer_manager_handler: Event PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
[00:01:52.276,611] &amp;lt;debug&amp;gt; peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the confirmation on the connection parameters.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll see what I can do about collecting a sniffer trace of this happening.&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265159?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 14:56:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69a33b17-83b4-4860-85a0-15a95c5b4dbc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jeff,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;We got report earlier that status&amp;nbsp;&lt;span&gt;BLE_GAP_SEC_STATUS_UNSPECIFIED&amp;nbsp; may come if the phone is bonded but the device doesn&amp;#39;t store the bonding and can&amp;#39;t encrypt the link when the phone send the encryption request using the stored TLK. You may want to check and make sure you can&amp;nbsp;do bonding not just pairing.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you clarify that after you bond for the first time using foreground application, if you connect again you don&amp;#39;t need to do bonding again and the link can be re-encrypted ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;A&amp;nbsp;&lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer"&gt;sniffer trace &lt;/a&gt;would be very helpful to reveal what happens over the air.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regarding your question about connection parameters. I don&amp;#39;t think it would related to the issue you are having. Even though iOS device wouldn&amp;#39;t read the&amp;nbsp;Peripheral Preferred Connection Parameters, we send connection parameter request and as you already configure it with min 15ms max 75ms I don&amp;#39;t see any big issue with that configuration.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: iOS application connecting in the background</title><link>https://devzone.nordicsemi.com/thread/265145?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 14:04:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0671bed6-9194-4df2-b0fb-8644f3676a16</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;A colleague suggested that I double check my connection parameters against the Apple Accessory Design Guidelines (&lt;a href="https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf"&gt;https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;I believe that I&amp;#39;m meeting those with the values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;min: 15 ms&lt;/li&gt;
&lt;li&gt;max: 75 ms&lt;/li&gt;
&lt;li&gt;latency: 0&lt;/li&gt;
&lt;li&gt;connection supervision timeout: 6 sec&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, there is a statement:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;The device will not read or use the parameters in the Peripheral Preferred Connection Parameters characteristic. See the Bluetooth 4.0 specification, Volume 3, Part C, Section 12.5.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using the&amp;nbsp;function sd_ble_gap_ppcp_set() to set those connection parameters.&lt;/p&gt;
&lt;p&gt;Is there another way that should be used when connecting with an iOS device?&lt;/p&gt;
&lt;p&gt;The guidelines say to send a L2CAP Connection Parameter Update Request at the appropriate time.&amp;nbsp; Is that done by responding to a BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST event?&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>