Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Can 3 Bluetooth devices talk to single android cell phone app?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 8 - Last Post: May 17, 2017 12:38 PM Last Post By: Arnaldo Caliari
Jorge Uriarte

Posts: 41
Registered: 11/28/14
Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2017 8:42 AM
Hi there,
I have used the Classic Bluetooth Basic App sample and successfully communicate from the phone to my Bluetooth device. Is there a way or technique for the same app to communicate with 2 more Bluetooth devices at the same time?
I will appreciate any comments.
Thank you, Jorge

Edited by: Jorge Uriarte on May 16, 2017 8:45 AM

Edited by: Jorge Uriarte on May 16, 2017 8:46 AM
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Can 3 Bluetooth devices talk to single android cell phone app? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2017 9:50 AM   in response to: Jorge Uriarte in response to: Jorge Uriarte
Am 16.05.2017 um 17:47 schrieb Jorge Uriarte:
Hi there,
I have used the Classic Bluetooth Basic App sample and successfully communicate from the phone to my Bluetooth device. Is there a way or technique for the same app to communicate with 2 more Bluetooth devices at the same time?
I will appreciate any comments.
Thank you, Jorge

Hello,

I don't know your exact problem, but isn't that just creating (or
dropping them on a form) additional instances of the Bluetooth
component? One for each required connection?

Greetings

Markus
Jorge Uriarte

Posts: 41
Registered: 11/28/14
Re: Can 3 Bluetooth devices talk to single android cell phone app? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2017 10:12 AM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:
Am 16.05.2017 um 17:47 schrieb Jorge Uriarte:
Hi there,
I have used the Classic Bluetooth Basic app sample and successfully communicate from the phone to my Bluetooth device. Is there a way or technique for the same app to communicate with 2 more Bluetooth devices at the same time?
I will appreciate any comments.
Thank you, Jorge

Hello,

I don't know your exact problem, but isn't that just creating (or
dropping them on a form) additional instances of the Bluetooth
component? One for each required connection?

Greetings

Markus

Markus, I wish it would be as simple as dropping a component, but the Classic Bluetooth Basic app sample included in Delphi Berlin doesn't have a Bluetooth component in it. I wish it would, and thank you for responding.
Arnaldo Caliari

Posts: 5
Registered: 9/28/12
Re: Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2017 11:38 AM   in response to: Jorge Uriarte in response to: Jorge Uriarte
Jorge Uriarte wrote:
Hi there,
I have used the Classic Bluetooth Basic App sample and successfully communicate from the phone to my Bluetooth device. Is there a way or technique for the same app to communicate with 2 more Bluetooth devices at the same time?
I will appreciate any comments.
Thank you, Jorge

I have two years of tests and failures on Bluetooth LE devices , not on Classic ones. I can only tell you that is possible to connect / send / receive data to 3 BLE devices simultaneously from the same Android App. It has some tricks in it, but it's possible. But i don't know if it's the same for Classic devices.
Jorge Uriarte

Posts: 41
Registered: 11/28/14
Re: Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2017 2:05 PM   in response to: Arnaldo Caliari in response to: Arnaldo Caliari
Arnaldo Caliari wrote:
Jorge Uriarte wrote:
Hi there,
I have used the Classic Bluetooth Basic App sample and successfully communicate from the phone to my Bluetooth device. Is there a way or technique for the same app to communicate with 2 more Bluetooth devices at the same time?
I will appreciate any comments.
Thank you, Jorge

I have two years of tests and failures on Bluetooth LE devices , not on Classic ones. I can only tell you that is possible to connect / send / receive data to 3 BLE devices simultaneously from the same Android App. It has some tricks in it, but it's possible. But i don't know if it's the same for Classic devices.

Arnaldo, Since My project is fairly new maybe I should change to Bluetooth LE and have better luck. Could you send me a sample or guide me how to go about connecting to 3 BLE devices to the same Android App? Thanks
Jorge
Arnaldo Caliari

Posts: 5
Registered: 9/28/12
Re: Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2017 5:11 AM   in response to: Jorge Uriarte in response to: Jorge Uriarte
Arnaldo, Since My project is fairly new maybe I should change to Bluetooth LE and have better luck. Could you send me a sample or guide me how to go about connecting to 3 BLE devices to the same Android App? Thanks
Jorge

Jorge, i can suggest the following things... some of them derive from tries, not from "strict" Android or BLE rules. There are things that simply "don't work" reliably in a real production Android app with Firemonkey.

We have developed this app,

https://play.google.com/store/apps/details?id=eu.studiosoft.Ramengobike

and we need the constant connection / read of some BLE devices for maaany hours. Now we have the underlyng BLE system that works with 3 devices ( fingers crossed...).

1) you have to use only ONE TBluetoothLE / TBluetoothDeviceDiscoveryManager component for the entire app. You can choose one of the two, or you can create at runtime the component as you like ( watch the BLE demos in Delphi) , but use only ONE.

2) When you try to discover BLE devices, you have to look for ALL of THEM. You can't discover one and connect to it, and after a couple of minute search / discover another one and add the second connection, and after some seconds the third one. If you need 3 different devices, you must discover / find all 3. If you discover only 1 or 2, you must restart the entire search / discovery for all 3.

3) when you connect / read / subscribe to a device, remember to unsubscribe / disconnet prior to a new search / discovery.

4) the connect / subscribe part has different speed for every different device, we have tried many different BLE models. So, you have to wait in some way to a) grant the time to discover devices b) grant the time for every device to connect c) verify that are all connected / subscribed d) repeat the sequence if one of the devices is stuck in a transient state.

5) BLE devices come and go, as they want. You have to check frequently that a device is always connected. You know what devices you use, and so you can find a clever way to know if a device is "online"

6) the BLE usage in Android had rules in Android 4.3, changed in some details in Android 5, and changed also in Android 6. So, test all platforms if you can.

7) use Google and search for doubts ALWAYS. The Firemonkey documentation for BLE is not so detailed, you have to find examples / blogs / questions that are from people using Java, and try to apply the suggestions in your source.

8) if you don't plain to have a service in your app, use (if similar devices are there...) the BLE components that you find in GetIt PackageManager. Look for their demos, even if you don't use them directly in your app.

Take all these suggestions, but please consider that we are still learning to fight the BLE nightmare....

Regards

Arnaldo
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2017 8:46 AM   in response to: Arnaldo Caliari in response to: Arnaldo Caliari
Hello,

thanks for these tips. Have you reported all the issues you found with
this technology into Quality Portal?
If not please create individual reports for all of them and report the
numbers back here so we can follow them and vote for them.

Greetings

Markus
Arnaldo Caliari

Posts: 5
Registered: 9/28/12
Re: Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2017 12:38 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:
Hello,

thanks for these tips. Have you reported all the issues you found with
this technology into Quality Portal?
If not please create individual reports for all of them and report the
numbers back here so we can follow them and vote for them.

Greetings

Markus

Markus, i feel i'm not good enough as a programmer... and my recurring problem is that i don't know if those are issues, or simply my faults. It's a complicate matter.... Who knows if certain behaviours are caused by errors or not ? I don't want to increase the "noise ratio" on Quality Portal (and i can assure you that 99% of times it's always me that create a bug in my code...).

The only thing that i'm quite sure it's a "issue" is this one

https://quality.embarcadero.com/browse/RSP-18088

that is some way related.

Regards

Arnaldo

Jorge Uriarte

Posts: 41
Registered: 11/28/14
Re: Can 3 Bluetooth devices talk to single android cell phone app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2017 10:21 AM   in response to: Arnaldo Caliari in response to: Arnaldo Caliari
Arnaldo Caliari wrote:
Arnaldo, Since My project is fairly new maybe I should change to Bluetooth LE and have better luck. Could you send me a sample or guide me how to go about connecting to 3 BLE devices to the same Android App? Thanks
Jorge

Jorge, i can suggest the following things... some of them derive from tries, not from "strict" Android or BLE rules. There are things that simply "don't work" reliably in a real production Android app with Firemonkey.

We have developed this app,

https://play.google.com/store/apps/details?id=eu.studiosoft.Ramengobike

and we need the constant connection / read of some BLE devices for maaany hours. Now we have the underlyng BLE system that works with 3 devices ( fingers crossed...).

1) you have to use only ONE TBluetoothLE / TBluetoothDeviceDiscoveryManager component for the entire app. You can choose one of the two, or you can create at runtime the component as you like ( watch the BLE demos in Delphi) , but use only ONE.

2) When you try to discover BLE devices, you have to look for ALL of THEM. You can't discover one and connect to it, and after a couple of minute search / discover another one and add the second connection, and after some seconds the third one. If you need 3 different devices, you must discover / find all 3. If you discover only 1 or 2, you must restart the entire search / discovery for all 3.

3) when you connect / read / subscribe to a device, remember to unsubscribe / disconnet prior to a new search / discovery.

4) the connect / subscribe part has different speed for every different device, we have tried many different BLE models. So, you have to wait in some way to a) grant the time to discover devices b) grant the time for every device to connect c) verify that are all connected / subscribed d) repeat the sequence if one of the devices is stuck in a transient state.

5) BLE devices come and go, as they want. You have to check frequently that a device is always connected. You know what devices you use, and so you can find a clever way to know if a device is "online"

6) the BLE usage in Android had rules in Android 4.3, changed in some details in Android 5, and changed also in Android 6. So, test all platforms if you can.

7) use Google and search for doubts ALWAYS. The Firemonkey documentation for BLE is not so detailed, you have to find examples / blogs / questions that are from people using Java, and try to apply the suggestions in your source.

8) if you don't plain to have a service in your app, use (if similar devices are there...) the BLE components that you find in GetIt PackageManager. Look for their demos, even if you don't use them directly in your app.

Take all these suggestions, but please consider that we are still learning to fight the BLE nightmare....

Regards

Arnaldo

Arnaldo, thanks a lot for these tips. Since you manage to connect to 3 BLE devices to one App, maybe the same can be done with my single Classic Bluetooth. The 3 devices that I need to connect to are all the same but with different names, like device1, device2, device3. Save the instances (if possible), and try to communicate in sequence. It's worth the try. Again thanks for your responding with so many details. I will leave this unanswered if there are other suggestions
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02