Skip to main content

Identify a TWS Device

Read the device's TWS identity from the current SDK snapshot.

Prerequisites​

  • You have a DeviceConvertible instance.
  • The device conforms to DeviceTWSAPI.

API Reference​

Framework​

AIBuds.xcframework

Import​

Swift
import AIBuds

Protocol​

Swift
/// The protocol for device True Wireless Stereo (TWS) related API.
protocol DeviceTWSAPI: DeviceAPI {
    /// Indicates whether the device is a True Wireless Stereo (TWS) device.
    var isTws: Bool { get }
}

Properties​

PropertyTypeDescription
isTwsBool / BOOLWhether the device identifies itself as a TWS device.

Usage Examples​

Swift
import AIBuds

guard let device = device as? DeviceTWSAPI else {
    print("TWS information is unavailable")
    return
}

print(device.isTws ? "TWS device" : "Not a TWS device")

Error Handling​

This property has no completion handler. Handle unsupported protocol conformance separately from a valid false value.

Best Practices​

  1. Do Not Collapse Unsupported and False: Missing protocol conformance is not the same as isTws == false.
  2. Use Connection State Separately: Read isTwsConnected only when connection state is relevant.

Notes​

  • This API is a synchronous property read, not a getTWSSupport request.
  • It does not manage TWS pairing.