Device Info Overview
Welcome to the Device Info documentation for the AIBuds SDK. This section covers reading the device's current information and reported capabilities, adapting to its physical controls, synchronizing or setting its time, reading and changing its language, and requesting the latest storage and media-count information.
Available Features
Get Device Details
Read identity, firmware, connection, advertisement, and runtime information from an AIBuds device
Sync Device Time
Synchronize an AIBuds device clock with the current time
Set Device Time
Set an AIBuds device clock to a specific date and time
Set Device Language
Set the language used by a connected AIBuds device
Query Storage Information
Request and read storage usage information from an AIBuds device
Query Media Count
Request and read media-file counts from an AIBuds device
Implement with AI Assistance
Implement this workflow with AI
Use the official Manage AIBuds Device Information skill to adapt this workflow to your app.
Read and follow https://docs-aibuds.github.io/skills/manage-aibuds-device-info. Use it to implement Manage AIBuds Device Information in this iOS project and verify the result.Getting Started
To interact with device information, follow these steps:
- Connect to Device - Establish a connection with your AIBuds device
- Check Protocol Conformance - Verify the device conforms to
DeviceInfoAPIprotocol - Read or Update Information - Read the available properties directly, or call the appropriate method when information must be refreshed or changed
Key Concepts
Device Information
- Device Details: Read the properties currently exposed by the device, including its identity, firmware, connection state, battery status, device capabilities, hardware configuration, current and supported languages, call status, storage and media state, recording-duration support, AI capabilities, and co-processor model
- Time Management: Synchronize the device with the current time or set a specific time
- Language Settings: Read the current language from
languageSetting, inspectsupportedLanguages, and set a supportedDeviceLanguagevalue - Storage Information: Request the latest storage information, then read used and free space in megabytes from
storageInfo - Media Count: Request the latest media information, then read photo, video, and audio counts from
mediaCountInfo
Protocol Reference
Base identity and connection properties are available through DeviceConvertible. Additional Device Info properties and methods are exposed through DeviceInfoAPI. Before using those additional capabilities, verify that the device conforms to the protocol:
- Swift
- Objective-C
guard let device = device as? DeviceInfoAPI else {
print("Device does not support DeviceInfoAPI")
return
}id<AIBudsDeviceInfoAPI> device = (id<AIBudsDeviceInfoAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceInfoAPI)]) {
NSLog(@"Device does not support AIBudsDeviceInfoAPI");
return;
}Best Practices
- Check Protocol Conformance: Always verify the device supports the
DeviceInfoAPIprotocol before calling methods - Handle Errors: Implement proper error handling in completion handlers
- Background Execution: Wrap UI updates in
DispatchQueue.main.asyncwhen updating from completion handlers - Use Weak Self When Needed: Use
[weak self]when a completion handler captures its owning object and could otherwise create a retain cycle - Read Refreshed Properties After Success: After a storage or media-count request succeeds, read the updated
storageInfoormediaCountInfoproperty - Use Reported Capabilities: Gate optional features with
deviceCapabilities; treatnilas not-yet-known, and usehardwareConfigurationto adapt instructions and controls to the fitted hardware
Notes
- Device information may vary depending on the device model and firmware version
- Some devices may not support all features described in this section
- Check protocol conformance, device-reported capability values, device model, and firmware before exposing a feature in your application