我目前正在研究一个真正研究我的大学的项目,因为它一直在崩溃而没有给我任何Logcat错误。 我正在使用华为荣誉7.
我想要实现的目标:
我想将2 Adafruit Feather BLE个主板连接到我的手机,收集一些数据然后进行比较,以便向用户提供反馈。
到目前为止我做了什么:
连接其中一块板,传输数据并进行一些分析
一块板 - >没问题
我查找了如何连接到多个设备,发现我需要一个 BluetoothGatt 。所以我试过了,但我没有成功......但是。
我还尝试给每个 BluetoothGatt 它自己的 Callback ,这对我来说没什么用,因为设备是假的执行相同的任务。 (或者我错过了什么?)它也没有解决我的问题。
什么时候会崩溃?
当我尝试连接到第二块板时发生崩溃。如果我事先连接到第一块板也没关系。
这是我的代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sensor_sole);
Intent intent = getIntent();
String address = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
BluetoothManager manager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
mBluetoothAdapter = manager.getAdapter();
mBluetoothDevice = mBluetoothAdapter.getRemoteDevice(address);
initBLEGatt(mBluetoothDevice);
initUI();
Runnable discover = new Runnable() {
@Override
public void run() {
if (mBluetoothGatt != null)
servicesDiscovered = mBluetoothGatt.discoverServices();
if (mBluetoothGatt2 != null)
servicesDiscovered2 = mBluetoothGatt2.discoverServices();
}
};
discover.run();
}
它在 initBLEGatt(...)
中崩溃private void initBLEGatt(BluetoothDevice mDevice) {
if (mDevice.getAddress().contains(feather1MacAdress)) {
if (mBluetoothGatt != null) {
if (mBluetoothGatt.getConnectedDevices().contains(mDevice)) {
mBluetoothDevices = mBluetoothGatt.getConnectedDevices();
} else {
mBluetoothGatt = mBluetoothDevice.connectGatt(this, true, mGattCallback);
mBluetoothDevices.add(mDevice);
}
} else mBluetoothGatt = mDevice.connectGatt(this, true, mGattCallback);
}
else {
if (mBluetoothGatt2 != null) {
if (mBluetoothGatt2.getConnectedDevices().contains(mDevice)) {
mBluetoothDevices = mBluetoothGatt2.getConnectedDevices();
} else {
mBluetoothGatt2 = mBluetoothDevice.connectGatt(this, true, mGattCallback);
mBluetoothDevices.add(mDevice);
}
} else
Log.e(TAG, "initBLEGatt: weird crash happening shortly after");
mBluetoothGatt2 = mDevice.connectGatt(getApplicationContext(), true, mGattCallback);
int i = mBluetoothGatt2.getConnectionState(mDevice);
mBluetoothGatt2.getDevice();
}
}
这就是Logcat的样子:
09-26 16:44:58.712 6333-6333/com.example.david.sensorsole_ble E/SensorSoleActivity: initBLEGatt: weird shit happening shortly
09-26 16:44:58.714 5819-6037/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.715 5819-6037/? I/Bluetooth: BtGatt.GattService:registerClient() - UUID=ed166f3d-47ea-424f-b8dc-6689f06aab64
09-26 16:44:58.715 5819-5970/? I/bt_att: GATT_Register
09-26 16:44:58.715 5819-5970/? I/bt_att: allocated gatt_if=6
09-26 16:44:58.715 5819-5883/? W/bt_btif: HAL bt_gatt_callbacks->client->register_client_cb
09-26 16:44:58.715 5819-5970/? I/bt_att: GATT_StartIf gatt_if=6
09-26 16:44:58.715 5819-5883/? I/Bluetooth: BtGatt.GattService:onClientRegistered() - UUID=ed166f3d-47ea-424f-b8dc-6689f06aab64, clientIf=6
09-26 16:44:58.716 5819-25376/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.716 5819-25376/? I/Bluetooth: BtGatt.GattService:clientConnect() - address=E2:C9:7A:A8:7C:EE, isDirect=false
09-26 16:44:58.717 5819-5970/? I/bt_btm: BTM_InqDbRead: bd addr [e2c97aa87cee]
09-26 16:44:58.717 5819-5970/? I/bt_btm: BTM_BleSetBgConnType
09-26 16:44:58.717 5819-5970/? I/bt_att: GATT_Connect gatt_if=6
09-26 16:44:58.717 5819-5970/? I/bt_att: gatt_update_auto_connect_dev
09-26 16:44:58.717 5819-5970/? I/bt_btm: BTM_BleUpdateBgConnDev() add=1
09-26 16:44:58.717 5819-5970/? I/bt_btm: BTM_IsAclConnectionUp: RemBdAddr: e2c97aa87cee
09-26 16:44:58.717 5819-5970/? W/bt_btif_dm: check_unuse_private_addr_bl: BT_PROPERTY_BDNAME failed, returning false
09-26 16:44:58.717 5819-5970/? I/bt_att: GATT_GetConnIdIfConnected status=0
09-26 16:44:58.721 5819-5970/? I/bt_btm: btm_ble_add_2_white_list_complete status=23
09-26 16:44:58.723 3433-3433/? I/SendBroadcastPermission: action:android.intent.action.DROPBOX_ENTRY_ADDED, mPermissionType:0
09-26 16:44:58.724 3259-3429/? I/logserver: handle_logfile_events, Object Path:/data/system/dropbox/, mask=0x00000080
09-26 16:44:58.724 3259-3429/? I/logserver: process_one_event, event->len=48, name=data_app_crash@1474901098723.txt
09-26 16:44:58.724 3259-3429/? I/logserver: find_first_match: find match, plogs(type=1, pfile=/data/system/dropbox/, match=app_crash)
09-26 16:44:58.728 3259-3429/? I/logserver: is_all_ready, any file is ready in non-keyfile exception.
09-26 16:44:58.728 3259-3429/? I/logserver: extract_appname, forward search, appname=com.example.david.sensorsole_ble
09-26 16:44:58.728 3259-3429/? I/logserver: archive_and_send, pos=0, type=crash, output=20160926164458_crash
09-26 16:44:58.728 3259-3429/? I/logserver: ---copy_match_files enter!!--
09-26 16:44:58.728 3259-3429/? I/logserver: [copy_match_files,864]: copy [/data/system/dropbox/data_app_crash@1474901098723.txt] to [/data/log/logcache/-152364752/data_app_crash@1474901098723.txt]
09-26 16:44:58.728 3259-3429/? I/logserver: get_fault_appname, appname=com.example.david.sensorsole_ble
09-26 16:44:58.728 3259-3429/? I/logserver: handle_archive_exception, BASIC_MODE
09-26 16:44:58.728 3259-3429/? I/logserver: remove_last_modify_file, into 1 times, file_dir:
09-26 16:44:58.728 3259-3429/? I/logserver: remove_last_modify_file, into 1 times, file_dir:
09-26 16:44:58.728 3259-3429/? I/logserver: get_disk_available_size, Disk_available = 2745237504 B = 2618 MB
09-26 16:44:58.728 3259-3429/? I/logserver: pack_files, output_path is /data/log/unzip.
09-26 16:44:58.728 3259-3429/? I/logserver: move_input_files, create dir [/data/log/unzip/PLK-L01_PLK-L01C432B330b_0000000000_20160926164458_crash]
09-26 16:44:58.729 3259-3429/? I/logserver: handle_archive_exception, into set notify_type
09-26 16:44:58.729 3259-3429/? I/logserver: get_notify_mode, 1
09-26 16:44:58.729 3259-3429/? I/logserver: Process 3429 opened FIFO(12) for O_WRONLY
09-26 16:44:58.729 3259-3429/? I/logserver: notify_logcontrol, 3429 sent /data/log/unzip/PLK-L01_PLK-L01C432B330b_0000000000_20160926164458_crash
09-26 16:44:58.729 3259-3259/? I/logserver: process_event
09-26 16:44:58.729 3259-3259/? I/logserver: handle_fifo_msg, read res = 460, client pid = 3429, command = send log, data=/data/log/unzip/PLK-L01_PLK-L01C432B330b_0000000000_20160926164458_crash
09-26 16:44:58.729 3259-3259/? I/logserver: handle_fifo_msg, 3429 sent /data/log/unzip/PLK-L01_PLK-L01C432B330b_0000000000_20160926164458_crash
09-26 16:44:58.729 3259-3428/? I/logserver: thread_logcontrol: /data/log/logcontrol has changed.
09-26 16:44:58.729 3259-3428/? I/logserver: handle_notify_event, send msg [submit:trigger=0,bugtype=2,modulename=com.example.david.sensorsole_ble,level=1,testtype=NORMAL,path=/data/log/unzip/PLK-L01_PLK-L01C432B330b_0000000000_20160926164458_crash,mode=1;]
09-26 16:44:58.729 3259-3428/? I/logserver: send_to_client, send to (9) res = 180
09-26 16:44:58.730 3259-3429/? I/logserver: check_dir_size, dir[/data/log/coredump/] doesn't exist
09-26 16:44:58.730 3259-3429/? I/logserver: clean_cur_cache:999, system(rm -r /data/log/logcache/-152364752/* > /dev/null 2>&1)
09-26 16:44:58.743 3433-3447/? W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.huawei.lcagent.client.LogCollectManager.getUserType()' on a null object reference
09-26 16:44:58.743 3433-3447/? W/System.err: at com.android.server.util.ReportTools.getUserType(ReportTools.java:86)
09-26 16:44:58.743 3433-3447/? W/System.err: at com.android.server.util.ReportTools.isBetaUser(ReportTools.java:73)
09-26 16:44:58.743 3433-3447/? W/System.err: at com.android.server.util.ReportTools.report(ReportTools.java:58)
09-26 16:44:58.744 3433-3447/? W/System.err: at com.android.server.util.HwUserBehaviourRecord.appExitRecord(HwUserBehaviourRecord.java:65)
09-26 16:44:58.744 3433-3447/? W/System.err: at com.android.server.am.ActivityManagerService$UiHandler.handleMessage(ActivityManagerService.java:1521)
09-26 16:44:58.744 3433-3447/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
09-26 16:44:58.744 3433-3447/? W/System.err: at android.os.Looper.loop(Looper.java:150)
09-26 16:44:58.744 3433-3447/? W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
09-26 16:44:58.744 3433-3447/? W/System.err: at com.android.server.ServiceThread.run(ServiceThread.java:46)
09-26 16:44:58.744 3433-3447/? E/ReportTools: This is not beta user build
09-26 16:44:58.755 6333-6333/com.example.david.sensorsole_ble I/Process: Sending signal. PID: 6333 SIG: 9
09-26 16:44:58.757 3628-3737/? I/HwSystemManager: NotificationGuideService:handle MSG_ACTIVIY_FOREGROUND, uid:10009
09-26 16:44:58.758 3433-3509/? W/AlarmManager: WAKEUP alarm trigger action = com.android.bluetooth.btservice.action.ALARM_WAKEUP elapsed = 105603873
09-26 16:44:58.793 5819-25376/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.794 5819-25376/? I/Bluetooth: BtGatt.GattService:registerClient() - UUID=6f292b8f-c1cf-4560-a9c1-18ba75a1dfb2
09-26 16:44:58.795 5819-5970/? I/bt_att: GATT_Register
09-26 16:44:58.795 5819-5970/? I/bt_att: allocated gatt_if=7
09-26 16:44:58.795 5819-5970/? I/bt_att: HAL bt_gatt_callbacks7
09-26 16:44:58.795 5819-5883/? W/bt_btif: HAL bt_gatt_callbacks->client->register_client_cb
09-26 16:44:58.795 5819-5883/? I/Bluetooth: BtGatt.GattService:onClientRegistered() - UUID=6f292b8f-c1cf-4560-a9c1-18ba75a1dfb2, clientIf=7
09-26 16:44:58.800 5819-6575/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.800 5819-6575/? I/Bluetooth: BtGatt.GattService:startScan() start scan with filters,callingPackage:com.google.android.gms, isServer=false, appIf=7
09-26 16:44:58.803 5819-6575/? I/Bluetooth: BluetoothUtils:checkCallerHasLocationPermission() callingPackage=com.google.android.gms
09-26 16:44:58.805 5819-6037/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.808 5819-6037/? I/Bluetooth: BtGatt.GattService:stopScan() - queue size =1
09-26 16:44:58.808 5819-5900/? I/Bluetooth: BtGatt.ScanManager:handleMessage - msg.what=1
09-26 16:44:58.811 5819-25376/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.811 5819-25376/? I/Bluetooth: BtGatt.GattService:unregisterClient() - clientIf=5
09-26 16:44:58.811 5819-5970/? I/bt_att: GATT_Deregister gatt_if=5
09-26 16:44:58.811 5819-5970/? I/bt_att: GATT_Listen gatt_if=5
09-26 16:44:58.811 5819-5970/? I/bt_btm: BTM_BleUpdateAdvFilterPolicy
09-26 16:44:58.811 5819-5970/? I/bt_btm: BTM_ReadConnectability
09-26 16:44:58.811 5819-5970/? I/bt_btm: btm_ble_set_connectability mode=0x0 combined_mode=0x1
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:handleStopScan()
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:numRegularScanClients num=0
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:stopRegularScan() stop scan
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isOpportunisticScanClient() clientScanMode=2
09-26 16:44:58.815 5819-5883/? I/bt_btif: BTA_DmBleObserve:start = 0
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - queue=0
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - ScanSetting Scan mode=-2147483648 mLastConfiguredScanSetting=2
09-26 16:44:58.815 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - queue emtpy, scan stopped
09-26 16:44:58.815 5819-5970/? I/bt_btm: BTM_BleObserve : scan_type:0, 8000, 8000
09-26 16:44:58.815 5819-5970/? I/bt_btm: btm_ble_stop_scan
09-26 16:44:58.815 5819-5970/? I/bt_btm: btm_update_scanner_filter_policy
09-26 16:44:58.824 5819-6575/? I/Bluetooth: BtGatt.GattService:startScan() hasLocationPermission=true, hasPeersMacAddressPermission=false
09-26 16:44:58.824 5819-5900/? I/Bluetooth: BtGatt.ScanManager:handleMessage - msg.what=0
09-26 16:44:58.830 5819-5900/? I/Bluetooth: BtGatt.ScanManager:handleStartScan() handling starting scan
09-26 16:44:58.838 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isScanSupported() is true, CallbackType=1
09-26 16:44:58.838 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isBatchClient() is false, CallbackType=1
09-26 16:44:58.838 5819-5832/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.839 5819-5832/? I/Bluetooth: BtGatt.GattService:registerClient() - UUID=6338b151-b155-4440-bda7-874673f24a9a
09-26 16:44:58.839 5819-5970/? I/bt_att: GATT_Register
09-26 16:44:58.839 5819-5970/? I/bt_att: allocated gatt_if=5
09-26 16:44:58.839 5819-5970/? I/bt_att: HAL bt_gatt_callbacks-
09-26 16:44:58.839 5819-5883/? W/bt_btif: HAL bt_gatt_callbacks->client->register_client_cb
09-26 16:44:58.839 5819-5883/? I/Bluetooth: BtGatt.GattService:onClientRegistered() - UUID=6338b151-b155-4440-bda7-874673f24a9a, clientIf=5
09-26 16:44:58.846 5819-6575/? I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
09-26 16:44:58.846 5819-6575/? I/Bluetooth: BtGatt.GattService:startScan() start scan with filters,callingPackage:com.appseleration.android.selfcare, isServer=false, appIf=5
09-26 16:44:58.847 5819-5900/? I/Bluetooth: BtGatt.ScanManager:numRegularScanClients num=1
09-26 16:44:58.847 5819-5883/? I/bt_btif: BTA_DmBleObserve:start = 1
09-26 16:44:58.847 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isOpportunisticScanClient() clientScanMode=2
09-26 16:44:58.847 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - queue=1
09-26 16:44:58.847 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - ScanSetting Scan mode=2 mLastConfiguredScanSetting=-2147483648
09-26 16:44:58.847 5819-5970/? I/bt_btm: BTM_BleObserve : scan_type:0, 8000, 8000
09-26 16:44:58.847 5819-5883/? I/bt_btif: BTA_DmBleObserve:start = 0
09-26 16:44:58.847 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams - scanInterval = 8000configureRegularScanParams - scanWindow = 8000
09-26 16:44:58.847 5819-5970/? I/bt_btm: BTM_BleObserve : scan_type:0, 8000, 8000
09-26 16:44:58.847 5819-5970/? I/bt_btm: btm_ble_stop_scan
09-26 16:44:58.847 5819-5970/? I/bt_btm: btm_update_scanner_filter_policy
09-26 16:44:58.847 5819-5970/? I/bt_btm: BTA_DmBleObserve:sta
09-26 16:44:58.847 5819-5883/? I/bt_btif: BTA_DmBleObserve:start = 1
09-26 16:44:58.847 5819-5970/? I/bt_btm: HAL bt_gatt_callbacks->client->scan_para
09-26 16:44:58.847 5819-5883/? W/bt_btif: HAL bt_gatt_callbacks->client->scan_para
09-26 16:44:58.847 5819-5883/? I/Bluetooth: BtGatt.GattService:onScanParamSetupCompleted : 0
09-26 16:44:58.855 5819-6575/? I/Bluetooth: BluetoothUtils:checkCallerHasLocationPermission() callingPackage=com.appseleration.android.selfcare
09-26 16:44:58.861 5819-6575/? I/Bluetooth: BtGatt.GattService:startScan() hasLocationPermission=true, hasPeersMacAddressPermission=false
09-26 16:44:58.862 5819-5900/? I/Bluetooth: BtGatt.ScanManager:handleMessage - msg.what=0
09-26 16:44:58.867 5819-5900/? I/Bluetooth: BtGatt.ScanManager:handleStartScan() handling starting scan
09-26 16:44:58.871 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isScanSupported() is true, CallbackType=1
09-26 16:44:58.871 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isBatchClient() is false, CallbackType=1
09-26 16:44:58.877 5819-5900/? I/Bluetooth: BtGatt.ScanManager:numRegularScanClients num=2
09-26 16:44:58.877 5819-5900/? I/Bluetooth: BtGatt.ScanManager:isOpportunisticScanClient() clientScanMode=2
09-26 16:44:58.877 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - queue=2
09-26 16:44:58.877 5819-5900/? I/Bluetooth: BtGatt.ScanManager:configureRegularScanParams() - ScanSetting Scan mode=2 mLastConfiguredScanSetting=2
09-26 16:44:58.882 4480-4623/? W/DeviceInfoFile: !devFile.exists()
09-26 16:44:58.889 4480-4623/? I/System.out: [chown, system.log, /log/LogService/3/done/Stabilization_PLK-L01_PLK-L01C432B330b_XTV5KgHi6vBJql0QeNIgJegSp8h3TDisuUJkToMNWvo=_20160926164458_crash_NORMAL.zip]
09-26 16:44:58.889 4480-4623/? I/System.out: null
09-26 16:44:58.889 4480-4623/? I/System.out: null
09-26 16:44:58.889 4480-4623/? I/System.out: Calling by::className:com.huawei.lcagent.util.FileUtils MethodName:runCommand
09-26 16:44:58.906 5819-5990/? I/Bluetooth: BtGatt.GattService:Binder is dead - unregistering client (6)!
09-26 16:44:58.910 3433-3433/? I/TrafficMonitor: update:rxPkts:1,txPkts:2,rxBytes:89,txBytes:178
09-26 16:44:58.910 3433-3433/? I/TrafficMonitor: start expired. level:-1
09-26 16:44:58.910 3433-3433/? I/TrafficMonitor: gettimer:interval=2000
09-26 16:44:58.911 3433-3517/? W/InputDispatcher: channel '72cb1fa com.example.david.sensorsole_ble/com.example.david.sensorsole_ble.ScanActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
09-26 16:44:58.911 3433-3517/? E/InputDispatcher: channel '72cb1fa com.example.david.sensorsole_ble/com.example.david.sensorsole_ble.ScanActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
09-26 16:44:58.911 3433-3792/? W/InputDispatcher: Attempted to unregister already unregistered input channel '72cb1fa com.example.david.sensorsole_ble/com.example.david.sensorsole_ble.ScanActivity (server)'
09-26 16:44:58.914 5819-5899/? I/Bluetooth: BtGatt.AdvertiseManager:message : 1
09-26 16:44:58.915 5819-5899/? I/Bluetooth: BtGatt.AdvertiseManager:stop advertise for client 6
09-26 16:44:58.916 5819-5899/? I/Bluetooth: BtGatt.GattService:onAdvertiseInstanceDisabled() - clientIf=6, status=0
09-26 16:44:58.916 5819-5899/? I/Bluetooth: BtGatt.GattService:Client app is not null!
09-26 16:44:58.917 5819-5899/? I/Bluetooth: BtGatt.AdvertiseManager:app died - unregistering client : 6
09-26 16:44:58.918 3433-3869/? E/HsmCoreServiceImpl: onTransact in code is: 102
09-26 16:44:58.918 3433-3869/? I/MediaProcessHandler: processOp opType: 1, uid: 10097, pid: 6333
09-26 16:44:58.918 3433-3869/? W/MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10097, pid: 6333
09-26 16:44:58.918 5819-5899/? I/Bluetooth: BtGatt.GattService:unregisterClient() - clientIf=6
09-26 16:44:58.918 5819-5970/? I/bt_att: GATT_CancelConnect gatt_if=6
09-26 16:44:58.918 5819-5970/? I/bt_att: gatt_update_auto_connect_dev
09-26 16:44:58.918 5819-5970/? I/bt_att: GATT_Deregister gatt_if=6
09-26 16:44:58.919 5819-5970/? I/bt_btm: BTM_BleUpdateBgConnDev() add=0
09-26 16:44:58.919 5819-5970/? I/bt_att: GATT_Listen gatt_if=6
09-26 16:44:58.919 5819-5970/? I/bt_btm: BTM_BleUpdateAdvFilterPolicy
09-26 16:44:58.919 5819-5970/? I/bt_btm: BTM_ReadConnectability
09-26 16:44:58.919 5819-5970/? I/bt_btm: btm_ble_set_connectability mode=0x0 combined_mode=0x1
09-26 16:44:58.921 4480-4623/? I/System.out: [chmod, 640, /log/LogService/3/done/Stabilization_PLK-L01_PLK-L01C432B330b_XTV5KgHi6vBJql0QeNIgJegSp8h3TDisuUJkToMNWvo=_20160926164458_crash_NORMAL.zip]
09-26 16:44:58.921 4480-4623/? I/System.out: null
09-26 16:44:58.921 4480-4623/? I/System.out: null
09-26 16:44:58.921 4480-4623/? I/System.out: Calling by::className:com.huawei.lcagent.util.FileUtils MethodName:runCommand
09-26 16:44:58.949 4480-4623/? I/System.out: [chown, system.log, /log/LogService/3/uploading/Stabilization_PLK-L01_PLK-L01C432B330b_XTV5KgHi6vBJql0QeNIgJegSp8h3TDisuUJkToMNWvo=_20160926164458_crash_NORMAL.zip]
09-26 16:44:58.949 4480-4623/? I/System.out: null
09-26 16:44:58.949 4480-4623/? I/System.out: null
09-26 16:44:58.949 4480-4623/? I/System.out: Calling by::className:com.huawei.lcagent.util.FileUtils MethodName:runCommand
09-26 16:44:58.970 21899-21899/? I/SendBroadcastPermission: action:com.google.android.googlequicksearchbox.UPDATE_PREDICTIONS, mPermissionType:0
09-26 16:44:58.976 4480-4623/? I/System.out: [chmod, 640, /log/LogService/3/uploading/Stabilization_PLK-L01_PLK-L01C432B330b_XTV5KgHi6vBJql0QeNIgJegSp8h3TDisuUJkToMNWvo=_20160926164458_crash_NORMAL.zip]
09-26 16:44:58.976 4480-4623/? I/System.out: null
09-26 16:44:58.976 4480-4623/? I/System.out: null
09-26 16:44:58.977 4480-4623/? I/System.out: Calling by::className:com.huawei.lcagent.util.FileUtils MethodName:runCommand
09-26 16:44:58.995 2909-3791/? I/[Gralloc]: alloc w[1080] h[1920] format[1] usage[2816]
09-26 16:44:59.000 2909-3791/? I/[Gralloc]: alloc succ handle[0x5561174230] stride[1120]
09-26 16:44:59.000 2909-3791/? I/[Gralloc]: alloc w[1080] h[1920] format[1] usage[2816]
09-26 16:44:59.006 2909-3791/? I/[Gralloc]: alloc succ handle[0x5561174000] stride[1120]
09-26 16:44:59.006 2909-3791/? I/[Gralloc]: alloc w[1080] h[1920] format[1] usage[2816]
09-26 16:44:59.011 2909-3791/? I/[Gralloc]: alloc succ handle[0x55610f0b30] stride[1120]
09-26 16:44:59.014 21899-21899/? I/HwSecImmHelper: mSecurityInputMethodService is null
09-26 16:44:59.015 21899-21899/? I/HwSecImmHelper: mSecurityInputMethodService is null
09-26 16:44:59.021 4480-4622/? E/PackageLogInfoManager: checkPackageLogState, cr: android.app.ContextImpl$ApplicationContentResolver@c0d10d, packageNames: null
09-26 16:44:59.058 32118-10807/? I/AttachedClient: Adding client event 2 to pending list.
09-26 16:44:59.103 21899-21899/? I/HwSecImmHelper: mSecurityInputMethodService is null
09-26 16:44:59.105 21899-21899/? I/HwSecImmHelper: mSecurityInputMethodService is null
09-26 16:44:59.107 21899-21899/? I/HwSecImmHelper: mSecurityInputMethodService is null
09-26 16:44:59.124 5819-5970/? I/bt_btm: btm_identity_addr_to_random_pseudo
09-26 16:44:59.124 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x01
09-26 16:44:59.124 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x19
09-26 16:44:59.124 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x03
09-26 16:44:59.125 5819-5970/? I/bt_btm: btm_identity_addr_to_random_pseudo
09-26 16:44:59.125 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x01
09-26 16:44:59.125 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x19
09-26 16:44:59.125 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x03
09-26 16:44:59.125 5819-5970/? I/bt_btm: BTM_CheckAdvData type=0x01
09-26 16:44:59.125 5819-5970/? I/bt_btm: BTM_InqDbRead: bd addr [f1f96d6a3071]
09-26 16:44:59.125 5819-5970/? I/bt_btm: BTM_CheckEirData type=0x09
09-26 16:44:59.125 5819-5883/? I/bt_btm: BTM_CheckEirData type=0x09
09-26 16:44:59.125 5819-5883/? I/bt_btm: BTM_CheckEirData type=0x09
09-26 16:44:59.126 5819-5883/? W/bt_btif: HAL bt_hal_cbacks->remote_device_properties_cb
09-26 16:44:59.130 5819-5883/? I/Bluetooth: BluetoothRemoteDevices:type=1, val=[B@7814071, val length=21
09-26 16:44:59.130 5819-5883/? I/SendBroadcastPermission: action:android.bluetooth.device.action.NAME_CHANGED, mPermissionType:0
09-26 16:44:59.135 5819-5883/? I/Bluetooth: BluetoothRemoteDevices:Remote Device name is: Adafruit Bluefruit LE
09-26 16:44:59.135 5819-5883/? I/Bluetooth: BluetoothRemoteDevices:type=4, val=[B@c110e56, val length=4
09-26 16:44:59.135 5819-5883/? I/SendBroadcastPermission: action:android.bluetooth.device.action.CLASS_CHANGED, mPermissionType:0
09-26 16:44:59.139 5819-5883/? I/Bluetooth: BluetoothRemoteDevices:Remote class is:7936
09-26 16:44:59.139 5819-5883/? I/Bluetooth: BluetoothRemoteDevices:type=5, val=[B@2257ed7, val length=4
09-26 16:44:59.140 3433-3433/? I/MQoS: onSignal: mSubId=0,currDataSubID=0
09-26 16:44:59.140 3433-3433/? I/MQoS: received cell-signal:4
09-26 16:44:59.140 3433-3525/? I/SendBroadcastPermission: action:android.intent.action.SIG_STR, mPermissionType:0
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetPhoneState:onSignalStrengthsChanged
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetPhoneState: signalStrength:SignalStrength: 0 -2145384446 -97 -9 -1 -1 -1 -1 -1 -1 0 0 0 -1 false gw|lte
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetPhoneState:signal changed signal strength = -97
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetPhoneState: prevSignal:3
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetPhoneState: mSignal:4
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetPhoneState:sendDeviceStateChanged. mService=1 mSignal=4 mRoam=0 mBatteryCharge=3 mSub0OperatorName : Vodafone.de mSub1OperatorName = null
09-26 16:44:59.141 5819-6013/? I/Bluetooth: HeadsetStateMachine:Connected process message: 11, size: 1
09-26 16:44:59.145 5819-5883/? W/bt_btif: HAL bt_gatt_callbacks->client->scan_result_cb
我们非常感谢您提供有关如何改进我的代码的任何建议。特别是找到我的错误。
修改
发现错误,谢谢Rotwang。
用try-catch抛出该错误的代码包围了它现在似乎工作。
还奇怪的是,只有在连接到第二块板时才会发生......
无论如何:数据传输似乎并不能同时工作,因为只有部分UI会改变与最后连接的板相关的信息。
与两个BLE设备建立工作连接需要哪些步骤?