Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GATT over SPP profile for bluetooth communication?

This is confusing me for days.

In the beginning when I was implementing the functionality, I used GATT profile for BLE bluetooth communication.

Then I came up with BluetoothSocket. This uses the SPP profile for bluetooth communication.

There is mentioned:

The most common type of Bluetooth socket is RFCOMM, which is the type supported by the Android APIs. RFCOMM is a connection-oriented, streaming transport over Bluetooth. It is also known as the Serial Port Profile (SPP).

My requirement is -

1) To scan and then connect my android device with the Black Box using BLE bluetooth.

2) Then initiate communication. The bytes will be sent between both.

Any ideas ?

like image 900
My God Avatar asked Jun 10 '14 07:06

My God


People also ask

What is GATT profile in Bluetooth?

GATT is an acronym for the Generic ATTribute Profile, and it defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Services and Characteristics.

What is SPP profile in Bluetooth?

Serial Port Profile (SPP) It's is one of the more fundamental Bluetooth profiles (Bluetooth's original purpose was to replace RS-232 cables after all). Using SPP, each connected device can send and receive data just as if there were RX and TX lines connected between them.

What is SPP and GATT?

FSC-BT836B is a Bluetooth 5.0 dual-mode module, the most feature is high data rate, in SPP mode, the data is up to 85KB/s, while in GATT mode, the data rate is up to 75KB/s (When do test with an iPhone X).

What is GATT and gap in Bluetooth?

GAP defines the general topology of the BLE network stack. GATT describes in detail how attributes (data) are transferred once devices have a dedicated connection.


1 Answers

In the use case that you have mentioned BLE is probably your best bet. This is a Bluetooth 4.0 feature, while SPP is a 2.1 feature. I will try and list out the pros and cons to using BLE with a comparison with SPP.

  • BLE is low energy. It is going to require less energy compared to SPP.
  • BLE is much faster to establish the connection the SPP, so your responses will be much faster.
  • BLE is good only if you want to transfer small amounts of data, once you start transferring large amounts of data, you will find that SPP is a much better candidate.

With this being said, the way you would go about it is in the following way: You will use the BluetoothAdapter to get a reference to a BluetoothDevice, which you will then use to get BluetoothGatt using connectGatt. You will not use BluetoothSocket if you want to use BLE. Using this BluetoothGatt object you can connect to the device and read/write characteristics.

like image 135
Zomb Avatar answered Nov 07 '22 01:11

Zomb