简体   繁体   English

BLE通信数据类型

[英]BLE communication data type

Bluetooth newbie here.蓝牙新手在这里。 Is there a best practice among the data type used for BLE communication?用于 BLE 通信的数据类型是否有最佳实践? In my case I am setting up a ESP32 that acts as Server: it has a single Characteristic with a Notify property, so it repeatedly sends data to all the Clients once they connect (a raspberry pi as Client, in my case).就我而言,我正在设置一个充当服务器的 ESP32:它具有一个带有 Notify 属性的单一特性,因此一旦连接,它就会向所有客户端重复发送数据(在我的例子中,树莓派作为客户端)。 Right know the data exchanged is just bytes (based on the Neil Kolban "BLE_notify" Arduino example ) but it would be great to send Strings or better JSON data .正确知道交换的数据只是字节(基于Neil Kolban “BLE_notify” Arduino 示例),但发送字符串或更好的 JSON 数据会很棒。 Is that possible?那可能吗?

You can send in whatever format you want if you use custom characteristic uuids.如果您使用自定义特征 uuid,您可以以任何您想要的格式发送。 Although generally BLE data transfer is slow so you'd better make your data as compact as possible.虽然通常 BLE 数据传输速度很慢,但您最好使数据尽可能紧凑。 Json might not be the best option here. Json 可能不是这里的最佳选择。 I've not heard of anyone sending json over BLE.我还没有听说有人通过 BLE 发送 json。 Some binary format is what's generally used.一些二进制格式是通常使用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM