Black Lives Matter - Action and Equality. ... Adafruit is part of the Stop Hate for Profit campaign. Adafruit is open and shipping.
0

adafruit_ble UARTService '_bleio' has no attribute 'Service'
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

adafruit_ble UARTService '_bleio' has no attribute 'Service'

by tlpada on Tue Apr 07, 2020 12:09 am

When trying to instantiate a simple UARTService() on Raspberry Pi (to set up a BLE "Central" listener), it fails with an exception from /usr/local/lib/python3.5/dist-packages/adafruit_ble/services/__init__.py:

Code: Select all | TOGGLE FULL SIZE
AttributeError: module '_bleio' has no attribute 'Service'
The UARTService() invocation is taken from the "CircuitPython BLE Morse Code Chat" example, https://learn.adafruit.com/pages/18858/elements/3057225/download. A call to UARTService() is sufficient to duplicate this error, from the simplest code:

Code: Select all | TOGGLE FULL SIZE
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService

ble = BLERadio()
uart_service = UARTService()
The output from running this code is:

Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "./simple-test.py", line 6, in <module>
    uart_service = UARTService()
  File "/usr/local/lib/python3.5/dist-packages/adafruit_ble/services/nordic.py", line 65, in __init__
    super().__init__(service=service)
  File "/usr/local/lib/python3.5/dist-packages/adafruit_ble/services/__init__.py", line 52, in __init__
    self.bleio_service = _bleio.Service(
AttributeError: module '_bleio' has no attribute 'Service'
Has anyone seen this or could advise?

Thanks.

tlpada
 
Posts: 34
Joined: Thu Feb 27, 2020 2:38 pm

Re: adafruit_ble UARTService '_bleio' has no attribute 'Serv

by tannewt on Tue Apr 07, 2020 1:11 pm

BLEIO on raspberry pi cannot do connections at all. It only implements scanning of advertisements.

tannewt
 
Posts: 1685
Joined: Thu Oct 06, 2016 8:48 pm

Re: adafruit_ble UARTService '_bleio' has no attribute 'Serv

by tlpada on Tue Apr 07, 2020 1:33 pm

Thanks for responding. Oh no, so what would you recommend? I bought a few CLUE boards that I'm trying to use to send sensor data to a BLE "Central" listener on Raspberry Pi. For doing this via BLE, what would you recommend I implement for (1) the Raspberry Pi central server, and (2) what to run on the CLUE sensor boards?

I was assuming for (2) the 'client' side on CLUE I could either run the UARTService or the client code from "Bluetooth LE Sensor Nodes to Raspberry Pi WiFi Bridge" tutorial, using this code for CLUE: https://learn.adafruit.com/pages/18861/ ... 5/download. But will that not work with (1) the RPi side somehow? I don't really need constantly 'advertise' the CLUE sensor data, since they're constant and known -- I was thinking of them as just dedicated connections... hence the UARTService direct-connection thought.

Thanks.

tlpada
 
Posts: 34
Joined: Thu Feb 27, 2020 2:38 pm

Re: adafruit_ble UARTService '_bleio' has no attribute 'Serv

by tannewt on Wed Apr 08, 2020 12:51 pm

Advertising is what I recommend: https://learn.adafruit.com/bluetooth-le ... ifi-bridge

You don't need to advertise constantly. You only need to advertise when a value changes. See here for different ways to do it: https://github.com/adafruit/Adafruit_Ci ... r/examples

tannewt
 
Posts: 1685
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.