M.J
M.J

Reputation: 162

Unable to get Service from Bluetooth Sensor Device (Pycom)

Scanned and able to connect with my Ti sensor Device , but on Service request it is not working.

bluetooth = Bluetooth()
bluetooth.start_scan(5)
while bluetooth.isscanning():
adv = bluetooth.get_adv()
if adv:
if(str(binascii.hexlify(adv.mac).decode()) == '78a50454b267'):
conn = bluetooth.connect(adv.mac)
print(type(conn))
service = bluetooth.get_service()
print("got service", service)

The service is not print. Loop get stopped their and no response.

Even I have tried so many get service methods.,

missed any import functions. ? Is there any GATT connection problem. ? How to import .gatt and its service, characteristic ??

Upvotes: 1

Views: 264

Answers (1)

Sudhan
Sudhan

Reputation: 306

try to use sleep time and get data as dictionary like below, things will work... Cheers!!!

services = dict()
            time.sleep(0.050);
            services = conn.services()

Upvotes: 3

Related Questions