我正在尝试将我的 Nexus 4 与 Wii 平衡板连接,但出现此错误:
getBluetoothService() called with no BluetoothManagerCallback
connect(), SocketState: INIT, mPfd: null
所以它没有完成连接。
我的插座:
public final class wSocket
{
public static BluetoothSocket create(BluetoothDevice dev, int port)
{
try {
/*
* BluetoothSocket(int type, int fd, boolean auth, boolean encrypt, BluetoothDevice device, int port, ParcelUuid uuid)
*/
Constructor<BluetoothSocket> construct = BluetoothSocket.class.getDeclaredConstructor(int.class, int.class, boolean.class,
boolean.class, BluetoothDevice.class, int.class, ParcelUuid.class);
construct.setAccessible(true);
return construct.newInstance(3 /* TYPE_L2CAP */, -1, false, false, dev, port, null);
} catch (Exception ex) {
return null;
}
}
}
它给了我错误的地方:
private BluetoothSocket sk;
...
sk = wSocket.create(wm.dev, 0x11);
...
sk.connect();
我检查了这个链接没有成功,因为我只打开了 1 个套接字: getbluetoothservice() 调用没有 bluetoothmanagercallback
有什么帮助或想法可以探索吗?