Skip to main content

Configuration

Configure logging, Bluetooth scanning, device connections, and AI services before using the corresponding SDK features.

Basic Configuration

Log Level

Set the log level on the configuration passed to SDK initialization.

Swift
let sdkConfiguration = SDKConfiguration.default()

// Default: .info
// All-in-One uses .verbose only when it creates this configuration for you.
sdkConfiguration.logLevel = .info

let initialized = AIBudsAllInOneSDK.initialize(
    configuration: sdkConfiguration,
    delegate: self
)

guard initialized else {
    print("AIBuds SDK initialization failed.")
    return
}

// Log levels, from most to least verbose:
// .verbose, .debug, .info, .warn, .error, .fatal, .mute

// Modular installation:
// AIBudsSDK.initialize(appDelegate, configuration: sdkConfiguration, delegate: self)

See Quick Start for the modular initialization sequence.

Log Destination

Select the destination through the shared LogConfiguration.

Swift
let logConfig = LogConfiguration.shared

// Default: .xlfacility
logConfig.destination = .console

// Available destinations:
// .console    — Xcode debugger console
// .oslogger   — Unified logging through os_log
// .file       — SDK-managed files on disk
// .xlfacility — XLFacility plugin

// All-in-One installs the XLFacility plugin automatically.
// Modular integrations must install AIBudsSDK/Log/XLFacility explicitly.

See Logging Overview for retention, export, and cleanup.

Advanced Configuration

Bluetooth Configuration

Scan Timeout

Configure the default timeout before initialization, or override it for one scan.

Swift
// Defaults:
// scanTimeoutInSeconds = 10; use 0 for no automatic timeout.
// shouldAutoReconnectWhenAppLaunch = false
// onlyDiscoverKnownDevices = true
let sdkConfiguration = SDKConfiguration.default()
sdkConfiguration.scanTimeoutInSeconds = 15

// 15 overrides the initialized configuration for this scan only.
AIBudsSDK.startScanning(
    NSNumber(value: 15),
    deviceFoundHandler: { device, isExistingDevice in
        // isExistingDevice is true when an existing result was updated.
    },
    completion: {
        // Called when scanning stops.
    }
)

// Use the timeout supplied during SDK initialization.
AIBudsSDK.startScanning(nil)

Connection Parameters

Pass connection-specific values through ConnectParams.

Swift
let params = ConnectParams()
params.userId = currentUserId  // Only when required by the integration.
params.randomCode = devicePairingCode  // Only when required by the device.
params.enableClassicBT = true  // Default: true; false enables BLE-only use.
params.aiAuthParams = aiAuthParams  // Only when required by the AI provider.

device.connect(params)

AI Configuration

Select the provider after installing, registering, and initializing it.

Swift
// 1. Install the provider module.
// 2. Register and initialize the provider with AIBudsAISDK.
// 3. Select the registered provider.
AIBudsAISDK.setAIServiceVendor(.starBurst)

// Other public values:
// .mltcloud
// .none       // No provider is selected.

See Select AI Provider for the complete provider setup.

Next Steps

Now that you have configured the SDK, continue with Core Concepts, use the SDK Glossary for terminology, explore Core Features, or use Common Issues when initialization, scanning, connection, or provider selection does not behave as expected.