This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Android Central connected to 2 peripherals

I have modified the Android Blinky App to connect two peripherals (nRF52 DK)

Scanning and Connecting to two peripherals works.. but when i want to start sending notifications of one of the peripherals the connection is terminated.

in the btsnoop.log I can see that the connection is terminated with "Connection Timeout"..

I am not sure if there is a problem with my implementation or device specific problem.

here is the source code:

        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mDatathroughputUpdateReceiver, makeGattUpdateIntentFilter());
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mDatathroughputUpdateReceiver2, makeGattUpdateIntentFilter());
    Bundle extras = getArguments();
    mDeviceName = extras.getString(DatathroughputService.EXTRA_DEVICE_NAME);
    mDeviceAddress = extras.getString(DatathroughputService.EXTRA_DEVICE_ADDRESS);
    mDeviceName2 = extras.getString(DatathroughputService.EXTRA_DEVICE_NAME2);
    mDeviceAddress2 = extras.getString(DatathroughputService.EXTRA_DEVICE_ADDRESS2);


    mIntentDatathroughput = new Intent(getActivity(), DatathroughputService.class);
    mIntentDatathroughput.putExtra(DatathroughputService.EXTRA_DEVICE_ADDRESS, mDeviceAddress);
    getActivity().startService(mIntentDatathroughput);
    boolean flag = getActivity().bindService(mIntentDatathroughput, mServiceConnection, 0);

   mIntentDatathroughput2 = new Intent(getActivity(), DatathroughputService.class);
    mIntentDatathroughput2.putExtra(DatathroughputService.EXTRA_DEVICE_ADDRESS, mDeviceAddress2);
    getActivity().startService(mIntentDatathroughput2);
    boolean flag2 = getActivity().bindService(mIntentDatathroughput2, mServiceConnection2, 0);
Parents
  • the write command to enable notification has not been sent for both devices (I have checked this with the sniffer) , but on the android monitor I have seen: BluetoothGatt: setCharacteristicNotification() - uuid: 00002a37-0000-1000-8000-00805f9b34fb enable: truefor both devices.

    at the moment i am debuggin my app to find the reason, why the descriptor is not written for both devices.

    is there anything I have to take care when I want to connect to multple devices? delay after connecting to a device etc.?

Reply
  • the write command to enable notification has not been sent for both devices (I have checked this with the sniffer) , but on the android monitor I have seen: BluetoothGatt: setCharacteristicNotification() - uuid: 00002a37-0000-1000-8000-00805f9b34fb enable: truefor both devices.

    at the moment i am debuggin my app to find the reason, why the descriptor is not written for both devices.

    is there anything I have to take care when I want to connect to multple devices? delay after connecting to a device etc.?

Children
No Data
Related