<?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>[Android MCP App] Showing &amp;quot;connect button&amp;quot; at a beacon?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11584/android-mcp-app-showing-connect-button-at-a-beacon</link><description>/**************** Test Condition **********************/

Phone: Nexus 5 (Android 6.0.1)
nRF Beacon Kit
MCP App Version 4.0.3

/**********************************************************/
 
 
 
 Hi, I use a nRF Beacon kit. I didn&amp;#39;t change the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Jan 2016 11:24:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11584/android-mcp-app-showing-connect-button-at-a-beacon" /><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43767?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 11:24:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0360aac9-f592-494c-a7b9-f253e3df10ab</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;I see. I will wrap this quetions now. I really appreciate your dedication.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43763?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 05:09:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1ffbfbb-a224-4ef5-afba-0cda74fd7e72</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;As a side note, I think we have divert pretty far away from your first question/question title. The thread is now about getting &lt;code&gt;BLE_GAP_EVT_SCAN_REQ_REPORT&lt;/code&gt; to work more than the Android app. Perhaps this is a good time to split that question to another page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43762?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 04:49:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ea9f8b0-b96d-4efc-9754-0ccf0f881f51</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;I think calling &lt;code&gt;sd_ble_opt_set()&lt;/code&gt; somewhere inside &lt;code&gt;ble_stack_init()&lt;/code&gt; sounds better than what I suggested you doing (adding anywhere before starting advertising). The code would make more sense that way. I am not really sure where in &lt;code&gt;ble_stack_init()&lt;/code&gt; though.&lt;/p&gt;
&lt;p&gt;But technically it doesn&amp;#39;t seem to matter a whole lot where you call &lt;code&gt;sd_ble_opt_set()&lt;/code&gt;. It doesn&amp;#39;t have any note or warning in &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v10.0.0/ble_serialization_s110_functions.html?resultof=%22%73%31%31%30%22%20%22%76%31%30%22%20%22%73%64%5f%62%6c%65%5f%6f%70%74%5f%73%65%74%22%20#nrf51_opt_set_encoding"&gt;its SDK documentation entry&lt;/a&gt;. When I tested the code, I added that right before calling &lt;code&gt;ble_advertising_start()&lt;/code&gt;and it worked fine. I just told you to add it before you call &lt;code&gt;ble_advertising_start()&lt;/code&gt; because once you start advertising, you would also start receiving scan response. You would want to be ready to receive those events before then.&lt;/p&gt;
&lt;p&gt;I guess a Nord&lt;/p&gt;
&lt;p&gt;Also, just updated my question to answer your update regarding &lt;code&gt;peer_addr&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43761?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 07:43:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1de19b32-2634-4ce1-a2dd-fdabab4edbf4</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;@Võ Thanh Hiếu, Thanks for your guidance.&lt;/p&gt;
&lt;p&gt;I will give it a shot.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;/&lt;/strong&gt;****** Edited, Questions about the code **********&lt;strong&gt;/&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the beacon example (nRF5_SDK_XX\examples\ble_peripheral\ble_app_beacon),&lt;/p&gt;
&lt;p&gt;the &lt;code&gt;ble_stack_init&lt;/code&gt; function only enables stack and does not register SoftDevice handler modules&lt;/p&gt;
&lt;p&gt;for BLE events such as &lt;code&gt;ble_evt_dispatch&lt;/code&gt; (which calls &lt;code&gt;on_ble_evt&lt;/code&gt;)  or &lt;code&gt;sys_evt_dispatch&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then after enabling the BLE stack, should I call &lt;code&gt;sd_ble_opt_set&lt;/code&gt; before initializing advertising data&lt;/p&gt;
&lt;p&gt;and add &lt;code&gt;ble_evt_dispatch&lt;/code&gt; and &lt;code&gt;sys_evt_dispatch&lt;/code&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43760?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 07:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6253187b-6164-4103-912c-bbc465d908c6</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Yes I used SDK 10 and S110 8.0. I have not tested it on S130. But according to the design you described, S110 is more suitable than S130. Having said that, you know your product best so you would make the better decision on that than I do.&lt;/p&gt;
&lt;p&gt;Nordic is already rolling out SDK 11 if you want to go straight to that. I am currently just stuck with v10 for the same reason you were stuck with v7 last year.&lt;/p&gt;
&lt;p&gt;Just in case, but if migrating to SDK 10/11 causes you any issue, I think any version of the SDK that works with S110 8.0 should work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43759?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 07:24:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb0d6634-1595-45e8-8fb2-b872d7c6c7df</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;I started SDK 7.2 and SoftDevice S110 7.1 at last year.&lt;/p&gt;
&lt;p&gt;I made a product with it so I lost the timing to migrate to new SDKs.&lt;/p&gt;
&lt;p&gt;Due to the hetic schedule for launching the product, changing the version of SDK and SofDevice&lt;/p&gt;
&lt;p&gt;was a risk.&lt;/p&gt;
&lt;p&gt;Well, luckily, that product supports DFU so maybe&lt;/p&gt;
&lt;p&gt;it is the time to start SDK10 and SoftDevice S110 8.0 and update it again.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Anyways, you used SDK 10 and SoftDevice S110 8.0 or S130?
I will try that out.&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43758?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 07:11:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f6d758b-83c5-419c-88e6-af7adcb7b628</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;I just reviewed the S110 7.x.x documentation for &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v7.x.x/doc/7.1.0/s110/html/a01048.html#ga2da79b1e293414621d79814490a8598e"&gt;BLE_GAP_OPTS&lt;/a&gt; and &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v7.x.x/doc/7.1.0/s110/html/a01048.html#gada486dd3c0cce897b23a887bed284fef"&gt;BLE_GAP_EVTS&lt;/a&gt;. It does not include the &lt;code&gt;OPT&lt;/code&gt; or the &lt;code&gt;EVT&lt;/code&gt; you need to detect the receiving of a scan response. I think it was simply not supported in that version.&lt;/p&gt;
&lt;p&gt;Sorry I was drafting out my answer based on SDK v10.0.0 which I have been working on. I did not expect SDK and SoftDevice v7 is so much different.&lt;/p&gt;
&lt;p&gt;May I ask why you decided to use an out-of-date version of the SDK though?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43757?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 06:47:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc8e37b8-5389-455e-af30-48f478404be6</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Hmm... I use Softdevice S110 7.1 and SDK 7.2.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ERROR: identifier &amp;quot;BLE_GAP_OPT_SCAN_REQ_REPORT&amp;quot; is undefined
ERROR: union &amp;quot;&amp;lt;unnamed&amp;gt;&amp;quot; has no field &amp;quot;scan_req_report&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And I use IAR EWARM 7.20&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43756?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 06:14:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fa1a35b-ea70-4fc6-97ee-6ff0966faecb</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Oh I forgot but I did all this on SDK v10.0.0 with SoftDevice S110 v8.0.0. I hope the difference is not too big...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43755?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 06:09:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5892853-338c-4bd3-860e-960de8196588</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Took me way longer to edit the answer than I thought. If you checked before I send this commend, the answer is probably not updated yet. It is updated now. Sorry about that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43754?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 05:51:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbf3559e-86f3-4e55-a901-2262ad625163</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Regarding your edit addressed to me, yes, right there. However please read my updated answer. There is one more thing you need to do to be able to received that event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43766?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 04:30:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b9be8c9-ff2d-41ea-bce9-f198e41f2ac9</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;It just happen that scanner and advertiser are two Link Layer roles. So your choice of the word &amp;#39;scanner&amp;#39; caused a minor confusion, that is all. No harm done.&lt;/p&gt;
&lt;p&gt;There are several advertisement types. Each of them has a Scannability properties.
If an advertiser is sending out a Scannable advertisement, the scanner can issue a scan request.
If an advertiser is sending out a Non-Scannable advertisement, the scanner cannot issue a scan request.&lt;/p&gt;
&lt;p&gt;The advertisement types also have a Connectability property, as I described above. So if you also want your peripheral to be connectable, you also need to use an advertisement type that is Connectable.&lt;/p&gt;
&lt;p&gt;An advertisement type that would be both that is &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s110.api.v8.0.0/group___b_l_e___g_a_p___a_d_v___t_y_p_e_s.html#ga6cc0db53453977ee0a31e59f07de2b86"&gt;&lt;code&gt;BLE_GAP_ADV_TYPE_ADV_IND&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43765?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 03:32:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b4834d4-cfc8-4478-99e2-87d386d35cca</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Thanks for your quick reply.&lt;/p&gt;
&lt;p&gt;The term &amp;quot;scanner&amp;quot; I used was quite vague.&lt;/p&gt;
&lt;p&gt;What I meant was, after the central (ex. iPhone) gets the advertising packet from the beacon,&lt;/p&gt;
&lt;p&gt;I wished this beacon to receive any type of packets from the central, like the scan request.&lt;/p&gt;
&lt;p&gt;Maybe calling this as a &amp;quot;scanner&amp;quot; isn&amp;#39;t right.&lt;/p&gt;
&lt;p&gt;Anyways, can (or does) the central sends packets to the beacon after it gets an advertising packet?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Android MCP App] Showing "connect button" at a beacon?</title><link>https://devzone.nordicsemi.com/thread/43764?ContentTypeID=1</link><pubDate>Thu, 28 Jan 2016 03:26:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9643893-1acf-4962-8fdb-083d3559043a</guid><dc:creator>Hieu</dc:creator><description>&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;As far as I know, whether a peripheral can be connected to or not depends on the advertisement type. Therefore if you want to modify it so that it could be connected to, you would want to modify the advertisement type, not any services, characteristics or descriptors, i.e. its GATT profile.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Two points:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;2.1. I have not tried this in person, but under the GAP events &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Findex.html"&gt;listed here&lt;/a&gt;, your application can receive a &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v10.0.0/ble_serialization_s110_events_gap.html?resultof=%22%6e%72%66%35%31%22%20%22%76%31%30%22%20%22%67%61%70%22%20%22%65%76%65%6e%74%73%22%20%22%65%76%65%6e%74%22%20#nrf51_evt_scan_req_report_encoding"&gt;&lt;code&gt;BLE_GAP_EVT_SCAN_REQ_REPORT&lt;/code&gt;&lt;/a&gt;. My bet is that this is the event triggered when an advertiser received a scan request. You can override the &lt;code&gt;on_ble_evt&lt;/code&gt; code to handle this event according to your liking (blink LED).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE 2016 Jan 18:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You will need to enable the GAP option &lt;code&gt;BLE_GAP_OPT_SCAN_REQ_REPORT&lt;/code&gt; before you can receive &lt;code&gt;BLE_GAP_EVT_SCAN_REQ_REPORT&lt;/code&gt;. It probably could be done anytime but for your application it would make sense to enable this option before starting advertising. I was able to enable the option with this code.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    // Creating an option struct that enable the scan_req_report event to be sent by the SoftDevice
    ble_opt_t opt;
    opt.gap_opt.scan_req_report.enable = true;
    
    err_code = sd_ble_opt_set(BLE_GAP_OPT_SCAN_REQ_REPORT, &amp;amp;opt);
    if (err_code != NRF_SUCCESS) {
      switch (err_code) {
        case NRF_ERROR_INVALID_ADDR: {
          printf(&amp;quot;sd_ble_opt_set() == NRF_ERROR_INVALID_ADDR\n&amp;quot;);
          break;
        }
        case BLE_ERROR_INVALID_CONN_HANDLE: {
          printf(&amp;quot;sd_ble_opt_set() == BLE_ERROR_INVALID_CONN_HANDLE\n&amp;quot;);
          break;
        }
        case NRF_ERROR_INVALID_PARAM: {
          printf(&amp;quot;sd_ble_opt_set() == NRF_ERROR_INVALID_PARAM\n&amp;quot;);
          break;
        }
        case NRF_ERROR_INVALID_STATE: {
          printf(&amp;quot;sd_ble_opt_set() == NRF_ERROR_INVALID_STATE\n&amp;quot;);
          break;
        }
        case NRF_ERROR_BUSY: {
          printf(&amp;quot;sd_ble_opt_set() == NRF_ERROR_BUSY\n&amp;quot;);
          break;
        }
        default: {
          printf(&amp;quot;sd_ble_opt_set() == %&amp;quot; PRIu32 &amp;quot;\n&amp;quot;, err_code); // need #include &amp;lt;inttypes.h&amp;gt; to use PRIu32
          break;
        }
        
      }
    } else {
      printf(&amp;quot;sd_ble_opt_set() == NRF_SUCCESS\n&amp;quot;);
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The err_code handling code is obviously set up just for debugging. Remove/edit it as you need.&lt;/p&gt;
&lt;p&gt;I cannot find anywhere in the documentation about this. The only way I could find any hint to this by doing a project wide search for &lt;code&gt;BLE_GAP_EVT_SCAN_REQ_REPORT&lt;/code&gt;. It would lead to the definition of &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Findex.html"&gt;&lt;code&gt;ble_gap_opt_scan_req_report_t&lt;/code&gt;&lt;/a&gt;, which suggested to me that there is an option that has to be enabled before I could receive the event.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE 2016 Jan 29 to address @Mango922&amp;#39;s updated question&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;-. &lt;strong&gt;First two things I forgot to address:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;a. Do be aware that according to &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Findex.html"&gt;this SDK documentation&lt;/a&gt;, it is expected that you do not receive an event for every single scan requests the device receive.&lt;/p&gt;
&lt;p&gt;b. Regarding your note of not knowing if a central device will send a scan request. The answer is it depends. There are two scanning mode a scanner device can scan in: Active and Passive.&lt;/p&gt;
&lt;p&gt;If a scanner use Active scanning, it will send a scan request when it receives an advertisement.&lt;/p&gt;
&lt;p&gt;If a scanner use Passive scanning, it will not send a scan request when it receives an advertisement.&lt;/p&gt;
&lt;p&gt;You could see this also noted in &lt;a href="https://devzone.nordicsemi.com/question/34070/can-two-masters-connect-two-slaves-at-the-same-time/?answer=34250#post-id-34250"&gt;Stefan Birnir Sverrisson&amp;#39;s answer&lt;/a&gt; that you linked.&lt;/p&gt;
&lt;p&gt;-. &lt;strong&gt;Now to address your question about the &lt;code&gt;peer_addr&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As I understand it, the &lt;code&gt;peer_addr&lt;/code&gt; would be the address of whatever device responsible for the scan request that your advertiser device received. If there are multiple devices scanning in the room, you should expect receiving different event with different &lt;code&gt;peer_addr&lt;/code&gt; value, each for a different device.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;peer_addr&lt;/code&gt; might also change when the central device change its address. The BLE specification does allow several ways that any &lt;strong&gt;one&lt;/strong&gt; device can have its address change. An example is for security purpose. However I have not studied much of this so I cannot explain to you under what situation this is to be expected. I haven&amp;#39;t even seen a case where a central change its address either. My guess is that it completely depends on the central device design.&lt;/p&gt;
&lt;p&gt;2.2. I am unsure what you mean by &amp;quot;scanner.&amp;quot; I don&amp;#39;t think the peripheral you are describing is one working as a &amp;quot;scanner.&amp;quot; A scanner is one looking for advertisements. The peripheral you are describing is not scanning anything. It is just advertising and receiving scan request.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>