IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.6k stars 490 forks source link

Failing to connect to CC2650_SensorTag? #343

Closed johnfwhitmore closed 5 years ago

johnfwhitmore commented 5 years ago

New to bluetooth and trying to get started with a CC2650 SensorTag and bluepy. To try and find the issue I've added an extra piece of information, (rsp['state'][0]) to the exception raised in bluepy/btle.py:

if rsp['state'][0] != 'conn':
            self._stopHelper()
            raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s, response %s" % (addr, addrType, rsp['state'][0]), rsp)

This is giving me the output:

File "/usr/lib/python3.6/site-packages/bluepy-1.3.0-py3.6.egg/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s, response %s" % (addr, addrType, rsp['state'][0]), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 54:6c:0e:53:1b:b7, addr type: public, response disc

So the response I'm getting back from the CC2650 is "disc"? Like I say new to bluetooth so not sure why I'm getting this. Probably not an issue with bluepy but I can connect from my mobile so confused by this, and not sure how to proceed?

johnfwhitmore commented 5 years ago

Seems to have been about order of execution. Can't connect during the scan or something. Wait for scan to complete and then connect, by creating Peripheral.