QBluetoothSocket baud rate
-
I am planning to use a QBluetoothSocket (SPP) connection to a device. At the moment I setup the rfcomm connection to the bluetooth device in Linux, and then my app uses QSerialPort to connect to the bluetooth device.
With QSerialPort (over rfcomm) I still need to set the right baud rate in order for the device to respond. But with QBluetoothSocket there does not appear to be any wan to set the baud rate! Why?
Why would serial over bluetooth (/dev/rfcomm) require setting a baud rate, and serial over bluetooth (spp) not allow setting a baud rate?
-
@ocgltd said in QBluetoothSocket baud rate:
At the moment I setup the rfcomm connection to the bluetooth device in Linux, and then my app uses QSerialPort to connect to the bluetooth device.
What has QSerialPort got to do with it?
SPP over RFCOMM emulates a serial port in that data in one end comes out the other. It does not create a new serial port device on the client that you then open separately. If you have a QBluetoothSocket connected to a RFCOMM server then you have everything needed to send and receive bytes through the generic QIODevice interface, e.g. read(), write(), and the readyRead() signal.
See the docs here and the example here -
@ocgltd said in QBluetoothSocket baud rate:
At the moment I setup the rfcomm connection to the bluetooth device in Linux, and then my app uses QSerialPort to connect to the bluetooth device.
What has QSerialPort got to do with it?
SPP over RFCOMM emulates a serial port in that data in one end comes out the other. It does not create a new serial port device on the client that you then open separately. If you have a QBluetoothSocket connected to a RFCOMM server then you have everything needed to send and receive bytes through the generic QIODevice interface, e.g. read(), write(), and the readyRead() signal.
See the docs here and the example here@ChrisW67 In linux you can establish the bluetooth connection to a device, and this will create a /dev/rfcom1 tty device. Then in Qt you can open that device using QSerialPort.
That is an alternative way to establish a serial over bluetooth connection. One way allows setting baud rate, the other does not.
-
bluetooth is a generic protocol stack that nests services. socket APIs don't understand the concept of "baud rate". They are not applicable and the comms uses what bandwidth/speed is available. When you tunnel a "serial port" session, that type of connection has an inherent baud rate associated with it, but it's up to the bluetooth stack to decide whether it cares about about that parameter, either transferring data as fast as the medium will allow for, or inserting idle time in the serial stream to give the effect of the slower baud rate.