0

I have a RPi3 which can successfully trust, pair, connect and even list the service UUIDs of a BLE device both via bluetoothctl and via Bluepy python library.

But when it tries to 'get' that service with getServiceByUUID() it fails to find the service.

What could be the underlying reasons for such an error?

> File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line
> 449, in getServiceByUUID raise BTLEException(BTLEException.GATT_ERROR,
> "Service %s not found" % (uuid.getCommonName()))
> bluepy.btle.BTLEException: Service ffe0 not found
0

After hours of inspecting the btle.py file, I noticed the getServices() function was not being called. I added a call to it and now it find can find the service:

#!/usr/bin/env python
import bluepy.btle as btle
p = btle.Peripheral("00:0E:0B:00:75:12", "random")
services=p.getServices()
for service in services:
   print service
s = p.getServiceByUUID("0000ffe0-0000-1000-8000-00805f9b34fb")
c = s.getCharacteristics()[0]
c.write("e", "utf-8")
p.disconnect()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.