<?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>add nus service with bond</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10371/add-nus-service-with-bond</link><description>Fisrt of all, I have searched all the questions but now still can&amp;#39;t make bond work.
I&amp;#39;ve done below work:
1, modify main.c file to add device manger function
2, modify ble_nus.c, change all the BLE_GAP_CONN_SEC_MODE_SET_OPEN to BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Dec 2015 03:10:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10371/add-nus-service-with-bond" /><item><title>RE: add nus service with bond</title><link>https://devzone.nordicsemi.com/thread/38494?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2015 03:10:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60815deb-d912-4a43-8302-6385a0fc930a</guid><dc:creator>loste</dc:creator><description>&lt;p&gt;Thank you very much. I forgot to get the error code of sd_ble_gatts_characteristic_add(). It return NRF_ERROR_INVALID_PARAM when I set read_perm to BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add nus service with bond</title><link>https://devzone.nordicsemi.com/thread/38497?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2015 16:29:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:237bcd77-eed3-4661-bdc3-f83e3d36d167</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Per spec the cccd has to be readable (BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.read_perm);). Did you check if you got an error when trying to set cccd.read_perm to BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add nus service with bond</title><link>https://devzone.nordicsemi.com/thread/38495?ContentTypeID=1</link><pubDate>Thu, 26 Nov 2015 09:18:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c69bfef-5b2f-46b2-87f9-c0bcb88d6d97</guid><dc:creator>loste</dc:creator><description>&lt;p&gt;Now I can bond device with phones, thank you. I didn&amp;#39;t remove event that on_ble_evt handled which should be handled by device manager. On more question, if I set BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM to all the read_perm/write_perm of cccd_md and attr_md, then phone will not find the device, why will this hanppen?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add nus service with bond</title><link>https://devzone.nordicsemi.com/thread/38496?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2015 09:59:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9499186-4c75-4721-b051-63f506e17cb3</guid><dc:creator>loste</dc:creator><description>&lt;p&gt;Ok, I will try your suggestions. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add nus service with bond</title><link>https://devzone.nordicsemi.com/thread/38493?ContentTypeID=1</link><pubDate>Mon, 23 Nov 2015 13:46:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f53848fb-e7ac-4f51-b879-ddcc3b759313</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;I would recommend that you look at one of the other examples that is using bonding, e.g. Heart rate... You are right that you need to add device manager and change the conns sec modes. In addition you should make sure you also remove events from on_ble_evt that is now handled by the device manager. And you should add sys_evt_dispatch, which is probably the part that is hardest to spot without knowing it(register with softdevice using softdevice_sys_evt_handler_set).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>