-
Notifications
You must be signed in to change notification settings - Fork 0
Core Work Status Get Status
Mr.P edited this page Aug 29, 2026
·
2 revisions
Read the device's current WorkState.
- The device is connected
- The device supports
DeviceWorkStateAPI
AIBuds.xcframework
import AIBuds#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>/// The protocol for device work state API.
protocol DeviceWorkStateAPI: DeviceAPI {
/// The current working state of the device.
var workState: WorkState { get }
}/// The protocol for device work state API.
@protocol AIBudsDeviceWorkStateAPI <AIBudsDeviceAPI>
/// The current working state of the device.
@property(nonatomic, readonly) enum AIBudsWorkState workState;
@end| Property | Type | Description |
|---|---|---|
workState |
WorkState / AIBudsWorkState
|
The current working state reported by the device. |
workState is a synchronous read-only property. It does not return a composite status model.
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)")#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);There is no completion handler or error result. Handle unsupported protocol conformance and the unknown or reserved enum cases.
- Read the Property Directly: Do not model this API as an asynchronous status request.
- Treat State as Transient: Re-read it when presenting current device activity.
- Handle Every Enum Case: Work states cover connection, call, playback, capture, transfer, streaming, OTA, shutdown, and test activity.
-
WorkStateis one enum value; it does not contain battery, charging, wear, or playback fields. - The SDK does not define a
WorkStatusresult model orgetWorkStatusmethod.
AIBuds SDK documentation · Full documentation · API Reference
- Introduction
- Getting Started
- Core Concepts
-
Core Features
- Basic Features
- Device Info
- Find Device
- Physical Operations
- Work Mode
- Work Status
- Wear Detection
- Volume Control
- Music Control
- TWS
- Equalizer
- ANC
- Audio
- Camera
- Remote Camera
- File Import
- Teleprompter
- Segment Navigation
- Live Streaming
- Device Applications
- OTA
- Camera OTA
- Service Auth
- AI Services
- Voice Assistant
- Logging
- Advanced Topics
- Releases
- Troubleshooting