[Qt-interest] Bluetooth SPP in Qt
Robert Wood
robert.wood at apostrophe.co.uk
Tue Jun 28 10:11:10 CEST 2011
On 27/06/11 22:16, Jeffery MacEachern wrote:
> That's sort of a multi-part question. The setup of the serial device
> depends on your driver/platform. On Linux, you can use BlueZ directly
> through QtDbus, or Qt Mobility classes, as I mentioned (they're
> ostensibly cross-platform, but I don't know which platforms are
> supported yet). I don't know anything about doing this manually on
> Windows. Once you have created the serial device, you could use
> QExtSerialPort[0] if you want a cross-platform way of accessing the
> serial device. At this point, you can just shove bits across the link
> like you would with a serial cable. Worst-case, it shouldn't be too
> hard, just maybe a bit messy, code-wise.
>
> If this doesn't answer you question, could you clarify what your
> concerns are, specifically? I have worked with exactly this situation
> for a while, and could probably help you figure it out.
Sorry if this is too much detail below, but thought I'd be as verbose as
possible!
Currently, I do use QExtSerialPort to do all my communications. I use
this thing called a Virtual Com Port (VCP) which is a USB communications
class that mean you can send any number of bytes from one upwards from
your program out via the USB port as if it were an old fashioned COM
port/ttyS port you were sending the information out of/in to. On my
embedded system I have this fantastic FTDI (they are the manufacturer of
the device) IC that connects to the USB. This FTDI device strips out all
of the USB overhead and spits out (and accepts in) the raw data the Qt
GUI has sent out (or is to receive). This FTDI connects via the UART
(COM port) of my eight bit embedded micro processor. Thus, as far as the
Qt program is concerned, it is communicating via a UART, not USB.
On Windows you have to install FTDI's VCP driver, on Linux the driver is
in the kernel. These drivers then mean you can then access the VCPs
easily. On Windows, I try to open all COM ports and if they can be
opened, I give the user the choice of selecting one of them to
communicate in a drop down box. In Linux I simply parse the /dev
directory for devTTYUSB* and offer all of these as an option to
communicate.
I would have hoped that if you have a Bluetooth SPP then these would
show up as com ports as well. If they do, then I assume "all" you have
to do is get the user to pair up the PC and vending machine then the Qt
application will be able to communicate as with the FTDI VCP?
So, what I am trying to ascertain is if you use these SPPs, can you use
these ports exactly as you would an old fashioned com port just as you
do with the FTDI VCPs? If not, how do you get the Qt application to get
data in and out of the SPP?
Hope that's the right amount of detail and makes sense! :~)
Rob
More information about the Qt-interest-old
mailing list