Skip to content
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

Multiple connections #205

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Multiple connections #205

wants to merge 3 commits into from

Conversation

ge-lem
Copy link

@ge-lem ge-lem commented Mar 10, 2016

Just create context in order to allow multiple connections.
It keeps full backward compatibility with the original version.

@hypery11
Copy link

Is there any example that can POC multi connection?
I've already try too many times, still not working now.

@ge-lem
Copy link
Author

ge-lem commented Apr 12, 2016

It's only working on Android.

Here is the small ionic project I created to test it.
https:/Shikoruma/blueserialtest

I hope it will help you.

@hypery11
Copy link

@Shikoruma
WOW~
Hey dude, you are pretty fast,
I am not sure that ionic could porting to cordova directly,

my goal is to create 2 serial port connection over bluetooth,
this is my testing code snippet

In my case, when I start the second connection, the first connection will be colsed.

Thanks .

@ge-lem
Copy link
Author

ge-lem commented Apr 12, 2016

Ionic plugin are in fact cordova plugin.

From your code snippet I don't see were the error is comming from.
Are you sure you're giving two different addresses ?

I cant test your code with just the js file

@hypery11
Copy link

hypery11 commented Apr 12, 2016

Oops, belowing are my whole cordova project file.
bluetooth-serial-test.zip

Thanks a again.
I'm very appreciate for your help.

@ge-lem
Copy link
Author

ge-lem commented Apr 12, 2016

Ok I found my mistake.

isConnected take also a macAdress because you want to test a particular connection.
I forgot to change de Readme for this function, I update it.
So change your
bluetoothSerial.isConnected(disconnect, connect);
to
bluetoothSerial.isConnected(disconnect, connect,app.macAddress2);

I also forget to test if the given address is actualy in the context map.
I also fixed it, so update my plugin and it should work now.

Thank you for pointing that issue.

@Xeriou
Copy link

Xeriou commented Apr 15, 2016

Hi, Shikoruma
I'm @hypery11 's co-worker,
We have problem on a SPP Client Project
(It work's now)
But I have a question

when I use function openPort in your example
there has 4 arg -> delimeter , success call back , fail call back , macAddress
so , I write

app = {
...
openPort: function() {

app.display("Connected to: " + app.macAddress);

connectButton.innerHTML = "Disconnect";

bluetoothSerial.subscribe('\n', 
    function (data) {
        app.clear();
        app.display(data);

    },app.showError,app.macAddress);

},

openPort2: function() {

app.display("Connected to: " + app.macAddress2);

connectButton.innerHTML = "Disconnect";

bluetoothSerial.subscribe('\n', 
    function (data) {
        app.clear();
        app.display(data);

    },app.showError2,app.macAddress2);

},
...
}

this code is no work for me,
when I connect the first device,
It works , but when I connect the second device,
the first will lost connect ...

BUT !!!

When we change to this code

app = {
...
openPort: function() {

app.display("Connected to: " + app.macAddress);

connectButton.innerHTML = "Disconnect";

bluetoothSerial.subscribe('\n', 
    function (data) {
        app.clear();
        app.display(data);

    },app.macAddress)//different here!! ;

},

openPort2: function() {

app.display("Connected to: " + app.macAddress2);

connectButton.innerHTML = "Disconnect";

bluetoothSerial.subscribe('\n', 
    function (data) {
        app.clear();
        app.display(data);

    },app.macAddress2) //different here;

},
...
}

Strangely, It works @@"....
But, I can not find any problem in your java source and javascript lib (it's actually 4 args...)

Anyway, thanks for your help @w@/

@darran-kelinske-fivestars

Thank you for the PR - there are a couple of merge conflicts. Appreciate you making this PR! <3

@lovelyelfpop
Copy link

@filipef101
Copy link

Try this plugin bugnano/cordova-plugin-networking-bluetooth

@lovelyelfpop Does that support multiple clients connect to a host?

@lovelyelfpop
Copy link

@filipef101 Doesn't that depend on the host?

@braedongough
Copy link

@bittelc I think this looks good. What do you think @dominiquejb

@bittelc
Copy link

bittelc commented Dec 23, 2022

Ya, looks fine to me @braedongough , let's send it through.

@dominiquejb
Copy link

dominiquejb commented May 23, 2024

@braedongough @bittelc still waiting for your improvements as discussed last tactical sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants