The Bluetooth architecture transfer data in two different ways. They are

  1. Asynchronous Connectionless (ACL)
  2. Synchronous Connection-Oriented (SCO)

Asynchronous Connectionless (ACL)

ACL packets are the basis of communication in Bluetooth. In this method, packets are transmitted without worrying about time slot; This means, two Bluetooth devices, connected as master and slave, can send packets to each other, but neither side expects a packet in any particular time frame. ACL packets are retransmitted automatically if unacknowledged, allowing for correction of a radio link that is subject to interference. This method is used when data is more important than avoiding latency. For example, playing a music, we need high data rate to support high quality music but latency and real time are less important.

Synchronous Connection Oriented (SCO)

In SCO type, packets are used to allow Bluetooth devices to establish a connection with periodically reserved frames for their transmissions and hence there are no retransmissions, but forward error correction can be optionally applied. A SCO link is a set of reserved timeslots on an existing ACL transport. Each device transmits encoded voice data in the reserved timeslot. There are no retransmissions, but forward error correction can be optionally applied. The type of connection are used for voice data. For example, In voice call and video call where we are giving importance to real time and latency; Though it is supports lesser data rate, it is sufficient for speech. This is commonly used to allow car hands-free kits to communicate with mobile phones in the car.

Testing Bluetooth SCO in Android

This section explains the steps to test/check on audio over SCO link. Bluetooth SCO is used in Bluetooth Headset profile or Handsfree profile (BT HSP/HFP). In general, the audio data transferred over the SCO channel can be provided via the normal Host Controller Interface (HCI) hardware driver or via a PCM back-channel. But Voice over HCI is not recommend since it will have a poor quality. So for embedded device (for example a mobile phone), the SCO channel will be directly connected via a PCM interface to the main audio codec. In such as case , this PCM interface has to be supported by Android audio HAL in-order to support Bluetooth SCO connection. For more details about audio basics and android audio framework, please refer this post.

Now once the kernel driver , Android audio HAL and framework are configured correctly Bluetooth SCO audio can be tested by below steps.

  • Check the SCO PCM card details by using below command in adb shell.
   # cat /proc/asound/pcm

In the terminal, you can see the Bluetooth SCO PCM card details. Below is example output of the above command.

00-03: HDMI 0 : HDMI 0 : playback 1
01-00: WM8958 PCM HIFI wm8958-hifi-0 :  : playback 1 : capture 1
01-01: SPDIF PCM dit-hifi-1 :  : playback 1
01-02: BT SCO PCM dit-hifi-2 :  : playback 1 : capture 1
01-03: VOICE CALL PCM wm8958-hifi-3 :  : playback 1 : capture 1

In the above example, BT SCO card details is card ID : 01 Device ID : 02. This is needed in- order to play/capture via BT SCO by using command line application.

  • Now pair any Bluetooth headset in HSP/HFP profile to the Android device.

  • Now download Blueooth SCO test android application to establish SCO connection. If you are developing your own application you need to enable Bluetooth SCO connection first. Below is the code snippet for establishing Bluetooth SCO connection from Android application.

  //Establish the Bluetooth SCO connection
AudioManager mngr = (AudioManager) getSystemService("audio");
  • Now you can play .wav file using Testing in Android via command line
$ tinycap testing_mic.wav -D 1 -d 2 -c 1 -r 8000
$ tinyplay testing_mic.wav -D 1 -d 2

You can refer the source code of tinyplay and tinycap command line application from the below link.

  1. tinyplay.c
  2. tinycap.c
  • Alternatively you can use the default Blueooth SCO test application for playing a pre-recorded audio file from that application.