[英]BluetoothEventLoop( 2255): Device property changed.Bluetooth Connection Lost
我有一個示例應用程序,該應用程序通過藍牙傳輸了30個字符長度的數據。數據傳輸正常進行了四天,然后斷開了連接。然后,當藍牙連接斷開了幾分鍾后建立連接時,添加了adb日志和代碼。
為什么由於設備屬性更改而與平台斷開連接? 設備屬性何時會更改? 設備屬性更改是斷開藍牙連接的原因嗎?
private static final UUID MY_UUID_SECURE = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
private class ConnectThread extends Thread {
private final BluetoothSocket mmSocket;
private final BluetoothDevice mmDevice;
private String mSocketType;
public ConnectThread(BluetoothDevice device, boolean secure) {
mmDevice = device;
BluetoothSocket tmp = null;
mSocketType = secure ? "Secure" : "Insecure";
// Get a BluetoothSocket for a connection with the
// given BluetoothDevice
try {
tmp = device.createRfcommSocketToServiceRecord(MY_UUID_SECURE);
} catch (IOException e) {
Log.e(TAG, "Socket Type: " + mSocketType + "create() failed", e);
}
mmSocket = tmp;
Log.i("12345", "Socket set");
}
public void run() {
Log.i("12345", "BEGIN mConnectThread SocketType:" + mSocketType);
setName("ConnectThread" + mSocketType);
// Always cancel discovery because it will slow down a connection
mAdapter.cancelDiscovery();
// Make a connection to the BluetoothSocket
try {
// This is a blocking call and will only return on a
// successful connection or an exception
mmSocket.connect();
} catch (IOException e) {
// Close the socket
try {
mmSocket.close();
Log.i(TAG, "Closing Socket 3");
} catch (IOException e2) {
Log.e(TAG, "unable to close() " + mSocketType + " socket during connection failure", e2);
}
connectionFailed();
return;
}
// Reset the ConnectThread because we're done
synchronized (BluetoothChatService.this) {
mConnectThread = null;
}
// Start the connected thread
connected(mmSocket, mmDevice, mSocketType);
}
日志:
09-12 11:16:36.230 V / BluetoothEventLoop.cpp(2255):event_filter:收到信號org.bluez.Device:PropertyChanged from / org / bluez / 3179 / hci0 / dev_22_89_8E_A9_50_1C
09-12 11:16:36.230 D / BluetoothEventLoop(2255):設備屬性已更改
09-12 11:16:36.240 D / BluetoothA2DPStateReceiver(20246):BluetoothA2DPStateReceiver構造函數call()
09-12 11:16:36.245 D / BluetoothA2DPStateReceiver(20246):onReceive():操作= android.bluetooth.device.action.ACL_DISCONNECTED
09-12 11:16:36.245 D / BluetoothA2DPStateReceiver(20246):ACTION_ACL_DISCONNECTED
09-12 11:16:36.245 D / BluetoothA2DPSinkInfo(20246):checkBlackListCarkit():isBlackListCarkit否
09-12 11:16:36.660 D / KeyguardViewMediator(2255):setHidden false
可能是由於鏈接丟失所致,BT適配器已啟動屬性更改命令以報告鏈接斷開與上層的連接。 請檢入多設備。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.