how to programatically determine Bluetooth master/slave roles? - bluetooth

So in a bluetooth piconet, there is one master with upto seven slaves. The master sets the clock and frequency hop that the slaves sync with. But is there a way to determine which device is the master and which is the slave? I'm mainly interested in portable devices (Android,iPhone) but beggars can't be choosers, if anybody has info in this field I would be interested.
Thanks

I don't think it's possible to do it programatically.The master/slave roles which a device assumes is invisible to the user(application).The same device can act as a master of one piconet and a slave in an (adjacent) piconet.What needs to be decided in your application is whether the device will act as a client or a server or both and what will be the services(profiles) that it supports.

It depends on the platform you are using.
It should be possible to read the information associated with a connected device and the role of the device should ideally be part of that information in the API.
So if the connected device is Primary you can infer that you are secondary and so on.
-Dennis

Related

Maximum number of BLE sensors that could be connected to a BLE gateway at a given instant?

I have this doubt. For example, I have a Smart Wrist Band (measures pulse, body temp), a Smart Gear/Watch (to display text alerts, control calls) and a Bluetooth headset. I need all the three to communicate with my mobile phone at the same given instant.
Is it possible to achieve the same ?
What are the challenges involved if I need to develop an application on my own if I had to achieve the above possibilities ?
Your help is highly appreciated.
Note:
- BLE has star-based network topology and maximum devices per Piconet is 8 including the Master
- Please help me in understanding/visualizing the above theory that I learnt.
Thanks.
The Bluetooth Classic has a limitation of 7 slave devices in a piconet and they are time and hop synchronized to the master ( ie master and slaves share a common physical channel and it is not possible to address more than seven slaves for a master when in Active mode).
In BLE each connection from a master to a slave operates in an independent physical channel( ie LE slaves does not share a common physical channel with the master), hence there is no limitation imposed by the Specification except as specified by the Connection interval and slave latency rules ( Note that individual bluetooth controller manufacturers may decide to limit the number of connections depending on the practical bandwidth limitation).
please see the Bluetooth Classic vs Bluetooth Low energy Topology below.
Is it possible to achieve the multiple sensors ( BLE) and Headset (BT classic) connected to mobile?
Yes it is very much possible, except that there are some BT4.0 controllers which doesn't allow LE advertisement while connected to another BLE device. please check the known limitations in a particular bluetooth controller.
It's the Bluetooth controller that has the limitation. Different Bluetooth controllers have different maximum number of concurrent connections. It's usually between 5 and 14. However Android has an additional hardcoded limit of 10 for some strange reason.
Other than this, there shouldn't be any particular challenges.

Bluetooth piconet

I have read about piconets and scatternets. However, everywhere I've checked I do not find anything that relates a "piconet" to a specific profile, say SPP.
My understanding is that the formation of a piconet is profile independent.
Secondly, if I have formed a piconet of upto 3 slaves, can I simply broadcast to all 3 slaves? Or do I have to unicast to multiple slaves i.e. implement TDM?
Thanks,
Angelo.
You are right - Piconets and scatternets have nothing to do with Profiles.
They are just terminologies to define the topology of Bluetooth devices in connections.
Profiles define model and protocol for for the application level data transfers.
Yes you can broadcast to all slaves in a piconet provided the Bluetooth stack supports the functionality.

Is there possible for communicate between piconet to another piconet

In my previous question posted in how to communicate with mobile devices using bluetooth in j2me have asked question based on bluetooth. I got i some ideas for implementing client server communication. Now i am here to ask question based on communication between piconet to another piconet. Is it possible? Master device has to communicate with the slave in a piconet as well as to the master and slave to another piconet by slave of its own piconet.
Can anyone please give me some guideline and articles for my problem.
please help me..
Thankx in advance
In Bluetooth, the master initiates communications with a slave. At the baseband level the master polls the slave. However, at the application (API) level, that is abstracted away allowing both the master to send to the slave and the slave to send to the master.
The situation you describe is a scatternet. The Bluetooth specification allows for a scatternet to occur. The Bluetooth stack you are using may impose restrictions on whether a scatternet is allowed and, more generally, what master/slave configurations are allowed (e.g., the number of concurrent slaves allowed).
You'll find that, when interacting with some devices, a role switch is requested to prevent scatternets. For example, a remote device (master) may initiate a connection with a cell phone (slave); once the connection is established, the cell phone requests a role switch, becoming the master. This allows the phone to remain the master in all connections and prevents scatternets from forming. Depending on the API, this role switch may be completely transparent to your application. You won't know it happened without an air trace from a protocol analyzer. You will notice a performance hit, as the slave cannot transmit as often as the master can (since the slave does not "drive" the connection).
JSR-82 does not allow you to request a role switch, per se. If you look at ServiceRecord.getConnectionURL(int, boolean), you see that you can require that your device be the master (by passing true) or you can allow master or slave mode (by passing false).
The Bluetooth specification (available here) is a good place to start to understand how piconets and scatternets work. You should refer to the JSR-82 documentation and, if possible, your stack's documentation to get a better feel for some of the stack-specific limitations that may be present.

Can Bluetooth masters be connected together?

I am wondering if two Bluetooth masters can be connected to each other.
I think it is not possible because there should be only one master in each piconet.
Anyways, here is one scenario.
Suppose that there are two smart phones, each one is using bluetooth headset or connected to some device, thus both phones are working as masters.
Now, one smart phone wants to send files via bluetooth to the other smart phone.
In this case, is it possible that the phones are connected?
If they support role switch, one may be switched to a slave.
But in this case, I think the already established connections would be broken because they will lose the master.
If I want to send files from one master to another master, how can I do this?
Is it possible or impossible??
Bluetooth can support the capability called "Scatternet" which basically allows the devices to be part of multiple piconet (typically I have seen 2-3 piconets)
With this a device can be a master in one piconet and slave in another or slave in 2 piconets, ect.
So the scenario you mentioned is possible if one of the phone can support scatternet.

'Conference' type operations using Bluetooth?

Is it possible to implement Bluetooth devices to provide conference rather than one-to-one operation.
Are there any development toolkits that will allow me to configure BT devices in this way, or modifications that can be done to the BT stack or an add-on protocol.
I need to configure several Bluetooth adaptors to simultaneously communicate with one another. I think BT allows up to 10 'pico-nets' but I need specialiced advice.
I would welcome any links to resources, or replies from Bluetooth experts.
Thanks in anticipation.
I've heard of something close to this, called a piconet. Googling "bluetooth piconet" should point you in the right direction.
A master device can be networked in this way with up to 255 slave devices, but only 7 can be active at any one time. This is more of a one-to-many communication than many-to-many, but could potentially be approximated by having the master device act like a network switch.
Update: I just read that slaves in one piconet can participate in another piconet as either a master or slave, forming a "scatternet".

Resources