Recent

Author Topic: LAMW: Problem with two simultaneous Bluetooth connections  (Read 2955 times)

Tomash

  • Newbie
  • Posts: 2
LAMW: Problem with two simultaneous Bluetooth connections
« on: March 27, 2017, 05:06:36 pm »
Hi

I'm trying to connect two devices simultaneously using two jBluetoothClientSocket.

I connect jBluetoothClientSocket1 - it's ok, it receives the data from first device

I connect jBluetoothClientSocket2 - no exceptions, but not received any data from second device.

When close connection on jBluetoothClientSocket1, jBluetoothClientSocket2 return data (buffered?) from second device and works ok.

thanks a lot


EDIT:
I found a simple solution.
In jBluetoothClientSocket.java
instead:
Code: Java  [Select][+][-]
  1. new ASocketClientTask().execute();
should be:
Code: Java  [Select][+][-]
  1. new ASocketClientTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
« Last Edit: April 04, 2017, 06:35:00 am by Tomash »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: LAMW: Problem with two simultaneous Bluetooth connections
« Reply #1 on: April 05, 2017, 12:49:42 am »
Hello Tomash!

I will commit your Solution!

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: LAMW: Problem with two simultaneous Bluetooth connections
« Reply #2 on: April 05, 2017, 08:09:06 am »

Done!

Added new

jBluetoothClientSocket.Connect(_executeOnThreadPoolExecutor: boolean);

Thank you!



Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018