GATT profile and UART service
Asked Answered
V

1

12

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 to 1. how these two things are related and 2. Do we have to opt for one of these, if so, what are the pros and cons of each. Thanks

Ventricular answered 23/6, 2016 at 1:48 Comment(0)
K
17

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.

Kinghood answered 23/6, 2016 at 3:0 Comment(4)
So, I am not using Legacy Bluetooth but Bluetooth Low Energy, so I should not worry about SPP right? BLE/GATT should be fine? I have to develop for both platforms, android and iOS. Also, since UART provides emulation so i dont have to worry about 20 bytes limitation on GATT, UART would take care of that?Ventricular
You mainly need to worry about in on your iOS/android side; if you have more than 20 bytes to send you need to split it into multiple transmissionsKinghood
@Kinghood UART feels a bit like a shortcut because you are too lazy to declare custom service/charateristics for every datapoint you have - is this correct or is pushing everything over one READ and one WRITE line ok?Patrickpatrilateral
It depends on what your hardware is capable of. Some embedded hardware provides the ability to define custom characteristics. Some doesn’t. Hardware that emulates a serial port is easy to interface with and you can write data using a “print” statement. The downside is that you have to encode your data in some sort of framing so that you can make sense of itKinghood

© 2022 - 2024 — McMap. All rights reserved.