locked
Bluetooth on Windows 8.1 - chat sample not working RRS feed

  • Question

  • I've tried to get a simple Bluetooth chat to work in Windows 8.1 by using the "Bluetooth Rfcomm Chat" sample which can be found on the MSDN page.

    Unfortunately, it doesn't work at all. I've paired my laptop and my surface (both are running 8.1) and I am able to transfer files within the devices. The Bluetooth chat server was written in C#, the client in JavaScript. I ran the server on my laptop and started to listen for incoming requests and the client on my surface and clicked "run" to connect to the server. However, the server didn't find any devices and the client said "No chat service were found. Please pair Windows with a device that is advertising the chat service".

    Can someone explain how to get this to work? Or can someone provide a working example of data transfer via Bluetooth (preferred language: JavaScript).

    Thursday, January 16, 2014 8:35 PM

All replies

  • I'll test this to see what I can figure out.

    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, January 17, 2014 8:30 PM
    Moderator
  • I tried but unfortunately, I can't post links to code samples yet (I got the message to verify my account first...)
    Tuesday, January 21, 2014 1:22 PM
  • I realize that I don't have a client to connect to, so if you can post a client, I'll check it out.  Otherwise, I found a post about this capability which might help:

    http://www.silverlightshow.net/items/Windows-8.1-Play-with-Bluetooth-Rfcomm.aspx


    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, January 21, 2014 2:28 PM
    Moderator
  • Here is the complete code I'm using: https://skydrive.live.com/redir?resid=3D6B85E55E3F9B58%21280
    Tuesday, January 21, 2014 4:36 PM
  • I would ask the same from MS.
    Friday, January 24, 2014 7:57 PM
  • I finally found out why it is not working. You have to accept that the client can use the services offered by the Bluetooth server first. I wrote a blog entry with more details about this here: allagora.wordpress.com/2014/02/06/make-windows-8-1-ready-to-communicate-via-bluetooth/
    Wednesday, January 29, 2014 11:41 PM
  • hi friend ,I also have this problem that my chat client couldn't find the Bluetooth server ,

    can you tell me how could you resolve your issue ?

    I published my service  on my win pc 8.1 , but my client on the other win8.1 pc couldn't find the server ?

    these the relation codes :

    server :

    function

    Initializ

        {

    Windows.Devices.Bluetooth.Rfcomm.RfcommServiceProvider.createAsync(

                rfcomm.RfcommServiceId.obexObjectPush).done(

    function(provider) {

                    _provider = provider;

    _listener =

    newWindows.Networking.Sockets.StreamSocketListener();

                    _listener.addEventListener(

                       

    "connectionreceived", OnConnectionReceived);

              

    return      _listener.bindServiceNameAsync(

                       _provider.serviceId.asString(),

                       Windows.Networking.Sockets.SocketProtectionLevel.bluetoothEncryptionAllowNullAuthentication);

                      

                });

           

    // Set the SDP attributes and start advertising


           

    //.bluetoothEncryptionAllowNullAuthentication   .plainSocket


                InitializeServiceSdpAttributes(_provider);

                _provider.startAdvertising(_listener);

                WinJS.log && WinJS.log(

    "server start ", "sample", "status");

           

        }

       

    functionInitializeServiceSdpAttributes(provider)

            {

                  writer =

    newWindows.Storage.Streams.DataWriter();

               

    // First write the attribute type


                writer.writeByte(SERVICE_VERSION_ATTRIBUTE_TYPE)

               

    // Then write the data


                writer.writeUInt32(SERVICE_VERSION);

       

               

    vardata = writer.detachBuffer();

                provider.sdpRawAttributes.insert(SERVICE_VERSION_ATTRIBUTE_ID, data);

             

            }

    also the capacity :

        <

    CapabilityName="privateNetworkClientServer"/>

        <

    CapabilityName="internetClientServer"/>

        <

    m2:DeviceCapabilityName="bluetooth.rfcomm">

              <

    m2:DeviceId="any">

                <

    m2:FunctionType="name:obexObjectPush"/>

          </

    m2:Device>

        </

    m2:DeviceCapability>

    client :

      Windows.Devices.Enumeration.DeviceInformation.findAllAsync(

           rfcomm.RfcommDeviceService.getDeviceSelector(rfcomm.RfcommServiceId.obexObjectPush)).done(

    function(services) {

    ........

    also add the capacity :

    <

    m2:DeviceCapabilityName="bluetooth.rfcomm">

          <

    m2:DeviceId="any">

            <

    m2:FunctionType="name:obexObjectPush"/>

          </

    m2:Device>

        </

    m2:DeviceCapability>

    Monday, November 17, 2014 11:51 AM
  • I also paired the two pc , does it need another setting for the server or the client ?

    thanks , please help me !!!

    Monday, November 17, 2014 11:55 AM
  • what do you mean by "you have to accept that the client can use the services offered by the Bluetooth server first " ?
    Monday, November 17, 2014 12:43 PM
  • Please see this:
    http://blogs.msdn.com/b/wsdevsol/archive/2014/11/10/why-doesn-t-the-windows-8-1-bluetooth-rfcomm-chat-sample-work.aspx

    If this doesn't help, please post a new thread.


    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.

    Wednesday, November 19, 2014 7:46 PM
    Moderator