(Dis) Connecting Bluetooth Devices with Windows.Devices.Bluetooth.Rfcomm (WP8.1)

Connecting and disconnecting to Bluetooth devices gives different results on Windows Phone / Desktop 8.1. I used the Windows.Devices.Bluetooth.Rfcomm namespace and I tried to connect multiple devices with different versions / classes of Bluetooth.

  • Version 1.2 (classes 1 and 2)
  • Version 2.0 (Class 1 and 2)
  • Version 2.1 (Class 1 and 2)
  • Tested on Nokia Lumia 625 and Lumia 635, Dell Latitude E6500 and Dell Precision M6400.

Whenever I try to connect to any of the devices 2.0 or 2.1, there are problems. The first time I try to connect to each of the devices, everything will be fine and the connection will open. When I subsequently close the connection and reconnect the device, the problem will begin. During reconnection, the connection will never open and the debugger will throw a System.Exception:

 > Message: No further data is available. 

In addition, when the connection does not work, Windows 8.1 devices will try (unsuccessfully) to connect to the Bluetooth devices themselves, even when my own application is completed. Sometimes a Windows 8.1 device also displays the Bluetooth device as connected, while the device visually shows that it is no longer connected. The only way to reconnect the Bluetooth device is to disconnect it and turn off / restart Bluetooth on the Windows device.

Whenever I try to make a new call to DeviceInformation after a failed connection, it will refuse to return the device that I previously tried to connect.

 > Message: The service cannot be found in the specified name space. 

Odd result, devices 1.2 work fine.

Manifest file:

 <m2:DeviceCapability Name="bluetooth.rfcomm"> <m2:Device Id="any"> <m2:Function Type="serviceId:00001101-0000-1000-8000-00805F9B34FB"/> </m2:Device> </m2:DeviceCapability> 

Device selection:

 Guid RfcommChatServiceUuid = Guid.Parse("00001101-0000-1000-8000-00805F9B34FB"); await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.FromUuid(RfcommChatServiceUuid))); 

Connection: (id = chatserviceid)

 StreamSocket _socket; RfcommDeviceService service = await RfcommDeviceService.FromIdAsync(deviceInformation1._id); await _socket.ConnectAsync(service.ConnectionHostName, service.ConnectionServiceName); 

Disconnection:

 this._socket.Dispose(); this._socket = null; 

I researched MSDN, code samples, demo, channel 9 and StackOverflow, no resource can tell me if there are problems with Windows.Devices.Bluetooth.Rfcomm .

Is there anyone who knows these odd results? Am I doing something wrong?

UPDATE: Working with Windows Phone 8.1. GDR2 is a possible solution.

NOTE. For me and a few other users, this update still gives the same problems.

+82
c # windows xml windows-phone bluetooth
Nov 17 '14 at 10:19
source share
1 answer

I would try CoolTerm and see if this works for you. I had a similar problem with connecting a speaker with a Sigma DSP chip inside via a USB connection, so if you have problems with external devices, it may happen that the device is not compatible with your computer. Download CoolTerm and go to the settings, and in the "Serial Port" section you should change the port to the desired connection (Bluetooth, USB, etc.). Then edit the settings as necessary and go to the main window and click "Connect" and see if it works for you.

+1
Jul 28 '15 at 14:56
source share



All Articles