This project has moved. For the latest updates, please go here.

Cannot establish connection unlesss COM port assigned?

Topics: Bluetooth - Microsoft
Feb 4, 2012 at 1:31 PM

Hello,

I am attempting to establish a connection to a RN-42 Bluetooth Chip located on a circuit board. I have successfully been able to connect, read, and write steam data to this chip without a problem using the InTheHand library using VB.NET

I have come across one problem however, and this is when I attempt to programatically connect to the Bluetooth device before a COM Port has been established for the device. Here are some examples of what I am talking about:

When going into 'Bluetooth Places', then browsing to the device, this is what will be shown when a fresh discover for the first time has been done for this device (as you can see there is no COM Port assigned to this device yet in Windows).

http://img684.imageshack.us/img684/6678/comno.jpg

When no COM Port is established, this is the error I receive when attempting to establish a connection programatically:

http://img163.imageshack.us/img163/5150/errormsg.jpg

The error reads:

An operation was attempted on something that is not a socket (BlueSoleil: OPERATION_FAILURE (0x0302)).

 

However, when I establish a COM Port by right clicking the 'Bluetooth Serial Port' item from 'Bluetooth Places', then select 'Connect', windows will bring up a small window stating that it is assigning a COM Port. Shortly afterwards, a COM Port will be assigned to the device and a connection will be made.

Here is a picture of the device after it has a COM Port established:

http://img35.imageshack.us/img35/4264/comyes.jpg

 

Is it possible for me to accomplish this COM Port assignment using the 32feet development kit? Or any other easy way programatically for that matter?

Developer
Feb 5, 2012 at 7:56 PM

This looks like its with the BlueSoleil stack?  So if you don't need the profile support etc that it provides and need the programmatic access then the simplest solution might be to reconfigure your PC so that the Microsoft stack is being used instead.  (Presumably re-config by Device Manager, select the dongle, do change driver and select the Microsoft driver).

For BlueSoleil use, what version of 32feet.NEt library are you using? 3.3?  Connecting to a SPP service didn't work before v3.2 AFAICS.  See e.g. workitem 30163 (http://32feet.codeplex.com/workitem/30163).  See also http://32feet.codeplex.com/wikipage?title=BlueSoleil&referringTitle=Documentation and the various notes referenced there.

Feb 7, 2012 at 2:15 PM
Edited Feb 8, 2012 at 5:00 AM

Yes I am using the BlueSoleil stack.. I'm going to try and fight with this for a bit. I've manged to do everything but assign a COM port to a discovered device.

Developer
Feb 8, 2012 at 11:13 AM

Do you want the COM port?  Or do you just want to use BluetoothClient.Connect and the stream from GetStream?

If the former you can do btDevInfo.SetServiceState(SerialPort, true)  That should create a COM port.

See http://32feet.codeplex.com/wikipage?title=BlueSoleil&referringTitle=Documentation and https://32feet.svn.codeplex.com/svn/InTheHand.Net.Personal/InTheHand.Net.Personal/Net.Bluetooth.BlueSoleil/32feet%20BlueSoleil%20Test.html