04-23-2012 08:09 PM
I was wondering if I could somehow determine the COM port my bluetooth device is on. I have gotten as far as discovering my bluetooth device and extracting the correct address and device name using the Blueooth Discover VI, and I have been able to obtain the correct UUID number from the Bluetooth RFCOMM Service Discovery VI. Is there any way to obtain what com port it is on from what I have?
.
04-24-2012 12:13 AM
Hi CF_eee,
Before proceeding further,Can you just check that if your bluetooth supports/has SPP(Serial Port profile)?If yes,then directly a com port will be shown in your device manager and you can normally communicate to your bluetooth device using Serial port just like any other serial port communication?
regards,
SrikrishnaNF
04-24-2012 11:28 AM
CF_eee,
SrikrishnaNF is correct in stating that your Bluetooth device must support Serial Port Profile (http://en.wikipedia.org/wiki/Bluetooth_profile#Serial_Port_Profile_.28SPP.29) in order for the COM Port to show up. This is a profile that allows communication with a Bluetooth device using RS-232 (serial).
If your device does support SPP, you can determine which COM Port it is using by the following:
Start by opening Windows Device Manager. Select Start » Settings » Control Panel » System. In the System window which opens, choose the Hardware tab. Then click the Device Manager button.
In the Device Manager, expand the Ports (COM & LPT) section. This will list all the COM Ports in use (and their corresponding addresses).
04-24-2012 03:00 PM
Yes, it does support SPP. Actually, I should've mentioned that I already have successfully made a Labview program that can connect, read, and write to my bluetooth device. The problem with my current program is that I have to, as you mentioned, go into the control panel to see which COM port I have to select in my Labview program. The COM port will be different for different computers that will use this device.
What I am trying to do at this point is to integrate code that, when labview runs, can automatically discover that the device, connect to the device through the serial port, and be ready to transmit/receive data, without having to manually pick the correct serial port, and try to make a connection.
04-25-2012 02:54 PM
CF_eee,
Thank you for clarifying what you are trying to do.
I have two suggestions for you. Each of them may be able to accomplish what you are trying to do.
(1) Use the Windows Registry to look up information on connected hardware.
On my computer, information about my Serial Port (COM1) is stored in the Windows Registry at HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\ACPI\PNP0501\1.
Example keys are Class, ConfigFlags, DeviceDesc, Driver, FriendlyName, HardwareID, and Service (amongst others).
You can access these registry values from LabVIEW using the Functions located at Connectivity > Windows Registry Access VIs. If you walk through the Enum or ACPI folders, you should be able to determine which Serial Port represents your Bluetooth device by parsing and matching against these keys.
(2) Use the System Exec VI to call the devcon Command-line Utility from Microsoft
The devcon utility can be downloaded here: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272
From the devcon download page: The DevCon utility is a command-line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices.
The System Exec.vi can be found on the Functions palette at Connectivity > System Exec.vi
You can find documentation on devcon at the download page (linked above).