JojiiOfficial/bluetooth-serial-port-async

How to create a server to listen for connections?

Closed this issue · 2 comments

When I run your example It can't find any devices, I have literally dozens of bluetooth devices advertising packets. What is this looking for when it scans for devices? do you have an example of a server?

This library can only open rfcomm connections to already connected Bluetooth devices (iirc). If you'd like having a server, you need a listener for Bluetooth connections and if a specific device connects, you can open a rfcomm connection to it. That's the use case I needed it for. Where I used it:

Bluetooth connection listener:
https://github.com/JojiiOfficial/LiveBudsCli/blob/master/src/daemon/bluetooth/bt_connection_listener.rs#L82

Rfcomm connection:
https://github.com/JojiiOfficial/LiveBudsCli/blob/master/src/daemon/bluetooth/rfcomm_connector.rs#L159

Keep in mind that this is only a fork with some modifications, I'm not the creator of it. I hope this helps.

Thank you so much for your help. Your LiveBudsCli looks like just the full service example that I've been looking for!!