我需要实现一个自建蓝牙应用程序来将所有蓝牙设备连接到 iPhone。我知道 CoreBluetooth 框架不可能做到这一点。
我使用私有API并将DeviceManager和BluetoothManager的头文件添加到私有框架中,并从下载了BeeTee项目here https://github.com/michaeldorner/BeeTee
该应用程序运行并找到我附近的所有蓝牙设备,但是当我尝试通过以下代码连接到设备时:
[self.bluetoothManager connectDevice:bluetoothDevice];
and this
[bluetoothDevice connect];
当选择一个单元格时,上述两个代码都请求连接,但 BTM 返回此消息:
BeeTee[5473:60b] BTM:连接到设备“Nokia 500”F4:xx:xx:xx:xx:xx 上的服务 0xffffffff 失败,错误 109
错误109是什么?设置哪个服务号码?
我想我应该在连接之前配对设备,但我该怎么做呢?
我只是猜测,但我认为问题在于BluetoothManager.framework
是为Apple 的外部配件计划 https://developer.apple.com/library/ios/featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html。这允许(除其他外)SPP 蓝牙连接到已认证的设备。但有一个问题:你需要有一个内置身份验证芯片的设备。
我不知道 Apple 在哪个级别/层上实现了身份验证,但我担心 BeeTee 正在使用的私有框架下的一层。
更新:也许这对您有帮助:
BluetoothManager *bluetoothManager = //...
[bluetoothManager setDevicePairingEnabled:YES];
[bluetoothManager connectDevice:bluetoothDevice withServices:0x00002000];
Credits https://github.com/michaeldorner/BeeTee/issues/2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)