title: BlueZ/Pybluez - Bluetooth LE scan while connected to peripheral
body: <p>Short question: Is it possible to scan for LE devices while periodically connecting to some and reading characteristics a) in general [does the protocol allow it] and b) with the BlueZ stack?</p>
  
  <p>Long question: I'm writing a Python script to scan for LE devices advertising a certain UUID. If one is found, we should connect, read a specific characteristic value (call this <code>ValueA</code>), and disconnect. The idea is to maintain a real-time list of what <code>ValueA</code>'s are present. I want to be able to spawn a thread that starts the LE scans and collects the advertising events into a thread-safe container. When a new device is discovered, a handler should be fired to read <code>ValueA</code>. </p>
  
  <p>My efforts using PyBluez and <a href="https://github.com/IanHarvey/bluepy" rel="noreferrer">BluePy</a> (to connect to peripherals) have failed. When I use terminal commands (<code>sudo hcitool lescan --duplicates</code> and <code>sudo gatttool -I</code> followed by the connect and read commands), these fail if I try to connect after I start scanning (scan aborts)</p>
  
  <p>I am confused because I notice that if I am connected to a device via <code>gatttool</code> prior to starting an LE scan, I can kick off the scan and continue to read <code>ValueA</code> without impacting the scan, but not vice versa. </p>
  
  <p>Any insights or good BlueZ programming documentation would be appreciated. Using BlueZ 4.1 on Ubuntu 14.10 Macbook Pro</p>