<?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>pc-ble-driver-py more dongles</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17505/pc-ble-driver-py-more-dongles</link><description>Hello I would like to use more dongles with pc-ble-driver-py. For example I want to create multiple advertisers and test that my DUT would see multiple advertisers. I tried to reuse your Advertiser.py example. 
 The script crashes when I try to open</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Nov 2016 12:42:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17505/pc-ble-driver-py-more-dongles" /><item><title>RE: pc-ble-driver-py more dongles</title><link>https://devzone.nordicsemi.com/thread/67290?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2016 12:42:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e05e01e4-9857-4bf1-aa0e-f5121cc87924</guid><dc:creator>vit bernatik</dc:creator><description>&lt;p&gt;Thank you. I confirm it works. I did not notice you propose &lt;code&gt;multiprocessing&lt;/code&gt; while I tried &lt;code&gt;threading&lt;/code&gt;. But still are u planning to update driver to work in single process? For example when I use pyserial I control easily multiple serial devices from one thread...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py more dongles</title><link>https://devzone.nordicsemi.com/thread/67289?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2016 12:18:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e03a386-5a16-4ac6-8c4b-e5c7261b12d5</guid><dc:creator>J&amp;#248;rgen Kvalvaag</dc:creator><description>&lt;p&gt;Here is a working example with two advertisers:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import sys
from multiprocessing import Condition, Lock
from pc_ble_driver_py.ble_driver import BLEDriver, BLEDriverObserver, BLEAdvData, BLEEvtID
import multiprocessing


class TimeoutObserver(BLEDriverObserver):
    def __init__(self):
        self.cond = Condition(Lock())

    def on_gap_evt_timeout(self, ble_driver, conn_handle, src):
        with self.cond:
            self.cond.notify_all()

    def wait_for_timeout(self):
        with self.cond:
            self.cond.wait()


def main(serial_port, name):
    print(&amp;quot;Serial port used: {}&amp;quot;.format(serial_port))
    driver      = BLEDriver(serial_port=serial_port)
    observer    = TimeoutObserver()
    adv_data    = BLEAdvData(complete_local_name=name)

    driver.observer_register(observer)
    driver.open()
    driver.ble_enable()
    driver.ble_gap_adv_data_set(adv_data)
    driver.ble_gap_adv_start()
    observer.wait_for_timeout()

    print(&amp;quot;Closing&amp;quot;)
    driver.close()

if __name__ == &amp;quot;__main__&amp;quot;:
    p1 = multiprocessing.Process(target=main, args=(&amp;#39;COM45&amp;#39;, &amp;#39;adv1&amp;#39;))
    p2 = multiprocessing.Process(target=main, args=(&amp;#39;COM46&amp;#39;, &amp;#39;adv2&amp;#39;))
    p1.start()
    p2.start()
    p1.join()
    p2.join()
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py more dongles</title><link>https://devzone.nordicsemi.com/thread/67288?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2016 11:52:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bafadb1-ca80-401c-8944-91deffe96943</guid><dc:creator>vit bernatik</dc:creator><description>&lt;p&gt;I tried to use python &lt;code&gt;threading.Thread&lt;/code&gt; and it did not help. Still getting crash on &lt;code&gt;driver.open()&lt;/code&gt; even when it is in second thread (&lt;code&gt;Exception in thread Thread-2:...&lt;/code&gt;). But even then it would be workaround. I would prefer to be able to run my test in one thread...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py more dongles</title><link>https://devzone.nordicsemi.com/thread/67287?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2016 10:18:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0514c92c-61f0-4418-bbe9-4ceb6d92eb4d</guid><dc:creator>J&amp;#248;rgen Kvalvaag</dc:creator><description>&lt;p&gt;I also ran into this issue with another python tool, pynrfjprog. It also crashes on the .open() method call.To work around it I had to wrap into separate multiprocessing.Process instances. Perhaps it could work for your issue too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>