Anybody knows if a BLE peripheral can accept multiple connections? And would it be possible to scan for a peripheral while it is connected? Can a device advertise while connected?
Best regards, Micke
BLE and multiple connections
Re: BLE and multiple connections
Hi,
I am having the same question...
Not knowing if it can technically be done I will try to start two instances of the client App and sees if both can connect to a different sensor tag.
Any other suggestions on how to make this work?
regards
I am having the same question...
Not knowing if it can technically be done I will try to start two instances of the client App and sees if both can connect to a different sensor tag.
Any other suggestions on how to make this work?
regards
Re: BLE and multiple connections
Hi, how did the experiment go? Would be cool if it worked.
I think that you cannot do multiple connections to BLE devices in general, but I wonder if it would be possible to design a BLE device that could both be in announce mode and at the same time accept multiple connections? Perhaps there is something in the design of BLE that prevents that?
Best, Mikael
I think that you cannot do multiple connections to BLE devices in general, but I wonder if it would be possible to design a BLE device that could both be in announce mode and at the same time accept multiple connections? Perhaps there is something in the design of BLE that prevents that?
Best, Mikael
Re: BLE and multiple connections
Hi,
It worked perfect.
But, what I had to do was to use 3 buttons to manually connect one-by-one. If I have them all 3 connected as part of the page load it only ends up with a connection with the last tag. I assume that I should have respected some time interval before connecting the next one but since a manual approach (pressing a button to connect) works for me that solved the question.
The basic thing was to declare 3 objects:
and then have a button per tag that executes a start for the tag:
and have this function for the AddEventListener:
Works just fine.
It worked perfect.
But, what I had to do was to use 3 buttons to manually connect one-by-one. If I have them all 3 connected as part of the page load it only ends up with a connection with the last tag. I assume that I should have respected some time interval before connecting the next one but since a manual approach (pressing a button to connect) works for me that solved the question.
The basic thing was to declare 3 objects:
Code: Select all
// SensorTag object.
var sensorTag_1 = new TISensorTag.createInstance()
var sensorTag_2 = new TISensorTag.createInstance()
var sensorTag_2 = new TISensorTag.createInstance()
and then have a button per tag that executes a start for the tag:
Code: Select all
function start1()
{
sensorTag_1.connectToKnownDevice("C70C0D0F-CB9A-D7B7-3683-2CB07ED3E40D");
}
and have this function for the AddEventListener:
Code: Select all
function initialiseSensortags()
{
sensorTag_1.statusCallback(statusHandler1);
sensorTag_1.errorCallback(errorHandler1);
sensorTag_1.accelerometerCallback(accelerometerHandler1, 100);
sensorTag_2.statusCallback(statusHandler2);
sensorTag_2.errorCallback(errorHandler2);
sensorTag_2.accelerometerCallback(accelerometerHandler2, 100);
sensorTag_3.statusCallback(statusHandler3);
sensorTag_3.errorCallback(errorHandler3);
sensorTag_3.accelerometerCallback(accelerometerHandler3, 100);
}
Works just fine.
Re: BLE and multiple connections
Great! Thanks for sharing!
Micke
Micke
Return to “Questions and answers”
Who is online
Users browsing this forum: No registered users and 51 guests