【发布时间】:2015-04-01 23:55:47
【问题描述】:
我正在尝试使用 IOBluetoothHandsFreeDevice 在 OS X 10.10 下实现蓝牙免提配置文件。我可以毫无问题地连接和控制运行 iOS 8.2 的 iPhone 6。
每次第一次尝试拨打或接听电话(或使用 Siri)都会导致静态噪音从我的手机传输到我的计算机,而不是音频。静电似乎不是完全随机的,因为它与我期望听到的声音(例如铃声等)同步。但是,从我的 Mac 到我的 iPhone 的音频非常清晰。
在最初的静态音频通话之后,使用相同的连接进行另一个通话会产生 50/50 的结果,一半的通话完美,另一半是静态的。
这是基本代码:
IOBluetoothDevice* device = ...;
_hfDevice = [[IOBluetoothHandsFreeDevice alloc] initWithDevice:device delegate:self];
uint32_t supportedFeatures = _hfDevice.supportedFeatures;
supportedFeatures |= IOBluetoothHandsFreeDeviceFeatureEnhancedCallStatus;
supportedFeatures |= IOBluetoothHandsFreeDeviceFeatureEnhancedCallControl;
supportedFeatures |= IOBluetoothHandsFreeDeviceFeatureCLIPresentation;
[_hfDevice setSupportedFeatures:supportedFeatures];
[_hfDevice connect];
// after connected delegate method...
// dial a phone number
const NSString* phoneNumber = @"...";
[_hfDevice dialNumber:phoneNumber];
// or activate siri
const NSString* activateSiri = @"AT+BVRA=1";
[_hfDevice sendATCommand:activateSiri];
我希望我可能忽略了一些东西,但 Apple 关于其蓝牙代码的文档不包含任何创建免提应用程序的示例。其他人有过这种经历吗?
【问题讨论】:
标签: macos bluetooth iobluetooth