Hi,
I was able to connect to 2 Bluetooth LE devices one at a time from my Raspberry PI 3 by using the below set of bluez commands:
1. sudo hcitool lescan
2. sudo gatttool -b <BLE ADDRESS> --interactive -t random --listen
3. connect
As well as retrieve some data using "char-read-hnd 0x0010"
But I am not able to connect to these BLE devices using python script such as "python GetData1.py" where the contents of file
GetData1.py is :
==================================================================
import pexpect
import time
import sys
import os
DEVICE = "ED:E0:E1:D6:CE:D1" # device #24
# Run gatttool interactively.
#child = pexpect.spawn("gatttool -I")
child = pexpect.spawn('sudo gatttool -b ' + DEVICE + ' -I')
child.expect('\[LE\]>')
# Connect to the device.
print("Connecting to:"),
print(DEVICE)
child.sendline('connect')
child.sendline('\[CON\].*>')
child.sendline('char-desc')
child.expect('\[LE\]>')
==================================================================
Any help and suggestions will be very much appreciated.
Thanks,
Asha