![]() |
Coming soon |
1. Telephony & Media Audio Profile
1.1. Introduction
The Telephony and Media Audio Profile is a BLE Audio profile specified by the Bluetooth SIG. It's categorized as a "use-case profile", meaning that it's a high-layer profile designed for a specific use case. The complete specification can be found on the Bluetooth SIG website[1]. Location of PBP inside BLE Audio Profiles architecture
The TMAP addresses the use-cases of Telephony and Media over BLE Audio. This covers Broadcast audio, where audio data is “broadcasted” from a Broadcast Source to an unlimited number of Broadcast Sinks, using Broadcast Isochronous Streams. It also covers the Unicast audio, where audio is streamed between two connected devices, allowing bidirectional streams and more efficient acknowledgement. For more details about Unicast and Broadcast features, see the wiki page "Introduction to Bluetooth LE Audio"[2].
1.2. Roles
The TMAP introduces 6 different roles:
- Call Gateway: Based on the BAP Unicast Client, it concerns devices connected to networks used for telephony or VoIP applications. Example of devices implementing this role are smartphones, laptops, tablets, and PCs.
- Call Terminal: Based on the BAP Unicast Server, it concerns devices rendering audio for telephony and VoIP applications. Examples of devices implementing this role are earbuds, headphones, headsets, and speakers.
- Unicast Media Sender: Based on the BAP Unicast Client, it concerns devices able to send media audio content using Unicast. Example of devices implementing this role are smartphones, laptops, media players, TV, tablets, and PCs.
- Unicast Media Receiver: Based on the BAP Unicast Server, it concerns devices rendering audio for media streams using Unicast. Examples of devices implementing this role are earbuds, headphones, headsets, and speakers.
- Broadcast Media Sender: Based on the BAP Unicast Client, it concerns devices able to send media audio content using Broadcast. Example of devices implementing this role are smartphones, laptops, media players, TV, tablets, and PCs.
- Broadcast Media Receiver: Based on the BAP Unicast Server, it concerns devices rendering audio for media streams using Broadcast. Examples of devices implementing this role are earbuds, headphones, headsets, and speakers.
The requirements for the 6 roles are the following:
TMAP Role | CAP Roles | BAP Roles | GAP Roles | VCP Roles |
---|---|---|---|---|
Call Gateway | Initiator & Commander | Unicast Client | Central | Volume Controller |
Call Terminal | Acceptor | Unicast Server | Observer & Peripheral | Volume Renderer |
Unicast Media Sender | Initiator & Commander | Unicast Client | Central | Volume Controller |
Unicast Media Receiver | Acceptor | Unicast Server | Peripheral | Volume Controller |
Broadcast Media Sender | Initiator | Broadcast Source | Broadcaster | |
Broadcast Media Receiver | Acceptor | Broadcast Sink & Scan Delegator | Observer & Peripheral | Volume Controller |
1.3. TMAP Announcement
A device implementing a TMAP role shall put a bitfield of the TMAP roles supported it in the advertising data.
1.4. Telephony And Media Audio Service (TMAS)
A device implementing a TMAP role (except for BMS role) shall implement the GATT Server role with one instance of Telephony and Media Service (TMAS). This service permits a remote TMA Client to retrieve the roles of the device upon connection.
2. Telephony and Media Audio Profile Application APIs
The following section lists and describes APIs typically Used in a TMAP Application.
2.1. TMAP APIs
The following APIs are available for the TMAP:
TMAP_Init | Initialize the Telephony and Media Audio Profile with the selected role(s) |
TMAP_Linkup | Link Up the TMAP Client with remote TMAP Server. |
TMAP_DB_IsPresent | Indicate if a TMAP Database is saved in NVM |
TMAP_BuildAdvPacket | Build Advertising Packet for TMAP Peripheral |
TMAP_ReadRemoteTMAPRole | Read the remote TMAP Role Value |
2.1.1. TMAP Initialization
1. First initialize the Use-case Device Management module:
USECASE_DEV_MGMT_Init();
2. Then, initialize the TMAP with a TMAP_Config_t structure containing the desired role(s), the maximum number of links and a pointer to a RAM section that will contain the TMAP data:
static uint32_t aTMAPMemBuffer[DIVC(TMAP_DYN_ALLOC_SIZE,4)];
TMAP_Config_t tmap_config;
tmap_config.Role = Role;
tmap_config.MaxNumBleLinks = CFG_BLE_NUM_LINK;
tmap_config.pStartRamAddr = (uint8_t *)&aTMAPMemBuffer;
tmap_config.RamSize = TMAP_DYN_ALLOC_SIZE;
TMAP_Init(&tmap_config);
3. When implementing the CT or the UMR roles, mandatory Published Audio Capabilities (PAC) must be registered using the following APIs:
CAP_RegisterSnkPACRecord(&aSnkPACRecord,&aSnkPACRecordHandle);
CAP_RegisterSrcPACRecord(&aSrcPACRecord,&aSrcPACRecordHandle);
2.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 TMAP link is present in NVM from a previous connection*/
if (TMAP_DB_IsPresent(p_conn->Peer_Address_Type,p_conn->Peer_Address) == 0)
{
TMAP_Linkup(ConnHandle, TMAP_LINKUP_MODE_COMPLETE);
}
else
{
TMAP_Linkup(pNotification->ConnHandle,TMAP_LINKUP_MODE_RESTORE);
}
During the Linkup process, the TMAP_REM_ROLE_VALUE_EVT and TMAP_LINKUP_COMPLETE_EVT events will be generated:
void TMAP_Notification(TMAP_Notification_Evt_t *pNotification)
{
switch(pNotification->EvtOpcode)
{
case TMAP_LINKUP_COMPLETE_EVT:
{
break;
}
case TMAP_REM_ROLE_VALUE_EVT:
{
uint16_t *tmap_role = (uint16_t *) pNotification->pInfo;
break;
}
}
}
2.2. Audio Stream Management APIs
The following APIs are used by TMAP Applications to manage audio streams:
API | BAP Role(s) | Description |
---|---|---|
CAP_Unicast_AudioStart | Unicast Client | Configure and Start a Broadcast Source with the given parameters. |
CAP_Unicast_AudioStop | Unicast Client | Stop a Broadcast Source and go to Configured or Idle State. |
CAP_Broadcast_AudioStart | Broadcast Source | Configure and Start a Broadcast Source with the given parameters. |
CAP_Broadcast_AudioStop | Broadcast Source | Stop a Broadcast Source and go to Configured or Idle State. |
CAP_SetSnkAudioLocations | Unicast Server / Scan Delegator | Set/Update the supported Sink Audio Locations. |
CAP_SetSrcAudioLocations | Unicast Server / Scan Delegator | Set/Update the supported Source Audio Locations. |
CAP_RegisterSnkPACRecord | Unicast Server / Scan Delegator | Register Published Audio Capabilities Record for Audio Sink role. |
CAP_RegisterSrcPACRecord | Unicast Server / Scan Delegator | Register Published Audio Capabilities Record for Audio Source role. |
CAP_SetSupportedAudioContexts | Unicast Server / Scan Delegator | Set/Update supported audio context for reception and transmission. |
CAP_SetAvailableAudioContexts | Unicast Server / Scan Delegator | Set/Update available audio context for reception and transmission. |
CAP_RegisterAudioChannels | Unicast Server / Scan Delegator | Register Sink/Source Audio Channels (and associated Audio Stream Endpoint) supported by Unicast Server. |
For more details about the Audio Stream management procedures, see the Architecture and Integration wiki page[3].
2.3. Volume Control Management APIs
The following APIs are used by TMAP Applications to manage Volume Control:
API | VCP Role(s) | Description |
---|---|---|
VCP_RENDER_SetAbsVolume | Volume Renderer | Set the Absolute Volume of the local volume renderer |
VCP_RENDER_SetMuteState | Volume Renderer | Set the Mute value of the local volume renderer. |
CAP_VolumeController_StartSetVolumeProcedure | Volume Controller | Start procedure to change the volume level on all the Acceptors of the Coordinated Set acting in the VCP Volume Renderer role. |
CAP_VolumeController_StartSetVolumeMuteStateProcedure | Volume Controller | Start the procedure to change the (Volume) mute state on all the Acceptors of the Coordinated Set acting in the VCP Volume Renderer role. |
For more details about the Audio Stream management procedures, see the Architecture and Integration wiki page[4].
2.4. Media Control Management APIs
The following APIs are used by TMAP Applications to manage Media Control:
API | MCP Role(s) | Description |
---|---|---|
MCP_SERVER_SetTrackTitle | MCP Server | Set the title of the current track. |
MCP_SERVER_SetTrackDuration | MCP Server | Set the length of the current track. |
MCP_SERVER_SetTrackPosition | MCP Server | Set the current track position of the current track. |
MCP_SERVER_NotifyTrackChanged | MCP Server | Notify the remote MCP Client that the track has changed. |
MCP_CLIENT_MoveNextTrack | MCP Client | Request the remote MCP Server to move to the next track. |
MCP_CLIENT_MovePreviousTrack | MCP Client | Request the remote MCP Server to move to the previous track. |
MCP_CLIENT_PlayTrack | MCP Client | Request the remote MCP Server to start playing the current track. |
MCP_CLIENT_PauseTrack | MCP Client | Request the remote MCP Server to pause the playing current track. |
MCP_CLIENT_ConfigureTrackTitleNotification | MCP Client | Configure the Track Title update Notification. |
For more details about the Media Control management procedures, see the Architecture and Integration wiki page[5].
2.5. Call Control Management APIs
The following APIs are used by TMAP Applications to manage Call Control:
API | CCP Role(s) | Description |
---|---|---|
CCP_SERVER_SetActiveCall | CCP Server | Set the current track position of the current track. |
CCP_SERVER_TerminateCall | CCP Server | Notify the remote MCP Client that the track has changed. |
CCP_CLIENT_AnswerIncomingCall | CCP Client | Set the title of the current track. |
CCP_CLIENT_TerminateCall | CCP Client | Set the length of the current track. |
For more details about the Media Control management procedures, see the Architecture and Integration wiki page[5].
3. PBP Demonstrator using STM32WBA
The STM32WBA Cube firmware allows to easily build and deploy Public Broadcast Sources and Public Broadcast Sinks applications.
3.1. Hardware required
The PBP demonstrator requires the following hardware:
- 3x STM32WBA55G-DK1 Boards
- 2x Music Source with a 3.5mm jack output (Laptop or Smartphone with a jack output). If a laptop is used as a source, use a Ground Loop isolator device or run the laptop on battery to avoid Ground issue
- 1x Music renderer with 3.5mm jack input (Headphones or Speakers)
3.2. Setup
The setup is as following:
PBP Demonstrator Setup |
---|
3.3. Project architecture
The figure below represents the Firmware Architecture of the Public Broadcast Profile example projects inside STM32CubeWBA MCU Package.
STM32WBA PBP Firmware Architecture |
---|
3.4. PBP Source configuration
Following is a summary of the main changes possible on the PBP_Source project
PBP_Source project configuration |
---|
Setting | File | Description |
---|---|---|
BROADCAST_SOURCE_BAP_CONFIG | pbp_app.c | Configuration index in BroadcastQoSConf array. 0 corresponds to 8_2_1 configuration, 1 to 8_2_2, … Commonly used values are 3 (16_2_1 config), 5 (24_2_1 config), and 13 (48_4_1 config). For more details about the configurations, refer to the Introduction to Bluetooth LE Audio wiki page. |
BROADCAST_SOURCE_FRAME_BLOCK_PER_SDU | pbp_app.c | Number of concatenated codec frames sent at the same time. May be 1 or 2. Setting it to 2 reduces the number of events needed to send the packets which can improve reliability but increase the latency. |
BROADCAST_SOURCE_NUM_BIS | pbp_app.c | Number of BIS used for the Broadcast Source. May be 1 or 2. Setting it to 1 reduces the number of events needed to send the packets which can improve reliability but a value of 2 reduces the strain on Sink devices synchronizing to mono audio. |
BROADCAST_SOURCE_CHANNEL_ALLOC_1 | pbp_app.c | Audio Channel Allocation of BIS #1. Bitfield of Audio Location values. Commonly used values are 0x01 for "Front Left" location or 0x03 for "Front Left + Front Right" location. |
BROADCAST_SOURCE_CHANNEL_ALLOC_2 | pbp_app.c | Audio Channel Allocation of BIS #2. Bitfield of Audio Location values. Commonly used value is 0x02 for "Front Right". Ignored if "BROADCAST_SOURCE_NUM_BIS" is 1. |
BROADCAST_CONTROLLER_DELAY | pbp_app.c | Controller delay value. Refer to "STM32WBA LC3 codec and audio data path" wiki page[3] |
BAP_BROADCAST_MAX_TRANSPORT_LATENCY | pbp_app.c | Maximum Transport Latency value. Refer to "STM32WBA LC3 codec and audio data path" wiki page[3] |
BAP_BROADCAST_ENCRYPTION | pbp_app.c | 1 to enable broadcast encryption, 0 to disable it |
BIG_HANDLE | pbp_app.c | Handle of the BIG used for the Broadcast |
STREAMING_AUDIO_CONTEXT | pbp_app.c | Audio Context Type of the Broadcast Source. Common values are AUDIO_CONTEXT_MEDIA (0x0004) and AUDIO_CONTEXT_CONVERSATIONAL (0x0002). Refer to Assigned Numbers section 6.12.3 for more details[6] |
APPEARANCE | pbp_app.c | Appearance value of the Broadcast. Describe the physical appearance of the device. Refer to Assigned Number section 2.6 for more details[6] |
BROADCAST_NAME_LENGTH | pbp_app.c | Length of the Broadcast Name |
aPBPAPP_BroadcastCode | pbp_app.c | Broadcast Code used when BAP_BROADCAST_ENCRYPTION is set to 1. Broadcast Sinks will have to know the Broadcast Code in order to decrypt the stream |
aPBPAPP_BroadcastName | pbp_app.c | Broadcast Name as described in 1.3 |
BAP_BROADCAST_SOURCE_ID | pbp_app.h | ID of the Broadcast Source. This value is ST specific and permits the PBP Sink to identify the PBP Source with a custom static identifier. Not to be confused with the Broadcast ID which is generated randomly by the BAP layer at Broadcast Source creation. |
3.5. PBP Sink configuration
Following is a summary of the main modification possible on the PBP_Sink project
PBP_Sink project configuration |
---|
Setting | File | Description |
---|---|---|
BROADCAST_CONTROLLER_DELAY | pbp_app.c | Controller delay value. Refer to "STM32WBA LC3 codec and audio data path" wiki page[3] |
BAP_BROADCAST_ENCRYPTION | pbp_app.c | 1 to enable broadcast decryption, 0 to disable it |
BIG_HANDLE | pbp_app.c | Handle of the BIG used for the Broadcast |
aPBPAPP_BroadcastCode | pbp_app.c | Broadcast Code used when BAP_BROADCAST_ENCRYPTION is set to 1. Broadcast Code must match the one set on the PBP Source |
aSourceIdList | pbp_app.c | List of Source IDs to cycle through using the joystick |
3.6. PBP Source Advertising details
The following schematic details the content of a Public Broadcast Source advertising Data.
Detail of PBP Source Advertising Data |
---|
4. References
- ↑ Public Broadcast Profile Specification
- ↑ Introduction to Bluetooth LE Audio
- ↑ 3.0 3.1 3.2 3.3 Bluetooth LE Audio - STM32WBA Architecture and Integration - Audio Stream Transition Procedures Cite error: Invalid
<ref>
tag; name "AudioLatency" defined multiple times with different content - ↑ Bluetooth LE Audio - STM32WBA Architecture and Integration - Volume Control Procedures
- ↑ 5.0 5.1 Bluetooth LE Audio - STM32WBA Architecture and Integration - Content Control
- ↑ 6.0 6.1 Bluetooth® Assigned Numbers