[Interest] Serial port / Bluetooth port to Android
Murphy, Sean
smurphy at walbro.com
Tue Aug 29 17:15:59 CEST 2017
> > On the Android device, we really only care about connected to the external
> > device via Bluetooth. But does this same behavior, where Bluetooth looks
> > like a serial device, exist under Android and I can still use QSerialPort? Or
> > do I need some other device (i.e. QBluetoothSocket)?
>
> You have to use QBluetoothSocket. There is no other choice. At the end of
> the day both interfaces are derived from QIODevice. "Merely" the path to
> your QIoDevice is different.
Thanks for the response.
Is this just a difference of Android vs. Windows that our external BT device
doesn't show up as a serial device under Android like it does under Windows?
I don't think it will be a huge deal to rewrite, but 4 years ago when I started
writing the affected class we were "only ever going to run this application on
Windows using a USB to Serial adapter". So back then I created a class that
inherits from QSerialPort and started coding. I think based on what you're saying
about needing QBluetoothSocket under Android, and to make it more flexible in
general, I should probably just change that class to inherit from QObject and take a
QIODevice* so that I can swap out QSerialPort, QBluetoothSocket, or even
QTcpSocket if needed?
Sean
More information about the Interest
mailing list