Multiplayer Bluetooth Gaming - Handling Errors

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Multiplayer Bluetooth Gaming - Handling Errors

Postby mobcode » Mon Feb 11, 2008 2:05 pm

I am working of building a multiplayer game using bluetooth, however I need to be able to detect and manage errors.

For example a 2 person game, one phone may move outside of the bluetooth range for just a moment, and then return, can this be handled in some way?

Bluetooth has the following Exceptions (JSR 82 see http://java.sun.com/javame/reference/apis/jsr082/ )

BluetoothConnectionException
BluetoothStateException
ServiceRegistrationException

Is it possible to detect when a Bluetooth device moves out side of the range of another?

With a device having moved outside of the range, trying to communicate with that device will result in a null pointer exception. Is it possible to know that the device has moved outside the range?

Having moved outside the range for a few seconds the device moves back within range, can this some how be detected, and the original connection re-established?

Is their some way to define that if a device has moved outside the range for a predetermined amount of time that the device is now no longer available?

Also is it possible to detect if a device that you are in communication with suddenly dies, i.e. switched off by the user, interrupted by another application etc.

If none of this is available is JSR82, can you recommend any other implementations that provide some or all of this functionality.

Thanks in advance for any insight you may have on this.
mobcode
 
Posts: 1
Joined: Mon Feb 11, 2008 2:01 pm

Re: Multiplayer Bluetooth Gaming - Handling Errors

Postby DevelopmentTeam » Tue Feb 12, 2008 8:05 am

I dont think there is a way to determine the connection loss due to device out of range. But what you can do is, you can keep retrying for the connection again and again until the other device can be caught.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 2 guests

cron