-
Notifications
You must be signed in to change notification settings - Fork 0
Core Work Mode Get Mode
Mr.P edited this page Aug 25, 2026
·
2 revisions
Read the device's current WorkMode value.
- The device is connected and ready
- The device supports
DeviceWorkModeAPI
AIBuds.xcframework
import AIBuds#import <AIBuds/AIBuds.h>
#import <AIBuds/AIBuds-Swift.h>/// The protocol for device work mode API.
protocol DeviceWorkModeAPI: DeviceAPI {
/// The current work mode of the device.
var workMode: WorkMode { get }
}/// The protocol for device work mode API.
@protocol AIBudsDeviceWorkModeAPI <AIBudsDeviceAPI>
/// The current work mode of the device.
@property (nonatomic, readonly) enum AIBudsWorkMode workMode;
@end| Property | Type | Description |
|---|---|---|
workMode |
WorkMode / AIBudsWorkMode
|
The current work mode reported by the device. |
workMode is a synchronous read-only property. It does not use a completion handler.
import AIBuds
guard let device = device as? DeviceWorkModeAPI else {
print("Device does not support work modes")
return
}
switch device.workMode {
case .normal:
print("Normal mode")
case .game:
print("Game mode")
@unknown default:
print("Unknown work mode")
}#import <AIBuds/AIBuds.h>
#import <AIBuds/AIBuds-Swift.h>
id<AIBudsDeviceWorkModeAPI> device = (id<AIBudsDeviceWorkModeAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceWorkModeAPI)]) {
NSLog(@"Device does not support work modes");
return;
}
switch (device.workMode) {
case AIBudsWorkModeNormal:
NSLog(@"Normal mode");
break;
case AIBudsWorkModeGame:
NSLog(@"Game mode");
break;
default:
NSLog(@"Unknown work mode");
break;
}There is no asynchronous error result. Handle missing protocol conformance and unknown enum values.
- Read the Property Directly: Do not create an asynchronous get-work-mode wrapper.
- Handle Unknown Values: Include an unknown/default branch for forward compatibility.
- Observe Device Updates: Refresh UI when the SDK reports a work-mode change through the device delegate.
- The public SDK currently defines
normalandgamework modes. - Changing the mode uses
setWorkMode(_:completion:); it is separate from this read-only property.
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