Log in

View Full Version : The Definitive Bluetooth Serial PDA-to-PDA Connection Tutorial


Menneisyys
03-09-2006, 06:15 PM
Some Pocket PC-based multiplayer games (and some other programs) require that you create Bluetooth-based serial connections between the devices. An example of these games/applications is TapzMania, a decent multiplayer game. As I'm working on a brand new, updated version of my Definitive Multiplayer PPC Game Roundup (http://www.pocketpcmag.com/blogs/menneisyys/102005MPPPCGames.asp), I've decided to write an additional, decent tutorial on all the secrets of the serial port issues of Bluetooth-enabled Pocket PC's.

In this tutorial, I elaborate on how this can be done with the two ubiquitous, widely used Bluetooth stacks, the Widcomm/Broadcom and the Microsoft (MS) Bluetooth stacks.

Widcomm/Broadcom

With the Widcomm/Broadcom stack, it's really easy to connect two PDA's. You'll need to pair the two devices first and then, discover the Generic Serial service of the paired Pocket PC. After that, whenever you want to connect the two devices via bluetooth, you will only need to go to the Bluetooth Manager, tap-and-hold the Generic Serial icon of the Pocket PC you want to connect to and choose Connect. In detail:

Start Bluetooth Manager and go to Tools/Paired Devices:

click for screenshot (http://winmobiletech.com/102005MPGames/WidcomDevicePairing-1.bmp.png)

Click Add and then, on the next screen (http://winmobiletech.com/102005MPGames/WidcomDevicePairing-2.bmp.png), the search icon, http://winmobiletech.com/102005MPGames/WidcomSearchForDevices.png.

All the discoverable devices will be displayed:

click for screenshot (http://winmobiletech.com/102005MPGames/WidcomDevicePairing-3.bmp.png)

Just click the one you want your Pocket PC to be paired with and enter the key on both PDA's to pair the two devices.

Then, go to New/ Connect! / Explore a Bluetooth device (http://winmobiletech.com/102005MPGames/ExplBTDevice.bmp.png); the service list will also contain "Generic Serial". Choose it:

click for screenshot (http://winmobiletech.com/102005MPGames/WidcomDevicePairing-5.bmp.png)

Then, just tap and hold the new "Generic Serial" icon of the paired & discovered PDA on the main Bluetooth Manager screen whenever you want to create an active connection between the two devices:

click for screenshot (http://winmobiletech.com/102005MPGames/WidcomDevicePairing-6.bmp.png)

In order to know (several programs need them) the actual (COMx) incoming and outgoing serial ports on Widcomm PDA's, do the following. Go to Bluetooth Settings (by either clicking the BT icon in the lower right corner of the Today screen or from Start/ Settings/ Connections/ Bluetooth).

Here, if you have an older (version 1.4 or below; for example, the one in the iPAQ 2210) Widcomm BT stack, go straight to the Serial Port tab:

click for screenshot (http://winmobiletech.com/102005MPGames/2210SerialPortServicePorts.gif.png)

while with a newer (1.5+, like in the Pocket Loox 720) version, go to the Services tab and choose Serial Port from the "Services" list:

click for screenshot (http://winmobiletech.com/102005MPGames/PL720BTSerialService.gif.png)

and click the Advanced button:

click for screenshot (http://winmobiletech.com/102005MPGames/PL720BTSerialService-2.gif.png)

Now, jot down the two numbers that stand in the two (non-editable) textfield. In these two examples, it's 5 (in) and 8 (out) with the former (iPAQ 2210) device while 8 (in) and 6 (out) with the latter one (a PL720). These are the values that you must set in the programs that require their input.

Widcomm – Microsoft BT stack interoperability

If you try to discover a MS PPC from a Widcomm Pocket PC, the latter won't ever see a Serial service as can be seen for example in this screenshot (http://winmobiletech.com/102005MPGames/x51vDoesntOfferAnyUsableServvicesForWidcom.bmp.png) where, as the x51v, which is not a PPC PE device (more on this later), nothing, not even the BT Dial-up Networking service is displayed.

The other way around will work, however – that is, a PDA with the MS BT stack will see the serial port in Widcomm devices (http://winmobiletech.com/102005MPGames/x51SeesSerialInPL720.bmp.png). Of course, make sure you select the serial port service of the Widcomm device in the MS BT device (http://winmobiletech.com/102005MPGames/x51SeesSerialInPL720-2.bmp.png) you're pairing it with.

You can create a serial port between the two devices if you start the server program on your MS BT stack-enabled device (on which, previously, defined the Widcomm device to be the target of the outgoing port like in this screenshot (http://winmobiletech.com/102005MPGames/x51vDiscoveringPL720Serial.bmp.png)). Then, the MS Pocket PC will make the Widcomm device ask the user for allowing the serial connection as can be seen in here (http://winmobiletech.com/102005MPGames/x51vANDPL720Serial.bmp.png).

Two MS BT stack Pocket PC's

At first, this seems to be the most intimidating setup. Fortunately, using BT serial connections over the MS BT stack is not as complicated as many would think.

With the MS BT stack, you'll need to set up mutual incoming and outgoing BT ports on the two devices so that they will be able to communicate with each other. This means you need to define an incoming port (without giving it any target Pocket PC) on one of your MS BT stack PDA and an outgoing port (to the other PDA) on another.

It's very important that, while you can (unless one of the MS BT stack devices is a PPC PE device), you don't have to do the opposite – that is, you don't need to define two times two ports (both incoming and outgoing ports on both Pocket PC's). This is why the right-to-left arrow in the following set-up schema is not needed:

http://winmobiletech.com/102005MPGames/MSBTtoMSBTSerial.gif

To do this, first, pair the two devices:

click for screenshot (http://winmobiletech.com/102005MPGames/PairWizardWithx51v-1.bmp.png)

click for screenshot (http://winmobiletech.com/102005MPGames/PairWizardWithx51v-2.bmp.png)

Then, if possible (if it's visible – that is, the Pocket PC you're connecting to isn't a Phone Edition device; see the next section on them), discover the serial port connection service of both devices.

Configuring the MS BT stack to create an active connection between two Pocket PC's is very easy. On the Pocket PC that you want to define an incoming port in (as has already been pointed out, you don't need to define both the in- and the outgoing ports on both devices), go to the COM Ports tab and tap New Incoming Port:

click for screenshot (http://winmobiletech.com/102005MPGames/TapzMania-SerialSetup-x51v-NewIncomingPort-1.bmp.png)

On the next screen, choose a port (in most cases, you can just leave the default as is – in the following screenshot, it's COM6) and whether the connection needs to be secure (not necessary in most cases):

click for screenshot (http://winmobiletech.com/102005MPGames/TapzMania-SerialSetup-x51v-NewIncomingPort-2.bmp.png)

After this, just click Finish.

As has already been pointed out, you won't need to set up an outgoing port on the same device (while you must do it on the other one). If you, however, do want to do it, tap New Outgoing Port in the COM Ports tab:

click for screenshot (http://winmobiletech.com/102005MPGames/TapzMania-SerialSetup-x51v-NewOutgoingPort-1.bmp.png)

(In this screenshot, you can already see that COM6 has already been defined as an incoming port for any incoming BT serial connections.)

In the next screen, choose the (already-paired and serial-discovered) PDA you would like to create the serial port to:

click for screenshot (http://winmobiletech.com/102005MPGames/TapzMania-SerialSetup-x51v-NewOutgoingPort-2.bmp.png)

(Note that this step is different from that of defining incoming ports. In here, you must explicitly define the target.)

Finally, on the third dialog, before you click Finish, you can set the outgoing port and whether you need encryption:

click for screenshot (http://winmobiletech.com/102005MPGames/TapzMania-SerialSetup-x51v-NewOutgoingPort-3.bmp.png)

Make sure you jot down the incoming and/or outgoing port(s) you define – you'll need them later, when you for example configure an application that uses them. Note that if you, as I've recommended, only define a one-way "connection", you will only need to remember that particular (incoming or outgoing port) and in the programs that you must supply them you can leave the other port at any setting.

Now, go to the other Pocket PC and set up the opposite port to your device, in exactly the same way as described above. That is, if you've defined an incoming port on one of your Pocket PC's, then, you must define an outgoing port to it on your other PPC, and vice versa.

Caveats of Pocket PC Phone Edition (PPC PE) devices with the MS BT stack

PPC PE Pocket PC's don't offer the Serial Port Bluetooth profile to other Bluetooth-enabled devices, only the Dial-up Networking one. This, unfortunately, means you can't create a serial connection between two MS PPC PE devices.

This is why, when you pair the, say, MS PPC PE HTC Wizard with other Pocket PC's, the other Pocket PC's will only see the Dialup Networking service offered by the Wizard as can be seen in this screenshot (http://winmobiletech.com/102005MPGames/HTCWizardOnlyOffersDUNProfile.bmp.png) (you don't need to enable this service on the device that the PE Pocket PC connects to). (A Widcomm screenshot showing the same situation can be seen here (http://winmobiletech.com/102005MPGames/HTCWizardProfilesUnderWidcom.bmp.png).)

This means the following: if you want to create a BT serial connection between a Phone Edition Pocket PC (with the MS stack) and any other Pocket PC, you can't directly tell the other Pocket PC to use any outgoing port to the PE device. This is why the other Pocket PC, if they use the MS BT stack, will not display the "Create Outgoing Port" (http://winmobiletech.com/102005MPGames/NoOutgoingSerialPortToPEPDAs.bmp.png) after you've paired it with a PPC PE device.

Real-world tests with TapzMania

I've tested everything I've explained above, in every possible configuration (even the seemingly "impossible" ones; that is, for example, the MS PPC x51v playing against a Widcomm device – remember that in this setup, Widcomm devices don't see the serial port in MS PPC's!) and everything worked just fine. I've also thoroughly tested whether it's indeed enough to connect one pair of in- and outgoing ports with the MS BT stack and whether you can just leave the other port alone. You can.

Cybrid
03-09-2006, 09:40 PM
Out of curiosity couldn't this method also be used to get around disabled BT DUN?

simply tell the laptop/PPC to dial out using a Hayes compatible modem on COM 6 or what ever the outgoing port is?
You would be hobbled to 115,000bps but useable nonetheless?