Minimal RFCOMM client example
Closed this issue · 0 comments
Discussed in #130
Originally posted by manio March 2, 2024
Hi,
I am currently using bluetooth-serial-port-async crate in my project. Unfortunately it is rather a small and unmaintained crate and I prefer to switch to bluer for better compatibility in the future.
I only want to connect to the remote bluetooth dongle with RFCOMM and "talk" to it as a client, and this crate is really easy (you may look at example here).
While looking at bluer::rfcomm examples available or an rfcat source I am confused.
I can see opening local BT adapter (this is at least understandable for me), binding to some local sockets, creating profiles, even creating session (which is not needed when I want to act as a client, right?). Is this all needed when I only want to connect as a client to remote serial port?
Can you show me the totally minimum code for connecting to the RFCOMM dongle? I have a remote MAC address, default port (1) and I'd like to get an RFCOMM stream, on which I will then AsyncRead and AsyncWrite. That's all.