[UWP] [C#]蓝牙LE - 传输完成后检查 [英] [UWP][C#] Bluetooth LE - check when transfer is finished

查看:252
本文介绍了[UWP] [C#]蓝牙LE - 传输完成后检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我只是想让一个应用程序使用蓝牙文件运行。

我有一个蓝牙LE USB加密狗和一个设备正在接收数据。


我成功地将数据(大约100kB)发送到我的设备。我这样做是使用:
$
var result = await selectedCharacteristic.WriteValueWithResultAsync(buffer,GattWriteOption.WriteWithoutResponse);


现在我有2个问题:


1。如何获取有关我能通过gatt发送多少字节的信息?目前我可以发送20个字节的块,其中有4个。例如,蓝牙5应该有更多的字节可用(到目前为止我知道)。有没有比硬编码20
字节块更好的方法?


2。当我发送100kB数据时,写入功能在几秒钟后完成,但蓝牙传输仍在进行大约一分钟。如何检查转移何时完成?似乎某个地方的数据是缓冲的,但仍然没有通过蓝牙传输
。我想制作一个进度条,为此我需要知道数据何时真正转移。


提前致谢,


Joachim

解决方案

嗨  jojo78,


欢迎来到
开发通用Windows应用论坛
!请使用  标记 
发布到此论坛时,谢谢!


我试图让熟悉此问题的人参与其中,可能会有一些时间延迟,感谢您的耐心等待。


祝你好运,


微风


Hello,

I am just trying to get an app running using bluetooth le.
I have an Bluetooth LE USB Dongle and an device which is receiving the data.

I succesfully managed to send data (about 100kB) to my device. I do this using:
var result = await selectedCharacteristic.WriteValueWithResultAsync(buffer, GattWriteOption.WriteWithoutResponse);

Now I have 2 questions:

1. How do I get infomation about how many bytes I am able to send through gatt? Currently I can send chunks of 20 bytes with ble 4. With Bluetooth 5 for example there should be more bytes possible (so far I know). Is there a better way than hardcoding 20 byte chunks?

2. When I send 100kB of data, the write functions are finished after a few seconds, but the bluetooth transfer is still ongoing for about a minute. How can I check when the transfer is finished? It seems like somewhere the data is buffered, but still not transfered over bluetooth. I want to make an progress bar and for that I need to know when the data is really transfered.

Thanks in advance,

Joachim

解决方案

Hi jojo78,

Welcome to the Developing Universal Windows apps forum! Please utilize tagging when posting to this forum, thanks!

I am trying to involve someone who is familiar with this issue to look into it, there might some time delay, appreciate your patience.

Best regards,

Breeze


这篇关于[UWP] [C#]蓝牙LE - 传输完成后检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆