Comments (9)
Anyone else also trying this same sort of thing?
from ble.
Looks like #36 has the same problem with the call to unix.Read()
blocking.
from ble.
A little more info: I am able to do the same thing using Noble, and it is able to connect both peripherals. So it is not a hardware problem.
Here is my Noble node.js code:
var noble = require('noble');
var peripheralIdOrAddress = process.argv[2].toLowerCase();
var peripheralIdOrAddress2 = process.argv[3].toLowerCase();
var p1, p2;
var counter = 0;
noble.on('stateChange', function(state) {
if (state === 'poweredOn') {
noble.startScanning();
} else {
noble.stopScanning();
}
});
noble.on('discover', function(peripheral) {
if (peripheral.id === peripheralIdOrAddress || peripheral.address === peripheralIdOrAddress ||
peripheral.id === peripheralIdOrAddress2 || peripheral.address === peripheralIdOrAddress2) {
counter++;
if (counter > 1) {
noble.stopScanning();
p2 = peripheral;
connect(p1);
connect(p2);
} else {
p1 = peripheral;
}
console.log('peripheral with ID ' + peripheral.id + ' found');
var advertisement = peripheral.advertisement;
var localName = advertisement.localName;
var txPowerLevel = advertisement.txPowerLevel;
var manufacturerData = advertisement.manufacturerData;
var serviceData = advertisement.serviceData;
var serviceUuids = advertisement.serviceUuids;
if (localName) {
console.log(' Local Name = ' + localName);
}
if (txPowerLevel) {
console.log(' TX Power Level = ' + txPowerLevel);
}
if (manufacturerData) {
console.log(' Manufacturer Data = ' + manufacturerData.toString('hex'));
}
if (serviceData) {
console.log(' Service Data = ' + serviceData);
}
if (serviceUuids) {
console.log(' Service UUIDs = ' + serviceUuids);
}
console.log();
}
});
function connect(peripheral) {
peripheral.connect(function(error) {
console.log("connected to ", peripheral.uuid)
});
}
This code is able to run without a problem:
$ node ./examples/multi.js 984fee0f386a f3f26d557108
peripheral with ID 984fee0f386a found
Local Name = FIRMATA
Service Data =
Service UUIDs = 6e400001b5a3f393e0a9e50e24dcca9e
peripheral with ID f3f26d557108 found
Local Name = BB-7108
TX Power Level = -10
Manufacturer Data = 3330
Service Data =
Service UUIDs = 22bb746f2ba075542d6f726568705327
connected to 984fee0f386a
connected to f3f26d557108
I've attached the log from the Noble connection from the equivalent ble code, in case anyone wants to take look and see if there is something I've missed.
from ble.
@deadprogram probably, I will need to close that issue. I have not touched my app which uses BLE, but the last time I ran it it was working well. Looks like the issue was in BlueZ. Plus, on MacOS it worked just fine.
from ble.
I was recently experimenting with the latest ble from the go-ble
fork on a newer system (newer kernel, newer BT adaptor), and I was able to connect to multiple devices without problem. Not sure what the root cause is still of those 2, but I thought I would at least update this issue.
from ble.
I am running into this as well. https://github.com/paypal/gatt is able to handle multiple connections, so it's not the hardware (but I have other issues with that code).
@deadprogram What is the go-ble fork? Do you have a URL?
from ble.
Just curious. Which BLE chip are you all using?
I had problem with CSR chip long time ago, so I have been using Broadcom chip for a long time.
Two different parties I co-worked with recently happened to have problem with using multiple dongles at the same time, and they were all CSR chips.
They are technically two different issues, but hardware may play a part here, too.
from ble.
Hi @Hodapp87 that fork is located here https://github.com/go-ble/ble
@roylee17 is correct about specific hardware sometimes playing a role, in particular older devices.
However I suspect that your issue is likely the same as serveral of mine were. I found that one must be using a newer Linux kernel for ble
to work well. I current use 4.9+ with various hardware, and have had much better success, sometime with the exact same hardware, hence I attribute this to newer kernel versions.
Anyhow, hope that helps!
from ble.
Okay - ignore what I just wrote.
I just tried the code example up top, and as far as I can tell it establishes multiple connections with no trouble (tried on both currantlabs/ble and go-ble/ble). The issue I was having earlier seems to be unrelated - I didn't realize I needed multiple contexts for multiple connections.
I am on a CSR chip and Linux kernel 4.9.86.
from ble.
Related Issues (20)
- SEGV on read
- Project status? HOT 1
- Project description and docs HOT 2
- examples/lib/...
- can't accept: skt: unsupported event packet HOT 1
- notifyhandler
- can't new device : can't init hci: no devices available: (hci0: can't down device: operation not permitted) HOT 3
- support for jsut works pairing ? HOT 2
- Not working on macOS High Sierra HOT 15
- Notifications disconnected after 60 seconds
- is this repo is still live HOT 1
- # master-slave mode conversion
- WriteCharacteristic on Linux Doesn't Appear To Write HOT 7
- Can't dial error locks up device HOT 5
- Specify different HCI device
- OSX does not support MTU key, kCBMsgArgATTMTU
- ReadRSSI linux HOT 1
- Got an unregistered notification || CCCD not found HOT 4
- is it useable for android?
- Can't init device hci0: Function not implemented (38) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ble.