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
Identify a TWS Device
Read whether the device identifies itself as a True Wireless Stereo device
View TWS Connection State
Read the current TWS connection state
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.Getting Started
- Obtain a Device - Use a connected or discovered
DeviceConvertibleinstance. - Check Protocol Conformance - Verify support for
DeviceTWSAPI. - Read Device Type - Use
isTws. - Read Connection State - Use
isTwsConnectedand observe connection changes when needed.
Key Concepts
Device Type and Connection
isTwsidentifies whether the device is a TWS device.isTwsConnectedreports 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
- Objective-C
guard let device = device as? DeviceTWSAPI else {
print("Device does not expose TWS information")
return
}id<AIBudsDeviceTWSAPI> device = (id<AIBudsDeviceTWSAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceTWSAPI)]) {
NSLog(@"Device does not expose TWS information");
return;
}Best Practices
- Check Protocol Conformance: There is no asynchronous TWS support query.
- Keep Values Separate: Do not treat a disconnected TWS device as a non-TWS device.
- Observe Connection Changes: Implement
didTwsConnectionStatusChangedfor 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.