问题描述
我是开发带有蓝牙连接到外围设备的移动应用程序的新手.我搜索了GATT是用于蓝牙LE通信的相关配置文件,但是我们的客户建议我们使用UART服务.现在我很困惑1.这两件事是如何关联的2.我们是否必须选择其中之一,如果是,那么每种方法的优缺点是什么.谢谢
旧版蓝牙提供了串行端口配置文件(SPP)-本质上是蓝牙上的串行输入/输出流.
蓝牙低功耗提供了许多配置文件,但最常用的是GATT.GATT公开的特征/属性与您可以读取/写入的变量有点像.读/写限制为20个字节.
许多嵌入式BLE芯片组在BLE GATT上提供"UART仿真".这里使用了一对属性.一个用于读取,另一个用于写入.
中央设备将字节写入'write'属性,然后嵌入式芯片将字节从芯片上的串行端口发送出去.
同样,写入芯片"串行端口并通过"read"属性中的新数据通知发送到中央的数据.
您没有说您正在开发什么平台,但是一个重要的考虑因素是,在iOS上使用SPP要求您的硬件经过Apple的MFi认证,而BLE/GATT则不需要.
I am new to developing a mobile app with bluetooth connection to peripheral device. I searched that GATT is the relevant profile used for bluetoothLE communication but our client recommended that we use UART service. Now I am confused as to1. how these two things are related and2. Do we have to opt for one of these, if so, what are the pros and cons of each. Thanks
Legacy Bluetooth provides the serial port profile (SPP) - This is essentially a serial input/output stream over Bluetooth.
Bluetooth Low Energy provides a number of profiles, but the most commonly used is GATT. GATT exposes characteristics/attributes which are a little like variables that you can read from/write to. A read/write is limited to 20 bytes.
Many embedded BLE chipsets provide a "UART emulation" over BLE GATT. Here a pair of attributes are used; one for read and one for write.
The Central device writes bytes to the 'write' attribute and the embedded chip sends them out of a serial port on the chip.
Similarly, data that is written to the chip's serial port and sent to the central via a notification of new data in the 'read' attribute.
You don't say what platform your are developing on, but one important consideration is that use of SPP on iOS requires your hardware to be MFi certified by Apple, while BLE/GATT does not.
这篇关于GATT配置文件和UART服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!