Yapılandırma
İlgili SDK özelliklerini kullanmadan önce günlük kaydını, Bluetooth taramasını, cihaz bağlantılarını ve AI hizmetlerini yapılandırın.
Temel Yapılandırma
Günlük Düzeyi
SDK başlatılırken iletilen yapılandırmada günlük düzeyini belirleyin.
- Swift
- Objective-C
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)AIBudsSDKConfiguration *sdkConfiguration = [AIBudsSDKConfiguration defaultConfiguration];
// Default: AIBudsLogLevelInfo
// All-in-One uses Verbose only when it creates this configuration for you.
sdkConfiguration.logLevel = AIBudsLogLevelInfo;
BOOL initialized = [AIBudsAllInOneSDK initWithConfiguration:sdkConfiguration delegate:self];
if (!initialized) {
NSLog(@"AIBuds SDK initialization failed.");
return;
}
// Log levels, from most to least verbose:
// Verbose, Debug, Info, Warn, Error, Fatal, and MuteModüler başlatma sırası için Hızlı Başlangıç bölümüne bakın.
Günlük Hedefi
Günlük hedefini ortak LogConfiguration üzerinden seçin.
- Swift
- Objective-C
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.AIBudsLogConfiguration *logConfig = [AIBudsLogConfiguration shared];
// Default: AIBudsLogDestinationXlfacility
logConfig.destination = AIBudsLogDestinationConsole;
// Available destinations:
// Console, Oslogger, File, and Xlfacility
// All-in-One installs the XLFacility plugin automatically.
// Modular integrations must install AIBudsSDK/Log/XLFacility explicitly.Saklama, dışa aktarma ve temizleme için Günlük Kaydı Genel Bakış bölümüne bakın.
Gelişmiş Yapılandırma
Bluetooth Yapılandırması
Tarama Zaman Aşımı
Başlatmadan önce varsayılan zaman aşımını belirleyin veya tek bir tarama için geçersiz kılın.
- Swift
- Objective-C
// 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)// Defaults:
// scanTimeoutInSeconds = 10; use 0 for no automatic timeout.
// shouldAutoReconnectWhenAppLaunch = NO
// onlyDiscoverKnownDevices = YES
AIBudsSDKConfiguration *sdkConfiguration = [AIBudsSDKConfiguration defaultConfiguration];
sdkConfiguration.scanTimeoutInSeconds = 15;
// @15 overrides the initialized configuration for this scan only.
[AIBudsSDK
startScanningWithTimeout:@15
deviceFoundHandler:^(id<AIBudsFoundDeviceConvertible> device, BOOL isExistingDevice) {
// isExistingDevice is YES when an existing result was updated.
}
completion:^{
// Called when scanning stops.
}];
// Use the timeout supplied during SDK initialization.
[AIBudsSDK startScanningWithTimeout:nil deviceFoundHandler:nil completion:nil];Bağlantı Parametreleri
Bağlantıya özel değerleri ConnectParams ile iletin.
- Swift
- Objective-C
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)AIBudsConnectParams *params = [[AIBudsConnectParams alloc] init];
params.userId = currentUserId; // Only when required by the integration.
params.randomCode = devicePairingCode; // Only when required by the device.
params.enableClassicBT = YES; // Default: YES; NO enables BLE-only use.
params.aiAuthParams = aiAuthParams; // Only when required by the AI provider.
[device connectWithParams:params];AI Yapılandırması
AI hizmetini kurup kaydettikten ve başlattıktan sonra kullanılacak hizmeti seçin.
- Swift
- Objective-C
// 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.// 1. Install the provider module.
// 2. Register and initialize the provider with AIBudsAISDK.
// 3. Select the registered provider.
[AIBudsAISDK setAIServiceVendor:AIBudsAIServiceVendorStarBurst];
// Other public values:
// AIBudsAIServiceVendorMltcloud
// AIBudsAIServiceVendorNoneTüm kurulum adımları için AI Hizmeti Seçme bölümüne bakın.
Sonraki Adımlar
Yapılandırmayı tamamladıktan sonra Temel Kavramlar ile devam edin. Terimler için SDK Sözlüğü, özellikler için Temel Özellikler, başlatma, tarama, bağlantı veya AI hizmeti seçimi sorunları için Yaygın Sorunlar bölümünü kullanın.