1

I'm currently working on a project for university that really grinds my gears, because it keeps on crashing without giving me any Error in Logcat. I'm using a Huawei Honor 7.

What I want to achieve:
I want to connect 2 Adafruit Feather BLE Boards with my Phone, gather some data and then compare it in order to give the user feedback.

What I've done so far:
connect one of the boards, transmit Data and perform some analysis.
One Board -> no Problem

I looked up what to do in order to connect to multiple devices and found that i need a BluetoothGatt for each. So i tried that, but i had no success with that ... yet.

I also tried to give each BluetoothGatt it's own Callback which didn't make a lot of sense to me, because the devices are supposed to perfom the same tasks. (or am i missing something?) It didn't fix my problem either.

When does it crash?
the crash occurs when i try to connect to the second board. It doesn't matter if i connected to the first board beforehand or not.

Here's my Code:

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();
}

it crashes in the 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();
    }
}

And this is the what the Logcat looks like:

    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

Any suggestions on how to improve my code is highly appreciated. Finding my Error especially.

EDIT:
Error found, thank you Rotwang. Surrounded the code throwing that error with try-catch and it seems to work now. Still strange that this only happens when connecting to the second board...

Anyway: The data Transmission doesn't seem to work simultaneously as only the part of the UI alters which is related to the last connected board.

What steps are needed to have a working connection with two BLE Devices?

David
  • 101
  • 1
  • 1
  • 8
  • `java.lang.NullPointerException: Attempt to invoke virtual method 'int com.huawei.lcagent.client.LogCollectManager.getUserType()' on a null object reference` – Phantômaxx Sep 26 '16 at 15:53
  • but why would that only happen, when i try to connect to the second Board? And why does that happen at all? i'm definetly not calling that method – David Sep 27 '16 at 06:46
  • Some of the methods you are using call that method. So you, indirecly, call that method. – Phantômaxx Sep 27 '16 at 06:48
  • that doesn't answer my first question though. I'm thinking that i am just doing the same thing, with a different GATT, but obviously theres something else going on. – David Sep 27 '16 at 13:19
  • please unmark my question from being a duplicate as that is not what i'm asking for – David Sep 27 '16 at 15:43
  • 1
    @Rotwang I just got the same exception, and although the symptom is a NPE, the underlying cause probably lies only partially (if at all) in the hands of the developer. I would propose not to close this issue as a duplicate, the generic "What is a NPE" answer helps very little here. – Nightscape Oct 07 '16 at 16:40
  • @Rotwang it doesn't make sense to mark this as a duplicate, the question is why a NPE is being thrown here?, I'm having the exact same problem I is very weird. – carrizo Nov 24 '16 at 03:38
  • @carrizo As you **should** know, `Every NPE originates from the same source (an object has been USED BEFORE it has been instanced). And the same solution (instance that object BEFORE USING it)`. Thank you for understanding that *every post about NPEs are duplicates*. Since NPEs don't differ by any means. They are all the same story. – Phantômaxx Nov 24 '16 at 08:33
  • @Rotwang Of course a NPE is thrown when an object is used before instanced, that's basic programming knowledge, my point is that you can not threat every case the same; in this case for example we are dealing with library code that we can not touch and there is not way for us to go and change the android runtime of the phone to solve the problem. By closing this question as duplicate people lose the chance to propose a workaround to prevent the runtime bug from happening. Do you get my point? this looks like a bug specific to Huawei phones and we need a workaround. – carrizo Nov 25 '16 at 02:54
  • If so, there's nothing you can do. Do you get my point? If it is a bug specific to Huawei phones, there's no workaround. – Phantômaxx Nov 25 '16 at 07:45

0 Answers0