locked
windows store Rfcomm bluetooth application works unstable

    Question

  •  private async void InitializeRfcommClient(DeviceInformation Dev)
            {

                        var serviceInfo = (DeviceInformation)Dev;
                         Debug.WriteLine("Dev id: " + Dev.Id);

                         rfcommService = await RfcommDeviceService.FromIdAsync(Dev.Id);

    /* exception here i will get some times as No such service is known. The service cannot be found in the specified name space. (Exception from HRESULT: 0x8007277C)*/




                         if (rfcommService != null)
                         {
                             Debug.WriteLine("Dev ConnectionHostName: " +                                                    rfcommService.ConnectionHostName);
                             if (socket == null)
                             {
                                 Debug.WriteLine("Socket was null and reassigned ");
                                 socket = new StreamSocket();
                                 await socket.ConnectAsync(rfcommService.ConnectionHostName, rfcommService.ConnectionServiceName);
                             }
                             else
                             {
                                 Debug.WriteLine("Socket was not null ");
                                 //socket = new StreamSocket();
                                 await socket.ConnectAsync(rfcommService.ConnectionHostName, rfcommService.ConnectionServiceName);
                             }



                         }
                         else
                         {
                             Debug.WriteLine("Rfcommservice not availble ");
                         }
                    

                         Debug.WriteLine("Intialize rfcomm end");

            }

                                                                                               

    • Edited by D Mahesh Thursday, January 29, 2015 7:26 AM updated exact exception
    Thursday, January 29, 2015 7:00 AM

All replies

  • Hi D Mahesh-  I am actively working with our Bluetooth people now to get to the bottom of 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.

    Thursday, January 29, 2015 3:35 PM
    Moderator
  • Thanks matt for reply.

    ya sure if requires, i will be ready to share project which contains only connection part.


    Mahesh Daram

    Thursday, January 29, 2015 5:13 PM