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!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…