- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在创建一个应用程序,它以编程方式与带有 android 应用程序的 BLE 设备连接。这是我的连接/断开代码
当用户点击连接按钮时
new Thread(new Runnable() {
@Override
public void run() {
mConnecting = true;
mConnectException = null;
mConnectWait.close(); // Reset the condition.
if (mConnectedGatt != null) {
// Reconnect to the BLE DEX adapter.
Logger.d(LOG_TAG, "going to connect");
mConnectedGatt.connect();
BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(deviceAddress);
device.connectGatt(mContext, false, mGattCallback);
} else {
// Start scanning BLE devices.
Logger.d(LOG_TAG, "going to scan LE Devices");
scanLeDevice(true);
}
mConnectWait.block(); // Wait for connect to complete
try {
if (mConnected) {
connectCallback.onConnectSuccess();
} else { // Error occurred in the connecting process
if (null == mConnectException) {
mConnectException = new BleDexException(
"Failed to connect to the BLE DEX adapter",
BleDexException.ERROR_BLE_CONNECT_FAILED);
}
connectCallback.onConnectFailed(mConnectException);
}
} catch (Exception e) {
e.printStackTrace();
}
mConnecting = false;
}
}).start();
扫码:
if (!mBleScanning) {
// Stops scanning after a pre-defined scan period.
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mBleScanning = false;
if ((null != mBleScanner) && (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON)) {
mBleScanner.stopScan(mScanCallback);
if (mConnecting) {
Logger.e(LOG_TAG, "Timed out in scanning BLE devices");
mConnectException = new BleDexException(
"Timed out in scanning BLE devices",
BleDexException.ERROR_BLE_CONNECT_FAILED);
mConnectWait.open();
}
}
}
}, mBleScanPeriod);
mBleScanning = true;
//ScanFilter scanFilter = new ScanFilter.Builder().setServiceUuid(new ParcelUuid(DEX_SERVICE_SPP)).build();
ScanFilter scanFilter = new ScanFilter.Builder().setDeviceName("DEXAdapter").build();
java.util.ArrayList<ScanFilter> scanFilterList = new java.util.ArrayList<ScanFilter>();
scanFilterList.add(scanFilter);
ScanSettings scanSettings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_BALANCED)
.build();
if((null != mBleScanner) && (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON))
mBleScanner.startScan(scanFilterList, scanSettings, mScanCallback);
}
} else {
Logger.d(LOG_TAG, "stop scanning. what 's the scan flag is: " + mBleScanning);
if (mBleScanning) {
mBleScanning = false;
if ((null != mBleScanner) && (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON))
mBleScanner.stopScan(mScanCallback);
}
}
这是配对 Intent 的广播接收器
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothDevice.ACTION_PAIRING_REQUEST.equals(action)) {
if (mBtPin == null || mBtMacAddress == null) {
return;
}
// Programmatically set the Bluetooth PIN.
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
pairingRequestType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT,
BluetoothDevice.ERROR);
Logger.d(LOG_TAG, "Received pairing request intent, Device mac address is: " + mBtMacAddress +
". Device pairingrequest type is: " + pairingRequestType);
if (device.getAddress().equals(mBtMacAddress)) {
try {
int btpin = Integer.parseInt(mBtPin);
Logger.d(LOG_TAG, "Set pin to BT = " + btpin);
byte[] pinbytes;
pinbytes = ("" + btpin).getBytes("UTF-8");
device.setPin(pinbytes);
abortBroadcast();
} catch (Exception e) {
e.printStackTrace();
}
}
} else if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {
int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, -1);
switch (state) {
case BluetoothDevice.BOND_NONE:
Logger.d(LOG_TAG, "Remote device is not bonded. Device: ");
case BluetoothDevice.BOND_BONDING:
Logger.d(LOG_TAG, "Remote device is in bonding process");
break;
case BluetoothDevice.BOND_BONDED:
Logger.d(LOG_TAG, "Remote device is paired");
BluetoothDevice bluetoothDevice = mBluetoothAdapter.getRemoteDevice(deviceAddress);
mConnectedGatt = bluetoothDevice.connectGatt(mContext, false, mGattCallback);
if (mConnectedGatt == null) {
Logger.e(LOG_TAG, "Failed to connect to GATT server");
if (mConnecting) {
mConnectException = new BleDexException(
"Failed to connect to GATT server",
BleDexException.ERROR_BLE_CONNECT_FAILED);
mConnectWait.open();
}
}
//scanLeDevice(false);
break;
}
}
}
};
会发生什么情况,只要我按下连接按钮,它就会检查设备是否已连接?如果不是,它将开始蓝牙 LE 扫描。我添加了用于扫描设备的 ScanFilter,以便它扫描受限设备。
一旦应用程序收到扫描回调,它就会使用 createbond() 方法对设备进行配对。一旦完成并完成配对,它将尝试连接蓝牙 gatt。
所有这一切在第一次尝试时就成功了。但一段时间后,应用程序会自动断开蓝牙设备。
这是自动断开的日志
07-05 15:15:26.101 6698 6698 D BleDexToolkitSample: Invoice send transaction initiated and is in progress.
07-05 15:15:26.103 6698 6765 D BleDexToolkitSample: SetConfigTransmissionControlNumber Success
07-05 15:15:26.103 6698 6765 D BleDexToolkitSample: SetConfigTestIndicator Success
07-05 15:15:26.103 6698 6765 D BleDexToolkitSample: SetRetailer Success
07-05 15:15:26.104 6698 6765 D BleDexToolkitSample: SetSupplier Success
07-05 15:15:26.112 6698 6765 D BleDexToolkitSample: BeginTransactionSet Success
07-05 15:15:26.115 6698 6765 D BleDexToolkitSample: WriteSTSegment Success
07-05 15:15:26.116 6698 6765 D BleDexToolkitSample: WriteG82Segment Success
07-05 15:15:26.116 6698 6765 D BleDexToolkitSample: WriteLoopStart Success
07-05 15:15:26.117 6698 6765 D BleDexToolkitSample: WriteG83Segment Success
07-05 15:15:26.117 6698 6765 D BleDexToolkitSample: WriteG83Segment Success
07-05 15:15:26.118 6698 6765 D BleDexToolkitSample: WriteG22Segment Success
07-05 15:15:26.118 6698 6765 D BleDexToolkitSample: WriteLoopEnd Success
07-05 15:15:26.118 6698 6765 D BleDexToolkitSample: WriteG84Segment Success
07-05 15:15:26.118 6698 6765 D BleDexToolkitSample: WriteG86Segment Success
07-05 15:15:26.118 6698 6765 D BleDexToolkitSample: WriteG85Segment Success
07-05 15:15:26.119 6698 6765 D BleDexToolkitSample: WriteSESegment Success
07-05 15:15:26.119 6698 6765 D BleDexToolkitSample: EndTransactionSet Success
07-05 15:15:26.136 6698 6723 D BleDexDevice: Initiated sending data: 05
07-05 15:15:27.168 6698 6723 D BleDexDevice: Initiated sending data: 05
07-05 15:15:28.174 1934 2382 W bt_btif : bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0008
07-05 15:15:28.175 1934 2382 W bt_btif : bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0008
07-05 15:15:28.175 1934 2382 W bt_btif : bta_gattc_conn_cback() - cif=6 connected=0 conn_id=6 reason=0x0008
07-05 15:15:28.176 1934 2049 D BtGatt.GattService: onConnected() connId=5, address=00:10:20:8E:26:97, connected=false
07-05 15:15:28.176 1934 2382 W bt_btif : bta_gattc_conn_cback() - cif=8 connected=0 conn_id=8 reason=0x0008
07-05 15:15:28.176 1934 2049 D BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=00:10:20:8E:26:97
07-05 15:15:28.180 1934 2049 D BtGatt.GattService: onDisconnected() - clientIf=8, connId=8, address=00:10:20:8E:26:97
07-05 15:15:28.181 6698 6711 D BluetoothGatt: onClientConnectionState() - status=8 clientIf=8 device=00:10:20:8E:26:97
07-05 15:15:28.181 6698 6711 E BleDexDevice: onConnectionStateChange failure status=8 newState=0
07-05 15:15:28.183 1934 2049 E BluetoothRemoteDevices: state12newState1
07-05 15:15:28.183 1934 2049 D BluetoothRemoteDevices: aclStateChangeCallback: State:DisConnected to Device:00:10:20:8E:26:97
07-05 15:15:28.189 6698 6698 D BleDexToolkitSample: BLE DEX Adapter disconnected.
07-05 15:15:28.193 1934 1934 D AvrcpBipRsp: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-05 15:15:28.193 1934 1934 D BluetoothMapService: onReceive
07-05 15:15:28.193 1934 1934 D BluetoothMapService: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-05 15:15:28.194 1934 1934 E BluetoothMapService: Unexpected error!
07-05 15:15:28.194 1934 1934 D BluetoothPbapReceiver: PbapReceiver onReceive action = android.bluetooth.device.action.ACL_DISCONNECTED
07-05 15:15:28.195 1934 1934 D BluetoothPbapReceiver: Calling start service with action = null
07-05 15:15:28.199 1934 1934 I BluetoothPbapReceiver: Exit - onReceive for intent:android.bluetooth.device.action.ACL_DISCONNECTED
07-05 15:15:28.199 1934 1934 D BluetoothPbapService: Enter - onStartCommand for service PBAP
07-05 15:15:28.200 1934 1934 D BluetoothPbapService: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-05 15:15:28.200 1934 1934 D BluetoothPbapService: Exit - onStartCommand for service PBAP
07-05 15:15:28.203 1934 1952 E BtGatt.GattService: writeCharacteristic() - No connection for 00:10:20:8E:26:97...
07-05 15:15:28.203 6698 6723 D BleDexDevice: Initiated sending data: 05
07-05 15:15:28.219 1934 4912 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@b82a9b1
07-05 15:15:28.219 4939 4939 I BTLEASH : BTReceive action : android.bluetooth.device.action.ACL_DISCONNECTED :: Device : DEXAdapter
07-05 15:15:28.233 1934 1934 V BluetoothFtpService: PARSE INTENT action: android.bluetooth.device.action.ACL_DISCONNECTED
07-05 15:15:28.239 1934 1934 D BluetoothDunService: parseIntent: action: android.bluetooth.device.action.ACL_DISCONNECTED
现在我稍微改变了应用程序的行为,而不是配对和连接设备,我直接连接设备而不配对。通过此更改,我看到蓝牙连接在连接 30 秒后自动断开连接。以下是日志:
=Bluetooth Connected successfully logs =
07-10 13:27:00.554 5001 5001 D BleDexToolkitSample: Connecting to BLE DEX Adapter.
07-10 13:27:00.556 5001 5338 D BleDexDevice: device found, device address is: 00:10:20:8E:26:97
07-10 13:27:00.557 5001 5338 D BluetoothGatt: connect() - device: 00:10:20:8E:26:97, auto: false
07-10 13:27:00.558 5001 5338 D BluetoothGatt: registerApp()
07-10 13:27:00.558 5001 5338 D BluetoothGatt: registerApp() - UUID=9ed830a0-85b0-4192-9b4d-c9960f5bca84
07-10 13:27:00.560 1957 2829 D BtGatt.GattService: registerClient() - UUID=9ed830a0-85b0-4192-9b4d-c9960f5bca84
07-10 13:27:00.562 1957 2068 D BtGatt.GattService: onClientRegistered() - UUID=9ed830a0-85b0-4192-9b4d-c9960f5bca84, clientIf=9
07-10 13:27:00.562 5001 5015 D BluetoothGatt: onClientRegistered() - status=0 clientIf=9
07-10 13:27:00.563 1957 5052 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:00.564 1957 5052 I A2dpService: audio isMusicActive is false
07-10 13:27:00.565 1957 5052 D BtGatt.GattService: clientConnect() - address=00:10:20:8E:26:97, isDirect=true
07-10 13:27:00.565 1957 2068 D bt_btif_config: btif_get_address_type: Device [00:10:20:8e:26:97] address type 0
07-10 13:27:00.566 1957 2068 D bt_btif_config: btif_get_device_type: Device [00:10:20:8e:26:97] type 2
07-10 13:27:00.567 1957 2319 W bt_l2cap: l2cble_init_direct_conn
07-10 13:27:00.573 2198 2304 I WCNSS_FILTER: ibs_bt_device_wakeup: Writing IBS_WAKE_IND
07-10 13:27:01.577 2198 2325 I WCNSS_FILTER: ibs_wcnss_bt_device_sleep: TX Awake, Sending SLEEP_IND
07-10 13:27:01.926 1957 2319 W bt_btm : btm_acl_created hci_handle=4 link_role=0 transport=2
07-10 13:27:01.927 2198 2304 I WCNSS_FILTER: ibs_bt_device_wakeup: Writing IBS_WAKE_IND
07-10 13:27:01.946 1957 2068 D BtGatt.GattService: onConnected() connId=5, address=00:10:20:8E:26:97, connected=true
07-10 13:27:01.946 1957 2068 D BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=00:10:20:8E:26:97
07-10 13:27:01.946 1957 2319 W bt_smp : smp_br_connect_callback is called on unexpected transport 2
07-10 13:27:01.948 1957 2068 D bt_btif_config: btif_get_device_type: Device [00:10:20:8e:26:97] type 2
07-10 13:27:01.948 1957 2319 E bt_btif : bta_dm_acl_change new acl connetion:count = 1
07-10 13:27:01.949 1957 2319 W bt_btif : bta_dm_acl_change info: 0x0
07-10 13:27:01.949 1957 2319 W bt_l2cap: L2CA_SetDesireRole() new:x1, disallow_switch:0
07-10 13:27:01.949 1957 2068 D BluetoothRemoteDevices: Property type: 4
07-10 13:27:01.950 1957 2319 E bt_btif : bta_gattc_cache_load: can't open GATT cache file /data/misc/bluetooth/gatt_cache_0010208e2697 for reading, error: No such file or directory
07-10 13:27:01.952 1957 2068 D BluetoothRemoteDevices: Remote class is:7936
07-10 13:27:01.953 1957 2068 D BluetoothRemoteDevices: Property type: 5
07-10 13:27:01.953 1957 2068 D bt_btif_config: btif_get_device_type: Device [00:10:20:8e:26:97] type 2
07-10 13:27:01.953 1957 2068 I bt_btif_dm: get_cod remote_cod = 0x00001f00
07-10 13:27:01.953 1957 2068 I BluetoothBondStateMachine: bondStateChangeCallback: Status: 0 Address: 00:10:20:8E:26:97 newState: 1
07-10 13:27:01.954 1957 2068 I BluetoothBondStateMachine: sspRequestCallback: [B@f9753ea name: [B@ffc36db cod: 7936 pairingVariant 2 passkey: 0
07-10 13:27:01.955 1957 2068 D bt_btif_dm: remote version info [00:10:20:8e:26:97]: 0, 0, 0
07-10 13:27:01.957 1957 2068 E BluetoothRemoteDevices: state12newState0
07-10 13:27:01.957 1957 2068 D BluetoothRemoteDevices: aclStateChangeCallback: State:Connected to Device:00:10:20:8E:26:97
07-10 13:27:01.957 1957 2069 I BluetoothBondStateMachine: Bond State Change Intent:00:10:20:8E:26:97 OldState: 10 NewState: 11
07-10 13:27:01.957 1957 2069 I BluetoothBondStateMachine: Entering PendingCommandState State
07-10 13:27:01.958 2128 2128 W BluetoothEventManager: CachedBluetoothDevice for device 00:10:20:8E:26:97 not found, calling readPairedDevices().
07-10 13:27:01.961 2128 2128 E BluetoothEventManager: Got bonding state changed for 00:10:20:8E:26:97, but we have no record of that device.
07-10 13:27:01.974 1957 2068 D BtGatt.GattService: onConnected() - clientIf=9, connId=9, address=00:10:20:8E:26:97
07-10 13:27:01.975 5001 5015 D BluetoothGatt: onClientConnectionState() - status=0 clientIf=9 device=00:10:20:8E:26:97
07-10 13:27:01.975 5001 5015 D BluetoothGatt: discoverServices() - device: 00:10:20:8E:26:97
07-10 13:27:01.977 1957 2173 D BtGatt.GattService: discoverServices() - address=00:10:20:8E:26:97, connId=9
07-10 13:27:01.978 1957 1957 V BluetoothFtpService: Ftp Service onStartCommand
07-10 13:27:01.978 1957 1957 V BluetoothFtpService: PARSE INTENT action: android.bluetooth.device.action.BOND_STATE_CHANGED
07-10 13:27:01.984 5001 5001 D BleDexDevice: Received pairing request intent, Device mac address is: 00:10:20:8E:26:97. Device pairingrequest type is: 3
07-10 13:27:01.984 5001 5001 D BleDexDevice: Set pin to BT = 369371
07-10 13:27:01.986 1957 1957 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:01.987 1957 1957 D BluetoothFtpService: device: DEXAdapter
07-10 13:27:01.987 1957 2319 W bt_smp : SMP_PasskeyReply() - Wrong State: 1
07-10 13:27:01.990 1957 2319 E bt_btm : BTM_SetBlePhy failed, peer does not support request
07-10 13:27:01.993 1957 1957 D BluetoothDunService: parseIntent: action: android.bluetooth.device.action.BOND_STATE_CHANGED
07-10 13:27:02.000 1957 1957 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:02.002 1957 1957 D BluetoothDunService: device: DEXAdapter
07-10 13:27:02.456 1957 2319 W bt_btm : btm_read_remote_version_complete: BDA: 00-10-20-8e-26-97
07-10 13:27:02.456 1957 2319 W bt_btm : btm_read_remote_version_complete lmp_version 7 manufacturer 13 lmp_subversion 528
07-10 13:27:02.837 1957 2319 W bt_bta_gattc: bta_gattc_explore_srvc no more services found
07-10 13:27:02.840 1957 2068 D BtGatt.GattService: onSearchCompleted() - connId=9, status=0
07-10 13:27:02.843 1957 2068 D bt_bta_gattc: bta_gattc_get_gatt_db
07-10 13:27:02.845 1957 2068 D BtGatt.GattService: onGetGattDb() - address=00:10:20:8E:26:97
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got service with UUID=00001800-0000-1000-8000-00805f9b34fb
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got characteristic with UUID=00002a00-0000-1000-8000-00805f9b34fb
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got characteristic with UUID=00002a01-0000-1000-8000-00805f9b34fb
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got characteristic with UUID=00002a04-0000-1000-8000-00805f9b34fb
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got service with UUID=00001801-0000-1000-8000-00805f9b34fb
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got service with UUID=f000c0e0-0451-4000-b000-000000000000
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got characteristic with UUID=f000c0e1-0451-4000-b000-000000000000
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002902-0000-1000-8000-00805f9b34fb
07-10 13:27:02.846 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002901-0000-1000-8000-00805f9b34fb
07-10 13:27:02.847 1957 2068 D BtGatt.GattService: got characteristic with UUID=f000c0e2-0451-4000-b000-000000000000
07-10 13:27:02.847 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002901-0000-1000-8000-00805f9b34fb
07-10 13:27:02.847 1957 2068 D BtGatt.GattService: got service with UUID=f000ffd0-0451-4000-b000-000000000000
07-10 13:27:02.847 1957 2068 D BtGatt.GattService: got characteristic with UUID=f000ffd1-0451-4000-b000-000000000000
07-10 13:27:02.847 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002901-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got characteristic with UUID=f000ffd2-0451-4000-b000-000000000000
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002901-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got characteristic with UUID=f000ffd3-0451-4000-b000-000000000000
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002902-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002901-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got service with UUID=0000180f-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got characteristic with UUID=00002a19-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002902-0000-1000-8000-00805f9b34fb
07-10 13:27:02.848 1957 2068 D BtGatt.GattService: got descriptor with UUID=00002904-0000-1000-8000-00805f9b34fb
07-10 13:27:02.854 5001 5015 D BluetoothGatt: onSearchComplete() = Device=00:10:20:8E:26:97 Status=0
07-10 13:27:02.855 5001 5015 D BluetoothGatt: setCharacteristicNotification() - uuid: f000c0e1-0451-4000-b000-000000000000 enable: true
07-10 13:27:02.856 1957 1972 D BtGatt.GattService: registerForNotification() - address=00:10:20:8E:26:97 enable: true
07-10 13:27:02.857 1957 2068 D BtGatt.GattService: onRegisterForNotifications() - address=null, status=0, registered=1, handle=11
07-10 13:27:02.863 5001 5338 D BleDexToolkitSample: BLE DEX Adapter connection Success
07-10 13:27:02.870 5001 5001 D BleDexToolkitSample: BLE DEX Adapter connection Success.
07-10 13:27:03.863 2198 2325 I WCNSS_FILTER: ibs_wcnss_bt_device_sleep: TX Awake, Sending SLEEP_IND
07-10 13:27:07.947 2198 2304 I WCNSS_FILTER: ibs_bt_device_wakeup: Writing IBS_WAKE_IND
07-10 13:27:08.950 2198 2325 I WCNSS_FILTER: ibs_wcnss_bt_device_sleep: TX Awake, Sending SLEEP_IND
=android device disconneted the ble =
07-10 13:27:31.953 1957 2068 D bt_btif_config: btif_get_device_type: Device [00:10:20:8e:26:97] type 2
07-10 13:27:31.953 1957 2068 I bt_btif_dm: get_cod remote_cod = 0x00001f00
07-10 13:27:31.953 2172 5348 E bt_logger: Deleting old log file /data/media/0/bt_vnd_log20190710131438.txt
07-10 13:27:31.954 1957 2068 I BluetoothBondStateMachine: bondStateChangeCallback: Status: 1 Address: 00:10:20:8E:26:97 newState: 0
07-10 13:27:31.955 2172 5348 E bt_logger: Writing logs to file
07-10 13:27:31.955 1957 2069 D BluetoothAdapterProperties: Failed to remove device: 00:10:20:8E:26:97
07-10 13:27:31.962 2128 2128 W BluetoothEventManager: CachedBluetoothDevice for device 00:10:20:8E:26:97 not found, calling readPairedDevices().
07-10 13:27:31.964 1957 2069 I BluetoothBondStateMachine: Bond State Change Intent:00:10:20:8E:26:97 OldState: 11 NewState: 10
07-10 13:27:31.968 1957 2069 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:31.970 1957 2069 D A2dpService: Enter setPriority
07-10 13:27:31.972 1957 2069 D A2dpService: Saved priority 00:10:20:8E:26:97 = -1
07-10 13:27:31.972 1957 2069 D A2dpService: Exit setPriority
07-10 13:27:31.972 2128 2128 E BluetoothEventManager: Got bonding state changed for 00:10:20:8E:26:97, but we have no record of that device.
07-10 13:27:31.975 1957 2069 I BluetoothBondStateMachine: StableState(): Entering Off State
07-10 13:27:31.990 1957 1957 V BluetoothFtpService: Ftp Service onStartCommand
07-10 13:27:31.990 1957 1957 V BluetoothFtpService: PARSE INTENT action: android.bluetooth.device.action.BOND_STATE_CHANGED
07-10 13:27:31.994 1957 1957 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:31.994 1957 1957 D BluetoothFtpService: device: DEXAdapter
07-10 13:27:31.996 1957 1957 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:31.996 1957 1957 D BluetoothFtpService: BOND_STATE_CHANGED REFRESH trustDevices DEXAdapter
07-10 13:27:32.002 1957 1957 D BluetoothDunService: parseIntent: action: android.bluetooth.device.action.BOND_STATE_CHANGED
07-10 13:27:32.003 1957 1957 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:32.004 1957 1957 D BluetoothDunService: device: DEXAdapter
07-10 13:27:32.005 1957 1957 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:32.005 1957 1957 D BluetoothDunService: BOND_STATE_CHANGED REFRESH trustDevices DEXAdapter
07-10 13:27:32.020 1937 2199 W BluetoothEventManager: showUnbondMessage: Not displaying any message for reason: 9
07-10 13:27:32.021 2681 3699 I LicenseObserver: installLicenses - /storage/emulated/0/bt_vnd_log20190710132731.txt
07-10 13:27:34.953 1957 2066 D bt_osi_alarm: reschedule_root_alarm alarm expiration too close for posix timers, switching to guns
07-10 13:27:34.959 2198 2304 I WCNSS_FILTER: ibs_bt_device_wakeup: Writing IBS_WAKE_IND
07-10 13:27:34.994 1957 2319 W bt_btif : bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016
07-10 13:27:34.994 1957 2319 W bt_btif : bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016
07-10 13:27:34.995 1957 2319 W bt_btif : bta_gattc_conn_cback() - cif=6 connected=0 conn_id=6 reason=0x0016
07-10 13:27:34.995 1957 2319 W bt_btif : bta_gattc_conn_cback() - cif=7 connected=0 conn_id=7 reason=0x0016
07-10 13:27:34.995 1957 2319 W bt_btif : bta_gattc_conn_cback() - cif=8 connected=0 conn_id=8 reason=0x0016
07-10 13:27:34.995 1957 2068 D BtGatt.GattService: onConnected() connId=5, address=00:10:20:8E:26:97, connected=false
07-10 13:27:34.995 1957 2319 W bt_btif : bta_gattc_conn_cback() - cif=9 connected=0 conn_id=9 reason=0x0016
07-10 13:27:34.995 1957 2068 D BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=00:10:20:8E:26:97
07-10 13:27:34.996 1957 2319 I bt_btm_sec: btm_sec_disconnected clearing pending flag handle:4 reason:22
07-10 13:27:34.998 1957 2068 D BtGatt.GattService: onDisconnected() - clientIf=9, connId=9, address=00:10:20:8E:26:97
07-10 13:27:34.999 5001 5014 D BluetoothGatt: onClientConnectionState() - status=22 clientIf=9 device=00:10:20:8E:26:97
07-10 13:27:34.999 5001 5014 D BleDexDevice: onConnectionStateChange failure status=22 newState=0
07-10 13:27:34.999 2172 2172 E bt_logger: Logger Process: Invalid packet with no length field
07-10 13:27:34.999 2172 2172 E bt_logger: Error saving packet, buff = ound p_reg tcb_idx=0 gatt_if=9 conn_id=0x9�\
07-10 13:27:34.999 2172 2172 E bt_logger: Error saving packet, buff =
07-10 13:27:35.000 1957 2319 W bt_l2cap: L2CA_SetDesireRole() new:x1, disallow_switch:0
07-10 13:27:35.001 1957 2319 E bt_btif : bta_gattc_mark_bg_conn unable to find the bg connection mask for: 00:10:20:8e:26:97
07-10 13:27:35.002 1957 2068 E BluetoothRemoteDevices: state12newState1
07-10 13:27:35.002 1957 2068 D BluetoothRemoteDevices: aclStateChangeCallback: State:DisConnected to Device:00:10:20:8E:26:97
07-10 13:27:35.004 5001 5001 D BleDexToolkitSample: BLE DEX Adapter disconnected.
07-10 13:27:35.006 1957 1957 D AvrcpBipRsp: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:35.006 1957 1957 D BluetoothMapService: onReceive
07-10 13:27:35.006 1957 1957 D BluetoothMapService: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:35.006 1957 1957 E BluetoothMapService: Unexpected error!
07-10 13:27:35.008 1957 1957 D BluetoothPbapReceiver: PbapReceiver onReceive action = android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:35.009 1957 1957 D BluetoothPbapReceiver: Calling start service with action = null
07-10 13:27:35.012 1957 1957 I BluetoothPbapReceiver: Exit - onReceive for intent:android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:35.013 1957 1957 D BluetoothPbapService: Enter - onStartCommand for service PBAP
07-10 13:27:35.013 1957 1957 D BluetoothPbapService: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:35.013 1957 1957 D BluetoothPbapService: Exit - onStartCommand for service PBAP
07-10 13:27:35.026 1957 2829 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:35.027 5034 5034 I BTLEASH : BTReceive action : android.bluetooth.device.action.ACL_DISCONNECTED :: Device : DEXAdapter
07-10 13:27:35.030 1957 1970 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@d4dde01
07-10 13:27:35.045 1957 1957 V BluetoothFtpService: Ftp Service onStartCommand
07-10 13:27:35.046 1957 1957 V BluetoothFtpService: PARSE INTENT action: android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:35.053 1957 1957 D BluetoothDunService: parseIntent: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-10 13:27:36.005 2198 2325 I WCNSS_FILTER: ibs_wcnss_bt_device_sleep: TX Awake, Sending SLEEP_IND
^C
提前致谢。
最佳答案
Disconnect with reason 8 表示连接超时,这是硬件问题(不是软件问题)。连接超时失败的唯一原因(至少我现在能想到的)是当两个设备尝试使用两个不同的绑定(bind) key 时。然后两者都使用不同的 key 设置加密,然后因此失败。
您可以使用空气嗅探器找出断开连接的原因或时间。
关于android - 蓝牙连接与 Android 应用程序自动断开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57892013/
我最近在/ drawable中添加了一些.gifs,以便可以将它们与按钮一起使用。这个工作正常(没有错误)。现在,当我重建/运行我的应用程序时,出现以下错误: Error: Gradle: Execu
Android 中有返回内部存储数据路径的方法吗? 我有 2 部 Android 智能手机(Samsung s2 和 s7 edge),我在其中安装了一个应用程序。我想使用位于这条路径中的 sqlit
这个问题在这里已经有了答案: What's the difference between "?android:" and "@android:" in an android layout xml f
我只想知道 android 开发手机、android 普通手机和 android root 手机之间的实际区别。 我们不能从实体店或除 android marketplace 以外的其他地方购买开发手
自Gradle更新以来,我正在努力使这个项目达到标准。这是一个团队项目,它使用的是android-apt插件。我已经进行了必要的语法更改(编译->实现和apt->注释处理器),但是编译器仍在告诉我存在
我是android和kotlin的新手,所以请原谅要解决的一个非常简单的问题! 我已经使用导航体系结构组件创建了一个基本应用程序,使用了底部的导航栏和三个导航选项。每个导航选项都指向一个专用片段,该片
我目前正在使用 Facebook official SDK for Android . 我现在正在使用高级示例应用程序,但我不知道如何让它获取应用程序墙/流/状态而不是登录的用户。 这可能吗?在那种情
我在下载文件时遇到问题, 我可以在模拟器中下载文件,但无法在手机上使用。我已经定义了上网和写入 SD 卡的权限。 我在服务器上有一个 doc 文件,如果用户单击下载。它下载文件。这在模拟器中工作正常但
这个问题在这里已经有了答案: What is the difference between gravity and layout_gravity in Android? (22 个答案) 关闭 9
任何人都可以告诉我什么是 android 缓存和应用程序缓存,因为当我们谈论缓存清理应用程序时,它的作用是,缓存清理概念是清理应用程序缓存还是像内存管理一样主存储、RAM、缓存是不同的并且据我所知,缓
假设应用程序 Foo 和 Eggs 在同一台 Android 设备上。任一应用程序都可以获取设备上所有应用程序的列表。一个应用程序是否有可能知道另一个应用程序是否已经运行以及运行了多长时间? 最佳答案
我有点困惑,我只看到了从 android 到 pc 或者从 android 到 pc 的例子。我需要制作一个从两部手机 (android) 连接的 android 应用程序进行视频聊天。我在想,我知道
用于使用 Android 以编程方式锁定屏幕。我从 Stackoverflow 之前关于此的问题中得到了一些好主意,并且我做得很好,但是当我运行该代码时,没有异常和错误。而且,屏幕没有锁定。请在这段代
文档说: android:layout_alignParentStart If true, makes the start edge of this view match the start edge
我不知道这两个属性和高度之间的区别。 以一个TextView为例,如果我将它的layout_width设置为wrap_content,并将它的width设置为50 dip,会发生什么情况? 最佳答案
这两个属性有什么关系?如果我有 android:noHistory="true",那么有 android:finishOnTaskLaunch="true" 有什么意义吗? 最佳答案 假设您的应用中有
我是新手,正在尝试理解以下 XML 代码: 查看 developer.android.com 上的文档,它说“starStyle”是 R.attr 中的常量, public static final
在下面的代码中,为什么当我设置时单选按钮的外观会发生变化 android:layout_width="fill_parent" 和 android:width="fill_parent" 我说的是
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
假设我有一个函数 fun myFunction(name:String, email:String){},当我调用这个函数时 myFunction('Ali', 'ali@test.com ') 如何
我是一名优秀的程序员,十分优秀!