The Advanced Wireless Stereo (AWS) is MediaTek proprietary profile that defines the minimum set of functions such that two devices can transfer the audio data and synchronize the audio status.
More...
The Advanced Wireless Stereo (AWS) is MediaTek proprietary profile that defines the minimum set of functions such that two devices can transfer the audio data and synchronize the audio status.
Terms and Acronyms
| Terms | Details |
| AWS | Advanced Wireless Stereo. |
| SBC | The Low Complexity Sub-Band Coding (SBC) is an audio sub-band codec specified by the Bluetooth Special Interest Group (SIG) for the Advanced Audio Distribution Profile (A2DP). SBC is a digital audio encoder and decoder used to transfer data to Bluetooth audio output devices like headphones or loudspeakers. For more information, please refer to Wikipedia. |
| AAC | Advanced Audio Coding (AAC) is an audio coding standard for lossy digital audio compression. For more information, please refer to Wikipedia. |
How to use this module
This section presents the AWS connection handle and a method to stream and synchronize audio signals.
- 1. Mandatory, implement bt_app_event_callback() to handle the AWS events, such as connect, disconnect, indication and more.
- Sample code:
{
switch (msg_type)
{
{
break;
}
{
break;
}
{
break;
}
default:
{
break;
}
}
}
- 2. Mandatory, connect to a remote device, as shown in figure titled as "AWS connection establishment message sequence" in the Bluetooth developer's guide under the [sdk_root]/doc folder.
- Sample code: Connect to a remote device by passing the remote Bluetooth address and getting the connection handle. The event BT_AWS_CONNECT_CNF captured by bt_app_event_callback() indicates the AWS is connected.
- 3. Mandatory, synchronize the start playing time with the Bluetooth clock, and play the streaming data at same time in both devices, as shown in figure titled as "AWS synchronize the voice message sequence" in the Bluetooth developer's guide under the [sdk_root]/doc folder.
- Sample code:
bt_sink_srv_aws_gpt_cb, (void *)dev);
- 4. Mandatory, disconnect the remote device, as shown in figure titled as "AWS connection release message sequence" in the Bluetooth developer's guide under the [sdk_root]/doc folder.
|
| bt_status_t | bt_aws_connect (uint32_t *handle, bt_bd_addr_t *address) |
| | This function sends an AWS connection request to the remote device. More...
|
| |
| bt_status_t | bt_aws_connect_response (uint32_t handle, bool accept) |
| | This function is a response to the remote device's incoming connection request. More...
|
| |
| bt_status_t | bt_aws_disconnect (uint32_t handle) |
| | This function sends an AWS disconnect request to the remote device. More...
|
| |
| bt_status_t | bt_aws_send_command (uint32_t handle, bt_aws_module_id_t module_id, const uint8_t *data, uint16_t data_length) |
| | This function sends an AWS command to the remote device. More...
|
| |
| bt_status_t | bt_aws_notify_play (uint32_t handle, bt_aws_module_id_t module_id, bt_aws_play_notify_t *notification) |
| | This function sends an AWS notification to the remote device. More...
|
| |
| bt_status_t | bt_aws_get_bt_local_time (bt_aws_clock_t *native_clock) |
| | This function gets the current native clock. More...
|
| |
| bt_status_t | bt_aws_get_curr_bt_time (bt_role_t role, bt_aws_clock_offset_t offset, bt_aws_clock_t *bt_clock) |
| | This function gets the current Bluetooth clock. More...
|
| |
| bt_status_t | bt_aws_get_bt_time_by_local_time (bt_role_t role, bt_aws_clock_offset_t offset, bt_aws_clock_t local_clock, bt_aws_clock_t *bt_clock) |
| | This function gets the current Bluetooth clock. More...
|
| |
| bt_status_t | bt_aws_fetch_bt_time_offset (uint32_t handle) |
| | This function fetches the current Bluetooth clock offset. More...
|
| |
| uint16_t | bt_aws_send_streaming_packet (uint32_t handle, bt_aws_module_id_t module_id, bt_aws_streaming_packet_t *streaming_packet) |
| | This function sends the streaming data to the remote device. More...
|
| |
| uint32_t | bt_aws_get_max_streaming_packet_size (uint32_t handle) |
| | Get the max streaming data length. More...
|
| |
A command request is initiated from a remote device with the bt_aws_command_ind_t payload.
Call #bt_aws_command_response() to accept or reject the request.
The result of a connection attempt initiated by a local or remote device is available with the bt_aws_connect_cnf_t payload.
The result of a disconnect attempt initiated by a local device is available with the bt_aws_disconnect_cnf_t payload.
A disconnect attempt is initiated by a local or remote device or a link loss occurred with the bt_aws_disconnect_ind_t payload.
The notify indication is initiated from a remote device with the #bt_aws_notification_ind_t payload.
| #define BT_AWS_STREAMING_PACKET_RECEIVED_IND (BT_MODULE_AWS | 0x0013) |
| #define BT_AWS_STREAMING_TYPE_A2DP 0X01 |
| #define BT_AWS_STREAMING_TYPE_CUSTOM 0X02 |
This function sends an AWS connection request to the remote device.
The event BT_AWS_CONNECT_CNF returns when the connection request is sent.
- Parameters
-
| [out] | handle | is the channel handle. |
| [in] | address | is the Bluetooth address of a remote device. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed. BT_STATUS_OUT_OF_MEMORY, out of memory.
| bt_status_t bt_aws_connect_response |
( |
uint32_t |
handle, |
|
|
bool |
accept |
|
) |
| |
This function is a response to the remote device's incoming connection request.
Application needs to call this API when getting the event BT_AWS_CONNECT_IND to accept or reject the connection.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
| [in] | accept | is the operation of accepting or rejecting the current connection request. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
This function sends an AWS disconnect request to the remote device.
The event BT_AWS_DISCONNECT_CNF returns the current request's result.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
| bt_status_t bt_aws_fetch_bt_time_offset |
( |
uint32_t |
handle | ) |
|
This function fetches the current Bluetooth clock offset.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
This function gets the current native clock.
- Parameters
-
| [out] | bt_clock | is the native clock. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
This function gets the current Bluetooth clock.
- Parameters
-
| [in] | role | is the Bluetooth role of the current AWS connection. |
| [in] | offset | is the Bluetooth clock offset. |
| [in] | local_clock | is the native clock. |
| [out] | bt_clock | is the native Bluetooth clock. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
This function gets the current Bluetooth clock.
- Parameters
-
| [in] | role | is the Bluetooth role of the current AWS connection. |
| [in] | offset | is the Bluetooth clock offset. |
| [out] | bt_clock | is the native Bluetooth clock. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed.
| uint32_t bt_aws_get_max_streaming_packet_size |
( |
uint32_t |
handle | ) |
|
Get the max streaming data length.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
- Returns
- the max streaming data length.
This function sends an AWS notification to the remote device.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
| [in] | module_id | is the module ID of the current user. |
| [in] | notificaton | is the playing notification to notify the remote device. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed. BT_STATUS_OUT_OF_MEMORY, out of memory.
This function sends an AWS command to the remote device.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
| [in] | module_id | is the module ID of the current user. |
| [in] | data | is the command data to send. |
| [in] | data_length | is the data length. |
- Returns
- BT_STATUS_SUCCESS, the operation completed successfully. BT_STATUS_FAIL, the operation has failed. BT_STATUS_OUT_OF_MEMORY, out of memory.
This function sends the streaming data to the remote device.
- Parameters
-
| [in] | handle | is the handle of the current connection. |
| [in] | module_id | is the module ID of the current user. |
| [in] | streaming_packet | is the streaming data to send. |
- Returns
- the streamed data length.
Bluetooth address of a remote device.
The current Bluetooth clock offset.
The total length of media packet.
The media header pointer.
| uint16_t media_header_len |
The offset of media payload from the whole packet.
The Bluetooth clock in 312.5us units.
The Bluetooth clock in microseconds.
The Bluetooth clock offset in 312.5us units.
The Bluetooth clock offset.
The Bluetooth clock offset in microseconds.
The Bluetooth clock during play.
The play notification settings.
The delay time in microseconds.
The packet sequence number.
The total length of a media packet.