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
  • Hi schoensn,

    I tested with 2 peripheral pretty long ago and it worked on my phone ( was samsung galaxy S4 at that time). I haven't seen how you connect and attach Bluetooth Gatt Services to each connection in the code snippet . Maybe you want to make a simple app that connect to say an peripheral example in the SDK (hrs for example) so that I can test here for you just to check if it's the issue with your Android device.

Reply
  • Hi schoensn,

    I tested with 2 peripheral pretty long ago and it worked on my phone ( was samsung galaxy S4 at that time). I haven't seen how you connect and attach Bluetooth Gatt Services to each connection in the code snippet . Maybe you want to make a simple app that connect to say an peripheral example in the SDK (hrs for example) so that I can test here for you just to check if it's the issue with your Android device.

Children
No Data
Related