我使用bluez-ime代码作为参考(用于蓝牙连接)。( https://code.google.com/p/android-bluez-ime/ )
我无法通过蓝牙成功连接到PS4控制器。有没有人成功做到了这一点?当我查看socket.connect函数之后的logcat时,我一直收到连接被拒绝的消息。
为此,我需要特定的PS4 UUID吗?(已尝试使用getUuids和fetchUuidsWithSdp获取设备的UUID,但未成功。)
我试着使用这个应用程序(在play store上),看看它是否能够连接到控制器,但效果不佳。
(只是为了澄清一下,控制器和android设备是配对的,控制器的led灯也亮了)
有什么想法吗?
来自logcat的相关零件
D/BluetoothViewer( 5799): onActivityResult -1
D/BluetoothChatService( 5799): connect to: 1C:66:6D:10:74:94
V/BluetoothSocket.cpp( 5799): initSocketNative
V/BluetoothSocket.cpp( 5799): ...fd 39 created (RFCOMM, lm = 26)
V/BluetoothSocket.cpp( 5799): initSocketFromFdNative
V/BluetoothSocket.cpp( 5799): initSocketNative
V/BluetoothSocket.cpp( 5799): ...fd 55 created (RFCOMM, lm = 26)
V/BluetoothSocket.cpp( 5799): initSocketFromFdNative
I/BluetoothChatService( 5799): BEGIN mConnectThread
D/BluetoothChatService( 5799): setState() 0 -> 2
E/BluetoothViewer( 5799): + ON RESUME +
V/BluetoothService.cpp(22186): stopDiscoveryNative
E/BluetoothService.cpp(22186): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
I/BluetoothPolicyService(22186): getBluetoothDataTransferAllowed
I/BluetoothViewer( 5799): MESSAGE_STATE_CHANGE: 2
D/BluetoothPolicyService(22186): MDM: isProfileEnabled = true
V/BluetoothSocket.cpp( 5799): connectNative
V/BluetoothSocket.cpp( 5799): ...connect(55, RFCOMM) = 111 (errno 111)
W/System.err( 5799): java.io.IOException: Connection refused
W/System.err( 5799): at android.bluetooth.BluetoothSocket.connectNative(Native Method)
W/System.err( 5799): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:243)
W/System.err( 5799): at net.bluetoothviewer.BluetoothChatService$ConnectThread.run(BluetoothChatService.java:244)
D/KeyguardViewMediator(22186): setHidden false
D/BluetoothChatService( 5799): setState() 2 -> 0
V/BluetoothSocket.cpp( 5799): abortNative
V/BluetoothSocket.cpp( 5799): ...asocket_abort(55) complete
V/BluetoothSocket.cpp( 5799): destroyNative
V/BluetoothSocket.cpp( 5799): ...asocket_destroy(55) complete
I/BluetoothViewer( 5799): MESSAGE_STATE_CHANGE: 0发布于 2014-04-17 17:42:16
PS4控制器使用HID配置文件进行连接。但从您上面的日志中,我看到它正在尝试RFCOMM连接。由于HID位于L2CAP之上而不是RFCOMM之上,因此连接被拒绝。
如果您有制作app的倾向,可以尝试从HID服务发起连接,完成HID连接。
https://stackoverflow.com/questions/21115192
复制相似问题