Skip to content

Multiple connections#205

Open
ge-lem wants to merge 3 commits into
don:masterfrom
ge-lem:master
Open

Multiple connections#205
ge-lem wants to merge 3 commits into
don:masterfrom
ge-lem:master

Conversation

@ge-lem

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

Copy link
Copy Markdown

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

@hypery11

Copy link
Copy Markdown

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

@ge-lem

ge-lem commented Apr 12, 2016

Copy link
Copy Markdown
Author

It's only working on Android.

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

I hope it will help you.

@hypery11

Copy link
Copy Markdown

@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

ge-lem commented Apr 12, 2016

Copy link
Copy Markdown
Author

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

hypery11 commented Apr 12, 2016

Copy link
Copy Markdown

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

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

@ge-lem

ge-lem commented Apr 12, 2016

Copy link
Copy Markdown
Author

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

Xeriou commented Apr 15, 2016

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

@lovelyelfpop

Copy link
Copy Markdown

@filipef101

Copy link
Copy Markdown

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

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

@lovelyelfpop

Copy link
Copy Markdown

@filipef101 Doesn't that depend on the host?

@braedongough

Copy link
Copy Markdown

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

@bittelc

bittelc commented Dec 23, 2022

Copy link
Copy Markdown

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

@dominiquejb

dominiquejb commented May 23, 2024

Copy link
Copy Markdown

@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