Skip to content

Core Work Status Get Status

Mr.P edited this page Aug 29, 2026 · 2 revisions

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

Objective-C

#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>

Protocol

Swift

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

Objective-C

/// The protocol for device work state API.
@protocol AIBudsDeviceWorkStateAPI <AIBudsDeviceAPI>
/// The current working state of the device.
@property(nonatomic, readonly) enum AIBudsWorkState workState;
@end

Properties

Property Type Description
workState WorkState / AIBudsWorkState The 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)")

Objective-C

#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>

id<AIBudsDeviceWorkStateAPI> device = (id<AIBudsDeviceWorkStateAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceWorkStateAPI)]) {
    NSLog(@"Device does not expose a work state");
    return;
}

NSLog(@"Current work state raw value: %ld", (long)device.workState);

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.

AIBuds SDK iOS Wiki

Clone this wiki locally