Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
717 views
in Technique[技术] by (71.8m points)

c# - How to transfer faster Bluetooth data?

I am using Windows.Devices.Bluetooth library in the Windows forms. Communication between devices is fine, but too slow (I get response after ~150 ms with BT 5.2). I think that the problem is with write command (GattCharacteristic.WriteValueAsync()), because the time from calling this command to his executing is more then 100 ms.

Code:

                var writer = new DataWriter();
                var startCommand = Encoding.ASCII.GetBytes(textBox_write_rawData.Text);

                writer.WriteBytes(startCommand);

                time = DateTime.Now;
                Display("Start time: " + DateTime.Now.ToString());
                GattCommunicationStatus result = await chara.WriteValueAsync(writer.DetachBuffer());

                if (result == GattCommunicationStatus.Success)
                {
                    Display("Message sent successfully!");
                    //time = DateTime.Now;
                    //Display("Start time: " + DateTime.Now.ToString());

                }
                else
                {
                    Display("Error encountered on writing to characteristic!");
                }

Is possible to speed it up?

Thank you for your response!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...