locked
"Element not found" when connecting RFCOMM to a bluetooth device

    Question

  • I am connecting to a custom bluetooth device exposing it self as SPP (serial connection) and am trying to access it via a win store 8.1 app. I can find it in devices but everytime I try to connect a socket I get "Element not found"

    It does not use custom drivers and registers itself as a com port locally. I can also access it using a SerialConnection using the full framework using another test app.

    Does anyone have any input on what might cause this?  Is there some requimrents for the hardware that would allow win8 to find it but not connect?

    var devicesInfoCollection
        = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
    
    var rfcommService
        = await RfcommDeviceService.FromIdAsync(devicesInfoCollection.First().Id);
    
    var socket = new StreamSocket();
    
    await socket.ConnectAsync(rfcommService.ConnectionHostName,
        rfcommService.ConnectionServiceName, SocketProtectionLevel.PlainSocket);
    Thursday, April 03, 2014 8:05 PM

All replies

  • Does the sample code work for you?
    http://code.msdn.microsoft.com/windowsapps/Bluetooth-Rfcomm-Chat-afcee559

    If not, I will ask our networking guy to take a look at this.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 04, 2014 12:34 PM
    Moderator
  • Take a look at http://shipwrecksoftware.wordpress.com/2013/11/23/bluetooth-and-windows-8-1/

    It give the four reasons why my own app didn't work with Bluetooth.  Chances are, it's the manifest.


    Network Developer Experience Team (Microsoft)

    Friday, April 04, 2014 6:53 PM
  • I think I have all those covered.  I found the manifest issue pretty early on and added the capability (atleast all I think I need).  I do get as far as the device enumeration service finding and and the rfcomm info coming back.  It doesn't break till I actually connect the socket.  Thanks for the link!

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

    Friday, April 04, 2014 7:25 PM
  • That sample has been updated to windows phone 8.1 and seems to be causing problems getting it running on my device.  However I got it up and running for the windows part and everything was working fine and creating/consuming chat services.
    Friday, April 04, 2014 7:30 PM
  • I am still having issues with this.  Have you been able to forward this to someone on the networking team?
    Tuesday, April 08, 2014 3:43 PM
  • Yes, this person:

    Network Developer Experience [MSFT]
               

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, April 08, 2014 4:14 PM
    Moderator
  • I have been trying to escalate this but have still had no luck so I thought I would ping back here to see if anyone else might take a look.  We have got other bluetooth devices to work but it is just our device that fails to talk through the windows 8.1 API.  We think it may be some setting that the Windows 8.1 api requires that we aren't setting (in our hardware device protocol) but we just cannot figure out what it is.  I have been looking for some more lower level requirements for windows 8.1 but can only find very general information and nothing about base requirements for the hardware protocol such as version or anything that it must respond to.
    Wednesday, July 23, 2014 5:46 PM
  • Please open a support case for this issue.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, July 24, 2014 3:49 PM
    Moderator
  • I am having this exact some issue when trying to connect from Windows Phone 8.1 Silverlight to Windows 8.1. The same code works on Windows Phone 8.0.

    I am trying this code example from MSDN docs ("app-to-device"): http://msdn.microsoft.com/en-us/library/windows/apps/jj207007%28v=vs.105%29.aspx#BKMK_Codeexamples. This code does work on Windows Phone 8.0 but the exact same code does not work on Windows Phone 8.1

    Did you find a solution to this issue? 



    • Edited by Johan Paul Thursday, August 14, 2014 2:05 PM
    Thursday, August 14, 2014 1:38 PM
  • Not sure if our problem will help you but the issue ended up stemming from our device exposing two unique service id's.  There is a bug in 8.1 desktop that in this case it throws a very low level error and to get it to work with the current stack you have to remove one of the UUID's it registers as on the Bluetooth device.  Not sure if this will affect you on Phone 8.1 however.
    Thursday, August 14, 2014 7:28 PM
  • Not sure if our problem will help you but the issue ended up stemming from our device exposing two unique service id's.  There is a bug in 8.1 desktop that in this case it throws a very low level error and to get it to work with the current stack you have to remove one of the UUID's it registers as on the Bluetooth device.  Not sure if this will affect you on Phone 8.1 however.

    Unfortunately this doesn't help us, because the "server" device (that is, the device that we want to connect to using BT from our Windows Phone 8.1 device) is a Surface Pro 3 tablet that has our app installed. Not much we can do about the other services there.
    Tuesday, August 26, 2014 3:54 PM