none
[W8.1] Windows store app + Trans Logik Bluetooth Device Integration RRS feed

  • Question

  • Hi All, 

            I have been developing windows store app. Now i want bluetooth intregration external bluetooth device.

    An external bluetooth device called Trans Logik. Which is read the tread and pressure on vehicle tires. The Windows store app receive what bluetooth device sending the measurements. How do achieve it ?

    Thanks

    Sarathi



    Tuesday, June 9, 2015 8:53 AM

All replies

  • There's a Bluetooth sample located here:
    https://code.msdn.microsoft.com/windowsapps/Bluetooth-Rfcomm-Chat-afcee559

    It will show you how to communicate using sockets with another machine. 


    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, June 9, 2015 7:18 PM
    Moderator
  • Hi Matt,

              Thanks for reply. I have used Translogik probe (bluetooth enabled device). I need to receive the commands from Translogik probe to my windows store app. the above sample which you given is communicated different machine ( windows store app to windows phone app). My case is translogik probe to windows store app. 

    i was tried same sample of above, i replace my service id 

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

    than i can connect my translogik probe from my windows store app.

    But the issue is upon receive request from bluetooth device 

        uint actualStringLength = await chatReader.LoadAsync(stringLength); line always getting index out of range exceptions.

            private async void ReceiveStringLoop(DataReader chatReader)

                   

            {
                try
                {
                    uint size = await chatReader.LoadAsync(sizeof(uint));
                    if (size < sizeof(uint))
                    {
                        // The underlying socket was closed before we were able to read the whole data
                        return;
                    }
    uint stringLength = chatReader.ReadUInt32();
                    uint actualStringLength = await chatReader.LoadAsync(stringLength);
                    if (actualStringLength != stringLength)
                    {
                        // The underlying socket was closed before we were able to read the whole data
                        return;
                    }

                    ConversationList.Items.Add("Received: \"" + chatReader.ReadString(stringLength) + "\"");

                    ReceiveStringLoop(chatReader);
                }
                catch (Exception ex)
                {
                    lock (this)
                    {
                        if (chatSocket == null)
                        {
                            // Do not print anything here -  the user closed the socket.
                        }
                        else
                        {
                            MainPage.Current.NotifyUser("Read stream failed with error: " + ex.Message, NotifyType.ErrorMessage);
                            Disconnect();
                        }
                    }
                }
            }

    Translogik probe bluetooth device send any one below types the data format

    8-Bit ASCII, 8-Bit Binary, 10-Bit ASCII and 10-Bit Binary

    Please give the your input on this..


     



    Thursday, June 11, 2015 8:02 AM