Wednesday, September 15, 2004

Bluetooth Investigation Part 2

Looking into the Bluetooth capabilities was initially a little confusing. I had made the assumption that you could be a host and a client at the same time. Although, the API doesn’t allow it, it’s still possible for the game to appear to the user that it’s scanning and awaiting connections at the same time.

How? Well, first the UI is a simple List. With Bluetooth, there are two modes which you apply - host and client. Client mode just sits there and tells anybody who’s looking that they’re available to play. Host mode, searches though the ether to find anybody who has;-

1 – Bluetooth switched on (Device Discovery).
2 – Running the game’s service (Service Discovery), which means they’re in client mode.

The default mode for the game is client. However, once a minute or so (or even by user command), the App enters host mode and searches for people with clients active. If any players are found then the player details are stored within the app and the App re-enters client mode. The list is cleared and those stored players are displayed on the screen.

When an app becomes a host, it’s no-longer discoverable so therefore the searching for other players has to be a quick as possible. This might be a problem because the time Bluetooth takes to perform a Device Discovery and Service Discovery does seem to take quite a while.

If this is too slow then I’ll remove the timer and perform a search on User Command Only
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

0 Comments:

Post a Comment

<< Home