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

Samra
  • 1,815
  • 4
  • 35
  • 71

1 Answers1

16

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.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • 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? – Samra Jun 24 '16 at 04:42
  • 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 transmissions – Paulw11 Jun 24 '16 at 05:35
  • @Paulw11 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? – Philipp Kyeck Dec 10 '18 at 09:24
  • 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 it – Paulw11 Dec 10 '18 at 09:30