<?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>Clarification for restarting scanning with NCS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/113045/clarification-for-restarting-scanning-with-ncs</link><description>Hi 
 We built an application that bases on the sample application &amp;quot;central_and_peripheral_hr&amp;quot; with NCS v2.7.0 and nRF54L15. 
 In this application, I tried to manually start, stop and re-start the BLE scanning with the following code: 
 
 
 
 This works</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Jul 2024 05:59:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/113045/clarification-for-restarting-scanning-with-ncs" /><item><title>RE: Clarification for restarting scanning with NCS</title><link>https://devzone.nordicsemi.com/thread/494702?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2024 05:59:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc25f0ed-561b-44ac-ab10-aa67c076b53b</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Thank you for your answer and for reproducing the issue.&lt;/p&gt;
&lt;p&gt;That is good enough for me. So, I ensure that in our application the scanner module is not reinitialized.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification for restarting scanning with NCS</title><link>https://devzone.nordicsemi.com/thread/494542?ContentTypeID=1</link><pubDate>Thu, 18 Jul 2024 11:13:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e054adb6-5529-46a9-893c-3c83105c1963</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;I quickly tested this by copying your code snippet into the SDK sample and was able to reproduce the problem. The issue is that the scanner callback ends up being called in an indefinite loop, preventing the program from returning to main from the BT RX workqueue. However, I do not have an explanation for this. That would require some more debugging effort.&amp;nbsp;&lt;/p&gt;
[quote user="Remosennhauser"]What happens if multiple scanning-callbacks are appended to the callback list? Will then be every callback-function called?[/quote]
&lt;p&gt;You are free to register multiple different callbacks, which can make sense if you have multiple modules that want to subscribe to scanner events. However, I can&amp;#39;t think of any scenario where you would want to register the same callback multiple times. That will just lead to duplicated events.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification for restarting scanning with NCS</title><link>https://devzone.nordicsemi.com/thread/494265?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2024 05:35:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a425630-f6c4-4c5b-81b2-ebf879b41786</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m aware that it is not necessary to reinitialize the scanner module. But nevertheless, I&amp;#39;m wondering why the RTOS got stuck if I do so. Do you have an explanation for this?&lt;/p&gt;
&lt;p&gt;What happens if multiple scanning-callbacks are appended to the callback list? Will then be every callback-function called?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarification for restarting scanning with NCS</title><link>https://devzone.nordicsemi.com/thread/494209?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2024 15:18:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfbce49a-e3a2-44cb-9241-5c84d1011f68</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;It does not appear to be explicitly stated in the documentation that you can&amp;#39;t reinitialize the scanner module, nor are there any attempts to guard against it. However, it should be redundant to do so, as the scanning library includes APIs to start/stop scanning and APIs to update the configuration parameters if needed.&lt;/p&gt;
[quote userid="6356" url="~/f/nordic-q-a/113045/clarification-for-restarting-scanning-with-ncs"]So, my question is if the functions bt_scan_init(&amp;amp;param) and bt_scan_cb_register(&amp;amp;scan_cb) are only allowed to be called once during runtime?[/quote]
&lt;p&gt;Yes. There is no _uninit() or _unregister() function. From what I can tell from the code, calling bt_scan_cb_register() multiple times will cause multiple callbacks to be appended to the callback list.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>