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].
The HAP addresses the use-case of Hearing Aids control over Bluetooth® Low Energy. It specifies audio preset control, immediate alert notification and requirements for LE Audio profiles.
2. Roles
The HAP introduces four different roles:
- Hearing Aid (HA): Role implemented by hearing aids. Can receive audio stream as Unicast Server and implement Hearing Access Service as Server to allow remote devices to control local audio presets.
- Hearing Aid Unicast Client (HAUC): Connects to hearing aids to stream audio data as Unicast Client. Examples of device implementing this role are smartphones, laptops, media players, TV, tablets, and PCs.
- Hearing Aid Remote Controller (HARC): Connects to hearing aids and control audio presets, volume and microphone status. Implements Hearing Access Service as Client role. Examples of device implementing this role are smartphones, tablets and remote controllers.
- Immediate Alert Client (IAC): Connects to hearing aids to emit alert notification to capture the attention of the hearing aid wearer. Example of devices implementing this role are smartphone , tablets, laptops and home appliances.
The requirements for the four roles are the following:
HAP Role | CAP Roles | BAP Roles | GAP Roles | VCP Roles |
---|---|---|---|---|
Hearing Aid (HA) | Acceptor | Unicast Server | Peripheral | Volume Renderer |
Hearing Aid Unicast Client (HAUC) | Initiator | Unicast Client | Central | None |
Hearing Aid Remote Controller (HARC) | Commander | None | Central | Volume Controller |
Immediate Alert Client (IAC) | None | None | None | None |
3. HAP Advertising
A device implementing HAP with HA role shall put the Hearing Access Service UUID in the Service UUID AD Type field of it's advertising data.
4. Hearing Access Service (HAS)
A device implementing the HA role shall implement the GATT server role with one instance of Hearing Access Service. This service permits remote HARC to control local Audio Presets when connected.
5. Hearing Access Profile application APIs
The following section lists and describes the APIs typically used in a HAP application.
5.1. HAP HA APIs
The following APIs are available for the HAP in HA Role:
HAP_Init | Initialize the Hearing Access Profile with the selected role(s) |
HAP_HA_BuildAdvPacket | Build HAP HA advertising packet with the concatenation of CAP Advertising data, HAS UUID and Appearance |
HAP_HA_SetHearingAidFeatures | Set the local Hearing Aids Features value |
HAP_HA_AddPreset | Add a new local preset |
HAP_HA_RemovePreset | Remove a local preset |
HAP_HA_SetPresetAvailability | Set the availability value of a local preset |
HAP_HA_EditPreset | Edit a local preset |
HAP_HA_SetActivePresetIndex | Set the local Active Preset Index value |
HAP_HA_DB_IsPresent | Indicate if HAP HA Database is saved in NVM |
HAP_HA_DB_RemoveServicesRecord | Remove the record of the HAP HA stored in NVM |
5.2. HAP HAUC APIs
There are no HAP HAUC specific APIs, refer to CAP Unicast Client APIs.
5.3. HAP HARC APIs
The following APIs are available for the HAP in HARC Role:
HAP_Init | Initialize the Hearing Access Profile with the selected roles |
HAP_Linkup | Link Up the HAP Client roles with remote HAP HA |
HAP_HARC_ReadHAFeatures | Read the remote Hearing Aid Features |
HAP_HARC_ReadActivePresetIndex | Read the remote Active Preset Index |
HAP_HARC_ReadPresetsRequest | Send a requests to read remote HAP Server presets |
HAP_HARC_WritePresetName | Send a Write Preset Name command |
HAP_HARC_SetActivePreset | Set preset with specified index on remote HAP Server |
HAP_HARC_SetNextPreset | Set next preset on remote HAP Server |
HAP_HARC_SetPreviousPreset | Set previous preset on remote HAP Server |
HAP_HARC_DB_IsPresent | Indicate if HAP HARC Database is saved in NVM |
HAP_HARC_DB_RemoveServicesRecord | Remove the record of the HAP HARC stored in NVM |
5.4. HAP IAC APIs
The following APIs are available for the HAP in HA Role:
HAP_Init | Initialize the Hearing Access Profile with the selected roles |
HAP_Linkup | Link Up the HAP Client roles with remote HAP HA |
HAP_IAC_SetAlertLevel | Set Alert Level on remote Immediate Alert Server |
HAP_IAC_DB_IsPresent | Indicate if HAP IAC Database is saved in NVM |
HAP_IAC_DB_RemoveServicesRecord | Remove the record of the HAP IAC stored in the NVM |
5.5. 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_Role_t role = HAP_ROLE_HEARING_AID;
HAP_Init(role);
5.5.1. Linkup remote HAP server
To perform linkup on a remote HAP server as HAP HARC, 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, HAP_HARC_HA_FEATURES_EVT and HAP_HARC_ACTIVE_PRESET_INDEX_EVT events are generated:
void HAP_Notification(HAP_Notification_Evt_t *pNotification)
{
switch(pNotification->EvtOpcode)
{
case HAP_LINKUP_COMPLETE_EVT:
{
break;
}
case HAP_HARC_HA_FEATURES_EVT:
{
HAP_HA_Features_t ha_features = pNotification->pInfo[0];
break;
}
case HAP_HARC_ACTIVE_PRESET_INDEX_EVT:
{
uint8_t active_preset_index = pNotification->pInfo[0];
break;
}
}
}
6. HAP demonstrator using STM32WBA
The STM32WBA cube firmware allows to easily build and deploy HAP Peripheral and HAP Central applications.
6.1. Project architecture
The figure below represents the firmware architecture of the HAP Peripheral/Central example projects inside STM32CubeWBA MCU package.
The two HAP projects present in STM32WBA cube firmware implement a menu displayed on the OLED Screen of the STM32WBA55G-DK.
6.2.1. HAP Peripheral screens
The following diagram show and describes the screens on the HAP Peripheral application:
6.2.2. HAP Central Screens
The following diagram show and describes the screens on the HAP Central application:
6.2.3. Audio streaming state screen
On the two HAP applications, the screens displays the status of the audio stream when connected. The following table describes each possible screen:
6.3. Unicast Demo using two STM32WBA
6.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
6.3.2. Setup
6.3.3. Operate demonstrator
The two projects integrate a menu permitting to operate the demonstrator.
1. To establish the connection between the two STM32WBAs, press the right direction on the joystick of the HAP Peripheral and select "Start Adv." to start advertising, then press the right direction on the joystick of the HAP Central and select "Start Scan" to start scanning. Select your device in the list and press the right direction to initiate the connection.
2. Once the linkup is done on each side, access the menu using the right direction of the joystick
- To start or stop an audio stream, navigate to the “Audio stream” submenu on the HAP Central target and select the desired item list
- To operate the HAP Central volume, navigate to the “Local volume” on the HAP Central target
- To operate the HAP Peripheral volume, navigate to the “Remote Volume” submenu on the HAP Central target, or navigate to the “Volume” submenu on the HAP Peripheral target
- To control the HAP Peripheral microphone mute status, navigate to the “Microphone” submenu on the HAP Central or Peripheral target
- To control the HAP Peripheral active preset, navigate to the “Preset” submenu on the HAP Central or Peripheral target
The following configurations are used in the HAP Central project:
Configuration | BAP audio configuration | Legend | Codec configuration |
---|---|---|---|
Media | 6 | -------> -------> |
24_2 |
Telephony | 3 | <-------> | 16_2 |
7. References