Skip to main content

Get Work Status

Read the device's current WorkState.

Prerequisites

  • The device is connected
  • The device supports DeviceWorkStateAPI

API Reference

Framework

AIBuds.xcframework

Import

Swift
import AIBuds

Protocol

Swift
/// The protocol for device work state API.
protocol DeviceWorkStateAPI: DeviceAPI {
    /// The current working state of the device.
    var workState: WorkState { get }
}

Properties

PropertyTypeDescription
workStateWorkState / AIBudsWorkStateThe current working state reported by the device.

Return Value

workState is a synchronous read-only property. It does not return a composite status model.

Usage Examples

Swift
import AIBuds

guard let device = device as? DeviceWorkStateAPI else {
    print("Device does not expose a work state")
    return
}

let state = device.workState
print("Current work state: \(state.description)")

Error Handling

There is no completion handler or error result. Handle unsupported protocol conformance and the unknown or reserved enum cases.

Best Practices

  1. Read the Property Directly: Do not model this API as an asynchronous status request.
  2. Treat State as Transient: Re-read it when presenting current device activity.
  3. Handle Every Enum Case: Work states cover connection, call, playback, capture, transfer, streaming, OTA, shutdown, and test activity.

Notes

  • WorkState is one enum value; it does not contain battery, charging, wear, or playback fields.
  • The SDK does not define a WorkStatus result model or getWorkStatus method.