PDA

View Full Version : QSerialPortInfo - Bluetooth SPP devices



BrianNorman
15th February 2016, 09:44
Hi,

I am enumerating the available com ports some of which are Bluetooth SPP devices. To be able to check which ones are the ones I am interested in I need to know the Bluetooth 'name'. This does not appear to be possible using QSerialPortInfo.

If I use Windows Device Manager I can see the Bluetooth port and its properties has the Display Name / Friendly name I am interested in.

Is there anyway to get the friendly name via QSerialPortInfo? Is there another method?

Thanks

Brian

kuzulis
16th February 2016, 09:46
Could you please provide an screenshoots?

creatron
16th February 2016, 15:44
I am experience that some problem that Windows does not supply all the info , but the same source code produce the more 'correct' information on Linux, this was the same for QT 4.8 and 5.2. Try Linux.

BrianNorman
17th February 2016, 14:48
Hi,

This is the view from the serial port info data and from the Bluetooth data page. It is the APVision string I am interested in.

11715

11714

On Windows all I get is COM3 etc

kuzulis
17th February 2016, 15:11
I do not understand, what OS is necessary for you? At first you write about Windows... But, next you give screenshots from OS X... What do you want?
Do you want to see the description/manufacturer strings on Windows, or on OS X, or what?

BrianNorman
17th February 2016, 15:42
Sorry if I was not clear.

On OS X the Bluetooth name as found on the Bluetooth page is part of the name that serial port info returns. That is good and I can use it to determine which ports are 'mine' and I can ignore the rest.

On Windows it is not so helpful. The only thing that serial port info returns is COM3 etc. I would like to know what the Bluetooth name is but getting the information via serial port info. Or is there another route to get the Bluetooth name that I can then tie up with the serial port info?

Windows is where I have the problem.

Thanks

kuzulis
17th February 2016, 15:46
Then, please provide the screenshoot of Devicemanager on your Windows. There are will be like "COM3 standard incoming/outgoing bluetooth port"... for COM3.

BrianNorman
17th February 2016, 17:47
Hi,

11716

The Bluetooth port I am interested in is AP Vision-BAB1. I know it is Com15 and Com18.

Qt serial port info tells me description 'Standard Serial over Bluetooth link' portName 'COM18' and systemLocation '\\.\COM18'

What I want to know is the connection between COM18 and the Bluetooth name. Then I can either discard the port if it is not of interest to me or try to use it if it is.

Thanks

Brian

kuzulis
18th February 2016, 09:08
I am interested in is AP Vision-BAB1

On Window, this name is assigned to the BT enumerator only...
I am not sure that it will be a good idea to take the "BT enumerator
description" instead of "standard serial port description"...

UPD: Does returns your "AP Vision-BAB1" by an QSerialPortInfo in the OSX?
If, yes, then, what is method of QSerialPortInfo returns it (is it description(),
manufacturer(), product())? because I can not check it at this time on OS X.

BrianNorman
18th February 2016, 09:35
Good Morning,

On the OS X system this is the info result.

portName "cu.APVision-BAB1-RNI-SPP"
description "outgoing port - APVision-BAB1-RNI-SPP"
systemLocation "/dev/cu.APVision-BAB1-RNI-SPP"

kuzulis
18th February 2016, 13:47
It seems there is no universal method to associate the BT device name to the its serial ports, on Windows.

1) We can enumerate the BT devices, where we can take a device friendly name (like your "AP Vision-BAB1"), and other parameters of device.

2) We can enumerate the COM ports, where we can take a serial port description (like the "Standard Serial over Bluetooth link") and other parameters of serial port.

But we can not detect a relationship between 1) and 2) for the unambiguous assignment of the BT friendly name to the related serial port.

BrianNorman
18th February 2016, 16:13
That's the conclusion I reached. Its annoying as this Windows feature is making the connection.

11718

Presumably it is doing clever stuff in the registry to make the connection.

Thanks

kuzulis
18th February 2016, 17:12
Presumably it is doing clever stuff in the registry to make the connection.

Maybe there is used a private winapi...
Maybe you can take the QSerialPort::handle() to use the BT-specific API to get an appropriate bluetooth device name...

kuzulis
19th February 2016, 18:34
UPD: Seems, this relationship can be done only for "Outgoing" serial ports..

BrianNorman
22nd February 2016, 10:49
Hi,

Do you have any hints as to how to discover this relationship?

Thanks

kuzulis
22nd February 2016, 11:27
Ohhh.. it is not simple:

1) We need enumerate all BT devices, using SetupApi.

2) We need store each "FriendlyName" of BT device, and need to parse its BT address and store it too..

3) We need enumerate all serial ports, using SetupApi

4) We need parse each "Device Instance Identifier" of each serial port for matching to the same BT address.. Things is that the outgoing BT serial ports contains a BT address inside of own "Device Instance Identifier" string. So, we need to parse this BT address from the string and to compare with each of the BT address of previously saved BT device... When the addresses were equal, then we take the "FriendlyName" from the stored BT device. This "FriendlyName" will be a name of assigned BT device to the serial port. But! This does not work with the "Incoming" serial ports, because its "Device Instance Identifier" string does not contain a BT address!

PS: Maybe, can be used the winAPI for bluetooth devices, instead of the Registry parsing... But, I am not sure that is is a good idea, because this API is blocking and for other reasons...

PS2: Also, maybe, you can use the WMI, but this question is out of scope.

BrianNorman
22nd February 2016, 14:18
Thanks for taking the time to look at this. I think I am going to park the issue.

Thanks.