-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect to multiple devices at the same time #58
Comments
Right now the plugin supports one connection at a time. Connecting to multiple devices is possible, but will require code changes. |
I'd be interested in this as well. Don - is there anyway we can add this as a feature request? |
This is also some functionality I could really use in my own project. I'm a long time web developer but I've never done any native mobile development. Can anyone elaborate on just what sort of a task adding multiple clients would be? Are we talking adding a couple new functions or a fairly involved rewrite/refactoring? |
It's doable to have this connect to multiple client connections but not trivial. You need to keep track of which callbacks go to which client. I'm working on a new BLE plugin and it should support multiple connections, but adding multiple connections to this plugin isn't high on my priority list right now. |
If you're doing Bluetooth Low Energy try Cordova BLE Plugin which supports simultaneous connections to multiple peripherals on iOS and Android. |
Hi @don is there an example anywhere of how one might connect to multiple peripherals? |
@rosterloh Basically you can just call connect() multiple times. When you use the BLE plugin you're responsible for managing the device ids, since they need to be passed into every call. Here's a rough example on a branch. I hope to add a better example later. |
Awesome, I'll give it a test. Thanks! On Tue, Sep 23, 2014 at 8:29 AM, Don Coleman notifications@github.com
Kind ReKind Regards |
Any further update/hope/news on having this work with more-than-one connect at a time? |
@stakutis I'm mostly work with BLE lately. My BLE plugin will do multiple simultaneous connections. I don't expect it will get added to this plugin unless a client needs it. |
Thanx. I suppose the BLE Plugin will not work with devices are not BLE, Chris Stakutis On Mon, Feb 9, 2015 at 3:30 PM, Don Coleman notifications@github.com
|
@stakutis it sounds like your device is bluetooth classic. If it works with this plugin and Android it's Serial Port Profile (SPP). Some devices support Classic and BLE, but most don't. Newer Android devices with 4.3+ can support BLE, but your PEF meter probably doesn't do BLE. |
What about double-instantiation...? (To allow more-than-one Connect at a Chris Stakutis On Mon, Feb 9, 2015 at 4:31 PM, Don Coleman notifications@github.com
|
Should have responded to this a few months back when I got it working. I essentially did what stakutis is suggesting but had to take it a step further and change variable names in the android src files. The coee on the client side is ugly but the functionality was great! |
Thanx! What variable names did you have to change? I have no problem with simply Chris Stakutis On Tue, Feb 10, 2015 at 7:59 AM, darudude notifications@github.com wrote:
|
I'll have to check once I get to my computer. Haven't touched that code On Tue, Feb 10, 2015, 08:04 stakutis notifications@github.com wrote:
|
Alright - not sure of the exact steps I ran through to accomplish this (it was back in August and finally managed to get it work late into the night). However, here are the differences:
I believe that is it. There doesn't seem to be any changes to the java files as I originally thought. |
So what i did...and I think it works but I dont have a 2nd device...was I But I have only one device to play with...I was able to connect/read from Chris Stakutis On Tue, Feb 10, 2015 at 8:23 AM, darudude notifications@github.com wrote:
|
For those that are still looking for a work around and stumble upon this thread, this is what you want to do to sort yourself out. In
In my case I had to run Then in your JS code you can run
First param is the success callback, then the error callback. Next 3 are the important ones. You specify the instance name of the class, then the method name, then an array of arguments to pass to that method. In my example the |
Not really sure what you're asking, but this article is really good at Chris Stakutis On Fri, Jan 15, 2016 at 1:05 AM, endoplasmic notifications@github.com
|
Hey Don...will your bluetooth stuff work on windows10? can windows10 Chris Stakutis On Fri, Jan 15, 2016 at 7:38 AM, Chris Stakutis chris.stakutis@gmail.com
|
@stakutis I have a pull request from @Davide-sd that adds Windows 10 support. I need to get that merged. Window 10 will support Bluetooth Classic. |
Excellent! How soon? We have a big project and needs the support right Chris Stakutis On Wed, May 25, 2016 at 3:54 PM, Don Coleman notifications@github.com
|
And this way we can connect simultaneously with a maximum of seven devices, right? If i understand correctly, that is the limit of connections for bluetooth. Does anyone know from experience? Thanks. |
Hi, first of all, thanks so much @don for your plugin. I just started playing around with it on an Ionic app. |
You can use the teraterm serial terminal to view and connect multiple bluetooth devices and view the data they send at a time by opening multiple instances of teraterm and connecting the corresponding bt to serial port link |
I know many years passed, but today i faced neet to connect 2 phones ( this is possible also with pc if you have bluetooth ). If any of you seeks a solution how to communicate between 2 phones useng cordova in 2022, this works: https://github.com/bugnano/cordova-plugin-networking-bluetooth |
@Fomenko-developer I am currently trying to develop this feature for an app (android to android bluetooth connection) with no success so far. It would be very helpful for me if you could assist me or send any relevant documentation! Regards! |
@AbrilDAngelo Here is the repo with working sample: connect and send data to second device ( it will show the selected color ). |
Thank you very much for your help and quick response! I'm going to check it out right now! |
@AbrilDAngelo going to sleep now, if u will have any questions, will respond tomorrow |
@AbrilDAngelo did it help you? Sorry, to the author for spaming here |
I am able to successfully connect and read from a single device at a time using the plugin. Does the plugin support being able to connect and read data from multiple Arduino devices at the same time ? I am using Arduino Uno board with serial communication to an cordova application on Android. When I try to connect to multiple devices after pairing them, I cannot connect to either device. If I only attempt connection to a single device at a time, the connection and data read works.
The text was updated successfully, but these errors were encountered: