我想連接到嵌入式設備,藍牙引腳是1234,當我連接到嵌入式板時,它要求我在嵌入式主板上輸入000000,而不是要求我輸入正確的引腳從我的設備。我不確定我做錯了什麼。createRfcommSocketToServiceRecord配對藍牙
public void connectBluetooth() throws IOException{
device = bluetoothAdapter.getRemoteDevice(MAC);
try {
mSocket = device.createRfcommSocketToServiceRecord(MY_UUID);
} catch (IOException e) {
Log.e(tag, "+++++Failed to create RFCOMM connection+++++");
}
try{
mSocket.connect();
Log.e(tag, "+++++connecting+++++");
manageBluetooth manageThread = new manageBluetooth();
manageThread.start();
threadCheck = true;
}catch(IOException e){
Log.e(tag, "+++++Failed to connect+++++");
}
Log.e(tag, "+++++After catch+++++");
}
}
我打電話進出manageThread,我也說明了正確的MAC地址。 當然,它應該要求我在手機上輸入管腳,而不是在自己的嵌入式主板上。