STMicroelectronics / BlueSTSDK_Python

Bluetooth Low Energy Sensors Technology Software Development Kit (Python version for Linux Gateways)
https://www.st.com/en/embedded-software/bluest-sdk.html
BSD 3-Clause "New" or "Revised" License
61 stars 19 forks source link

STEVAL-WESU1 : Failed to connect to peripheral 26:80:e1:c6:31:f7, addr type: random #1

Closed titusece closed 6 years ago

titusece commented 6 years ago

Hello,

I have STEVAL-WESU1 (STM32) board and wants to read the wearable sensor data to raspberry pi board. And I have used this python SDK to read the data, getting connection error while executing 1 example.

pi@raspberrypi:~/BlueSTSDK_Python $ sudo python example_ble_1.py

##################
# BlueST Example #
##################

Scanning Bluetooth devices...

Discovery started.
New device discovered: WeSU.
Discovery stopped.

Available Bluetooth devices:
1) WeSU: [26:80:e1:c6:31:f7]

Select a device ('0' to quit): 1

Connecting to WeSU...
Device WeSU went from IDLE to CONNECTING.
Failed to connect to peripheral 26:80:e1:c6:31:f7, addr type: random
Exiting...

pi@raspberrypi:~/BlueSTSDK_Python $
pi@raspberrypi:~/BlueSTSDK_Python $

The following log while executing bluepy examples.

pi@raspberrypi:~/bluepy/bluepy $ python btle.py 26:80:e1:c6:31:f7
Connecting to: 26:80:e1:c6:31:f7, address type: public
Service <uuid=Generic Attribute handleStart=1 handleEnd=4> :
    Characteristic <Service Changed>, hnd=0x2, supports INDICATE
Service <uuid=Generic Access handleStart=5 handleEnd=11> :
    Characteristic <Device Name>, hnd=0x6, supports READ WRITE NO RESPONSE WRITE WRITE SIGNED
    -> 'WeSU'
    Characteristic <Appearance>, hnd=0x8, supports READ WRITE NO RESPONSE WRITE WRITE SIGNED
    -> '\x00\x00'
    Characteristic <Peripheral Preferred Connection Parameters>, hnd=0xa, supports READ WRITE
    -> '\xff\xff\xff\xff\x00\x00\xff\xff'
Service <uuid=00000000-000e-11e1-9ab4-0002a5d5c51b handleStart=31 handleEnd=37> :
    Characteristic <00000001-000e-11e1-ac36-0002a5d5c51b>, hnd=0x20, supports NOTIFY READ WRITE NO RESPONSE WRITE
    -> '\r\nTime: 06:34:50\r\n'
    Characteristic <00000002-000e-11e1-ac36-0002a5d5c51b>, hnd=0x23, supports NOTIFY READ
    -> ''
Service <uuid=00000000-0001-11e1-9ab4-0002a5d5c51b handleStart=12 handleEnd=24> :
    Characteristic <00e00000-0001-11e1-ac36-0002a5d5c51b>, hnd=0xd, supports NOTIFY READ
    -> '0\x00\xb4\xff\xc0\x004\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
    Characteristic <00100000-0001-11e1-ac36-0002a5d5c51b>, hnd=0x10, supports NOTIFY READ
    -> '3\x00\x00\x00\x00\x00'
    Characteristic <00040000-0001-11e1-ac36-0002a5d5c51b>, hnd=0x13, supports NOTIFY READ
    -> '5\x00\x00\x00'
    Characteristic <00020000-0001-11e1-ac36-0002a5d5c51b>, hnd=0x16, supports NOTIFY READ
    -> '7\x00\x00\x00\x00\x00\x00\x00\x00'
pi@raspberrypi:~/bluepy/bluepy $

Can you please help me to read the 'STEVAL-WESU1' sensor data ? Thanks for the support.

ketyi commented 6 years ago

I've been facing with the exact same issue with STEVAL-WESU1 on PC (Ubuntu). It seems to be gatttool-related:

In https://github.com/STMicroelectronics-CentralLabs/BlueSTSDK_Python/blob/da1dca739f097bf5e7a4d7b14543223b60422803/blue_st_sdk/node.py#L175 "random" has to be changed to "public" in case of newer versions of gatttool. (I've read it here: https://github.com/Betree/magicblue/wiki/How-to-use-manually-with-Gatttool)

titusece commented 6 years ago

The latest code is working fine for me. Thanks Davide for your support. https://community.st.com/message/194565

dinukasal commented 6 years ago

Thanks @ketyi this worked for me too! :grinning: