Skip to main content

TWS Overview

The TWS API reports whether a device is a True Wireless Stereo device and whether its TWS connection is currently active.

Available Features

Implement with AI Assistance

Build with AI

Implement this workflow with AI

Use the official Inspect AIBuds TWS State skill to adapt this workflow to your app.

Read and follow https://docs-aibuds.github.io/skills/inspect-aibuds-tws. Use it to implement Inspect AIBuds TWS State in this iOS project and verify the result.
View official skill

Getting Started

  1. Obtain a Device - Use a connected or discovered DeviceConvertible instance.
  2. Check Protocol Conformance - Verify support for DeviceTWSAPI.
  3. Read Device Type - Use isTws.
  4. Read Connection State - Use isTwsConnected and observe connection changes when needed.

Key Concepts

Device Type and Connection

  • isTws identifies whether the device is a TWS device.
  • isTwsConnected reports the current TWS connection snapshot.
  • A TWS device can currently be disconnected, so the two Boolean values are not interchangeable.

Protocol Reference

TWS information is exposed by DeviceTWSAPI:

Swift
guard let device = device as? DeviceTWSAPI else {
    print("Device does not expose TWS information")
    return
}

Best Practices

  1. Check Protocol Conformance: There is no asynchronous TWS support query.
  2. Keep Values Separate: Do not treat a disconnected TWS device as a non-TWS device.
  3. Observe Connection Changes: Implement didTwsConnectionStatusChanged for live UI.

Notes

  • The public protocol does not initiate TWS pairing, connection, or disconnection.
  • The SDK does not define stereo routing or channel behavior through this API.