Bluetooth® Low Energy audio - Hearing Access Profile

Revision as of 09:31, 24 May 2024 by Registered User


1. Introduction

The Hearing Access Profile is a Bluetooth® Low Energy Audio Profile specified by the Bluetooth SIG. It is categorized as a "use-case profile", meaning that it is a high-layer profile designed for a specific use case. The complete specification can be found on the Bluetooth SIG website[1]. Location of TMAP inside Bluetooth® Low Energy Audio Profiles architecture For more details about unicast and broadcast features, see the wiki page "Introduction to Bluetooth® Low Energy Audio"[2].

2. Roles

3. Hearing Access Service (HAS)

4. Hearing Access Profile application APIs

The following section lists and describes the APIs typically used in a TMAP application.

4.1. HAP APIs

The following APIs are available for the HAP:

HAP_Init Initialize the Hearing Access Profile with the selected roles
HAP_Linkup Link up the HAP client with the remote TMAP server.
HAP_DB_IsPresent Indicate if a HAP database is saved in NVM

4.1.1. HAP initialization

1. First initialize the use-case device management module:

USECASE_DEV_MGMT_Init();

2. Then, initialize the HAP with a HAP_Role_t bitfield:

HAP_Init(role);

4.1.2. Linkup remote TMAP server

To perform linkup on a remote TMAP server, use the dedicated API. If a database is already present, use the Restore mode.

/* Check if HAP link is present in NVM from a previous connection*/
if (HAP_DB_IsPresent(p_conn->Peer_Address_Type,p_conn->Peer_Address) == 0)
{
  HAP_Linkup(ConnHandle, HAP_LINKUP_MODE_COMPLETE);
}
else
{
  HAP_Linkup(pNotification->ConnHandle,HAP_LINKUP_MODE_RESTORE);
}

During the linkup process, the HAP_LINKUP_COMPLETE_EVT events are generated:

void HAP_Notification(HAP_Notification_Evt_t *pNotification)
{
  switch(pNotification->EvtOpcode)
  {
    case HAP_LINKUP_COMPLETE_EVT:
    {
      break;
    }
  }
}

5. TMAP demonstrator using STM32WBA

The STM32WBA cube firmware allows to easily build and deploy TMAP Peripheral and TMAP Central applications.

5.1. Project architecture

The figure below represents the firmware architecture of the HAP Peripheral/Central example projects inside STM32CubeWBA MCU package. TMAP projects file architecture

5.2. TMAP demonstrator menus

The two TMAP projects present in STM32WBA cube firmware implement a menu displayed on the OLED Screen of the STM32WBA55G-DK.

5.2.1. TMAP Peripheral screens

The following diagram show and describes the screens on the TMAP Peripheral application: TMAP Peripheral screens

5.2.2. TMAP Central Screens

The following diagram show and describes the screens on the TMAP Central application: TMAP Central Screens

5.2.3. Audio streaming state screen

On the two TMAP applications, the screens displays the status of the audio stream when connected. The following table describes each possible screen:

No stream screen Displayed when a remote device is connected but no audio stream is established
Unidirectional Sink stream screen Displayed when a unidirectional stream is established with sink role
Unidirectional source stream screen Displayed when a unidirectional stream is established with source role
Bidirectional stream screen Displayed when a bidirectional stream is established (source + sink)

5.3. Unicast Demo using two STM32WBA

5.3.1. Hardware required

This demonstrator requires the following hardware:

  • 2x STM32WBA55G-DK boards
  • 1x Headphones/Headset with a 3.5mm jack cable, optionally with a microphone in which case the jack is 4-pin.

Additionally, as an audio source on the HAP Central side, one of the following can be used:

  • 1x music source with a 3.5mm jack output (Laptop or smartphone with a jack output). If the music source is powered using a power supply, use a Ground Loop isolator device or run the laptop on a battery to avoid Ground Loop issues
  • 1x headset with microphone

5.3.2. Setup

The setup is as following: HAP demonstrator setup (two STM32WBA)

5.3.3. Operate demonstrator

6. References