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.
Related
In Bluetooth, specifically 4.0 LE (if this changes anything), what is the way to send data both ways, from master to slave and from slave to master?
What kind of protocol is it better to design? Can you please provide an example of an application level protocol that is typically used in this scenario?
In this case, should the peripheral run two services, one used for sending data to the device and another to receive data from the device? (The "device" is the peripheral/slave).
The most forward way of doing this would be to define a custom service which defines the data types and fields and access you need as characteristics, and implement this on both the peripheral and central. If you are looking for a symmetric system, you can implement the same service on both sides. If there is differences in how the two devices access/send data, you can implement two different services, suiting your needs. Either way, you will need both the slave and master peripherals to support both GATT server and GATT client.
Depending on what you want to do, you could either push data using notifications (unconfirmed, you may miss updates on the receiving side) or indications (confirmed, the receiving side will have to acknowledge the push), or you could pull the data using read commands. You could also combine these in various ways, and you could implement access to different data in different ways in your service(s).
I recommend taking a look at the different Bluetooth Low Energy vendors' dev kits and APIs, as well as the different phone/tablet APIs and examples, depending on which platform you aim to develop on/ are familiar with.
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.
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.
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
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".