Disconnect when using Headset-Profile

Topics: Bluetooth - Microsoft
Jan 11, 2012 at 11:56 PM

Hi,

thanks for this great library and especially for the MS Stack Support.

I tried to turn on the Headset Profile with my Nokia n7500 and N78 mobile phone using default MS Stack.

Like this way:

InTheHand.Net.Bluetooth.BluetoothRadio radio = InTheHand.Net.Bluetooth.BluetoothRadio.PrimaryRadio;
InTheHand.Net.Sockets.BluetoothClient client = new BluetoothClient();
BluetoothDeviceInfo[] list = client.DiscoverDevices(10,true,true,true); for (int i = 0; i <= list.Length; i++) { //MessageBox.Show(list[i].DeviceName.ToString());

if(some_adress == list[i].DeviceAdress.ToString())
{
  endpoint_dev = new BluetoothEndPoint(list[i].DeviceAddress, Guid.NewGuid()); endpoint_dev.Service = BluetoothService.Headset; client.SetPin("0110"); client.Connect(endpoint_dev);
}

         break;
 }

The radio connects successfully to my mobile phone with headset profile.

When accepting a call hsp disconnects with my two mobiles.

Thanks for help and advantages.

Björn

Coordinator
Jan 13, 2012 at 2:33 PM

I'm not sure how this code interacts with the headset profile as where you are connecting you are supplying a new guid (random) which will no doubt not match a service running on the device. The class BluetoothService contains identifiers for all the standard services and if you are writing your own you would need to use a fixed Guid so that the same value is used on both devices.

Peter

Developer
Jan 18, 2012 at 9:18 AM

What's your aim?  If you just want to enable the Headset profile, use BluetoothDeviceInfo.SetServiceState(Headset, true).

(The audio part of all Bluetooth profiles (Headset/Handsfree/A2DP) uses a SCO channel, for which there is no generally accessible API, so we couldn't set up the audio channel directly).