On Jun 2, 2010, at 5:59 AM, Megh wrote:
> Hello, I'm doing a college project on Bluetooth for Android, and I'm
> trying to understand how to manage communication between multiple
> connected devices. Eventually I'm going to develop a multiplayer
> Bluetooth Game.
>
> Currently I've adapted Android's sample app BluetoothChat to connect
> my three Nexxus One phones. 1 connects to 2 who connects to 3 1 sends
> its messages successfully to 2. 3 sends its messages successfully to 2
> as well. 2 can send its messages successfully to 1 and 3, as it shares
> a ConnectedThread with both. But I can't figure out how to handle
> getting communication from 1 to 3.
What you describe here is a simplified version of a "star" pattern. Where
there's one node in the center that all other nodes talk to. Is you intended
design to operate this way, or do you wish to instead form a "mesh" where
everyone can talk directly to everyone else?
If the former, then you need to have code in 2 to relay messages, and you
need to design the message protocol such that there's a sense of recipient
specified in the message. Then 2 can handle messages for itself, and pass on
messages for others.
If the latter, then you simply need to make a direct connection between 1 and
3. The same way 1 connects to 2, connect it to 3.
(Unless there's some reason that only one outgoing connection can exist, in
which case you may be limited to a star formation.)
> Does anyone have any examples of communication between multiple
> devices or has done this themselves? Thanks
Nope. All of the above is design, and I'm afraid I know nothing about
Android bluetooth. I just wanted to clarify what you were intending, so you
could hopefully receive more useful advice.
- Chris
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en