I started to work on a game application for iphone where minimum four player participate in this game , they will be connected via their BT.
my problem is that i got some sample code for connecting 2 device only (VIA bluetooth) but i m looking for connecting at least four devices,
any idea plz share if any tutorial or sample code, will be better for me.
Thanks,
Related
I need some guidance. In a nutshell, I need to be able to configure and control a device with the smart phone app over BLE.
For example, change IP address of my Raspberry Pi. To make that happen, I need 2 things.
Simple Android/iOS app that takes IP address parameters as an input, and then communicates over Bluetooth to the RPi. Note that the device needs to be discovered and connected from within the app (without going to "Settings" and pairing).
Build some server process on the Raspberry Pi that listens to USB Bluetooth dongle, receives the command with parameters and acts accordingly.
So I need help building the BLE portion of this project.
I have several years of smartphone app development experience, and 10+ years of Linux system programming. In other words, building a simple Cordova app, as well as Linux process that changes IP address is really not an issue.
However, I am totally new to Bluetooth. Can you point me to the right direction? I am sure this problem has already been solved few thousand times. Is there a tutorial? Or maybe a skeleton code I use as a starting point? Also, any recommendation for BLE USB dongle?
Thanks a lot!
I think it will be harder to find a better guide to implement low energy technology on the RaspberryPi than this one :
https://learn.adafruit.com/downloads/pdf/pibeacon-ibeacon-with-a-raspberry-pi.pdf
After this , you can download a random app on the Playstore/Appstore and check that your RaspberryPi is actually acting as a BLE device.
Finally you can start creating your own app using several available BLE plugins like :
https://github.com/randdusing/BluetoothLE
https://github.com/don/cordova-plugin-ble-central
I'm not sure how to correctly phrase this question, as I'm just starting to learn Bluetooth and its ways, but... imagine holding in an iPhone or Android phone in your hand in a large building with many rooms. You pair your device with a Bluetooth master device via an antenna in that room. Then once you move from room to room, your device communicates with other antennas throughout the building, but the device treats it as one pairing.
Is this at all possible? Was Bluetooth developed with this in mind at all?
Would this still work if the antennas were wireless? My idea is for devices to communicate with nodes via Bluetooth, and nodes interact with central base via wi-fi/local router.
Also, third random question: how does using BLE affect any of this?
Please tell me if I'm crazy! Thanks!
Bluetooth 4.0 BLE allows for a slave to connect to one master. 4.1 BLE allows for more than one connection, but I don't know if anything implements that yet.
Either way, there's no sort of "roaming" method pairing devices like with wifi access points with the same SSID. BLE however doesn't require pairing like regular Bluetooth, so you could just connect to a new access point each time you lose a connection.
You can also communicate via advertising packets from the "antenna" in each room. This would facilitate information being passed from those rooms to the phone, but not the other way around. This is basically how you communicate with BLE when you don't pair/connect devices and is how iBeacons work.
If you're writing the software yourself, and installing it in the building and on the phone, then I think it should be totally possible. Bluetooth devices can detect the distance and direction of other bluetooth devices. So if both devices are running software that is designed to, and grants permission to do so, it should be no-big-deal to programmatically auto-reconnect to the new nearest antenna whenever one becomes significantly closer than the one that your phone is currently connected to. As for software that already does this that you wouldn't have to develop from scratch yourself, no idea.
How many iphones can you connect via bluetooth using bonjour I want to create a four player iphone app
It is possible to have one Master and up to seven Slaves.
So 8 total phones.
One must be a master (server) the others must be clients.
I am currently working on an app that can connect all 7 slaves to one master.
This is what I have come up with. Also if you are wanting to create a game with multi-player needs then you may want to look into the Game Kit Api that apple provides.
Also it will only work on iphone 3.0 and up. So that is 3G, 3GS and iPhone 4 devices.
Game kit does use bonjour under the hood but handles most of that for you.
Good Hunting!
I'm currently thinking of developing chess code with multi-player facility connected and played via bluetooth. For that I need to chalk out the phases, i mean systematic modules, that I should follow to develop the game. If anyone can state it or have any link that can help it out, it would be great.
Another thing I am developing this in J2ME, so can anyone give me an idea about the way to connect the game in two mobile devices through bluetooth in J2ME. I mean to say the class or file that is used to connect the gaming devices.
For the second part of your question: you need to make an SPP (serial) connection between the two devices, with one acting as a client and the other as a server; see this tutorial for more information.
Then you need to create your own protocol to allow the two devices to communicate everything they need to.
This will only work on handsets with JSR 82.
The GameKit in iPhone SDK 3.0 create a peer-to-peer bluetooth connection between two iPhones, using Server-client model. In the bluetooth spec, up to 7 clients can be connected to a server. But in GameKit document, there is no words for this issue. Does it means a GameKit server can connect more than 7 clients? If yes, does that mean some clients is in sleep mode?
Thanks!
I've been looking for a definitive answer for this for months. There isn't one as far as I can tell. I keep going back to Volcore's blogs on the "woe's of gamekit" where they detail getting up to 4 devices connected over Bluetooth with very unreliable results. All Apple's demos point to "two devices connected" to be the ideal GameKit situation. I eschewed BlueTooth in favor of Wifi in the game I am developing since I knew that I could definitely get more connected (I needed up to 6 players—wasn't convinced I could make it work with BlueTooth). I've found it to be no problem to get 3 devices and simulator talking to each other (though It's not a real-time game—it's turn based—so the data sends are small and infrequent). My guess is that GameKit over bluetooth would not support more than 7 clients.
I've been working on a little app to broadcast messages to multiple iPods. It seems rather unreliable to use bluetooth for any more than two clients (assuming you're setting up a client-server architecture). I'd recommend using cocoaasyncsocket for communicating with multiple clients. I think you'd need a router though.