我尝试在我的
Android应用程序(运行4.1.2的三星手机:客户端)和我的笔记本电脑(Win7,64位:服务器)之间建立蓝牙连接.服务发现失败时始终失败.
我阅读了有关这方面的各种主题(here和there),但它没有解决我的问题.
我有两个问题:
>什么意思是众所周知的UUID“00001101-0000-1000-8000-00805F9B34FB”.应该使用何时/何时使用?
>任何建议调查/解决我的问题将不胜感激.
备注:
>我试图建立一个安全和不安全的连接(同时失败)
>我可以通过设置>蓝牙将我的笔记本电脑和设备配对
>正如评论中所建议的那样:我尝试使用随机生成的UUID(但两侧都是相同的)而不是众所周知的UUID,但我仍然有完全相同的行为.
我有这些权限
编辑
我没有在客户端编码UUID,而是尝试了以下方法(但仍然得到相同的错误):
UUID uuid = bluetoothDevice.getUuids()[bluetoothDevice.getUuids().length-1].getUuid();
echo-server的UUID始终是数组中的最后一个.
结束编辑
以下是客户端上的相关日志:
08-22 12:30:28.627: ERROR/BluetoothService.cpp(12008): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
08-22 12:30:28.647: INFO/BluetoothSocket.cpp(18030): Setting Master socket option
08-22 12:30:28.647: VERBOSE/BluetoothSocket.cpp(18030): ...fd 43 created (RFCOMM, lm = 7)
08-22 12:30:28.687: DEBUG/BluetoothPolicyService(12008): getAllowBluetoothDataTransfer - showMsg: true
08-22 12:30:28.687: DEBUG/BluetoothPolicyService(12008): MDM: isProfileEnabled = true
08-22 12:30:28.697: DEBUG/BluetoothUtils(18030): isSocketAllowedBySecurityPolicy start : device null
08-22 12:30:28.727: ERROR/BluetoothEventLoop.cpp(12008): onCreateDeviceResult: D-Bus error: org.bluez.Error.AlreadyExists (Already Exists)
08-22 12:30:28.727: VERBOSE/BluetoothService.cpp(12008): discoverServicesNative
0