Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5002

Troubleshooting • Re: Bluetooth pairing

$
0
0
It is often impossible to fix something like this that is buried in bluez and not under user control. If you want a simpler approach that avoids bluez, my Bluetooth library and the code below will do the job. After pairing from Windows, it can be connected by a Bluetooth terminal program and receive ascii strings with a line feed (10) termination, and will reply "OK". The "Hello World" sample file classic_server.py is a similar example.

https://github.com/petzval/btferret

Code:

import btfpydef callback(node,data,len):  print("Received: " + data.decode())  btfpy.Write_node(node,"OK\n",0)  return(btfpy.SERVER_CONTINUE)  if btfpy.Init_blue("devices.txt") == 0:  exit(0)keyflag = btfpy.KEY_ON | btfpy.PASSKEY_LOCALbtfpy.Classic_server(btfpy.ANY_DEVICE,callback,10,keyflag)btfpy.Close_all()

Statistics: Posted by petzval — Tue Dec 17, 2024 4:45 pm



Viewing all articles
Browse latest Browse all 5002

Trending Articles