PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

How to use bluetooth?

Hi pals,

I was wondering if anyone tried to use bluetooth under PPC 2002?
Which libraries have I to use?

Regards..

Marco.
Hi,

i have to use BT in a running project too. I don't know if this is of any use, since it seems to be for CE .NET only, but i have not had the time to take a closer look:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcebluet/htm/ceconbluetoothsamples.asp

cryo
yep, I am using bluetooth at the mo, and it's a bit of a pain.

Basically bluetooth isn't built into ppc2002, so any devices that have it (I only know of the ipaq3870, did try and build up a thread about this but some one deleted it), uses a device dependent api.

in the 3870 case it's widcomm, to get there sdk you need to pay them $1000...bad! Also this is only likely to work on the 3870.

Method I'm using is to use a virtual com port.
Bluetooth can use two ports ( 8 & 7 for 3870) which you can find out from your registry.
Basically you set up a serial connection between the two devices (ppc's) in the bluetooth manager. Then you can communicate between them using standard COM port functions.

There is an example for setting up serial COM in the ppc2002 sdk.

some dude has a tty console code/app on the net too which is worth having a look at.

bluetooth is surprisingly easy to get going, should be used in more games!

Problem I'm having is that when you connect to another device with your serial connection, the other device has a bluetooth security dialog pop up, where they need to accept the connection. This causes a problem with GAPI as it has control of the screen/resources and cannot detect this dialog appearing (nor predict), thus the connection has to be done outside of the game (which is not very robust).

any help/ideas would be appreciated.

JIm.
If you know the Bluetooth dialog is going to pop up, can't you momentarily minimize your program properly, so that it doesn't end up messing up your graphics/sound?

I do see the problem, I just don't see how the solution is so tough.

BTW, will you still get serial speed if you redirect BT to the COM port? (as an incentive to buy the $1000 SDK of sorts)
Does anyone know if the BT implementation in the iPAQ 3970 also is from widcomm?

cryo
Jim: if you like and send me a small test program I can test it on the 39XX IPaq.

Its a pitty that it seems like that there is no better solution..

Regards..

Marco.
The problem is that the dialog appears on the other device, not the device that initiated the connection. Thus the game running on the other device has no idea when this is going to happen and cannot be prepared for this. There are a couple of dodgy solutions for this, but best would be to be able to detect the dialog popup and handle it properly.

gott_e:
I'll send you game to test bt on 3970 when finished, I'll mail you that tty app now.
You have to fiddle around with opening ports, to try n see which works, should check your registry for a clue probably 8 & 7.
You will need to open the ports on each device.
COM8 is used for connecting and COM7 for data transfer apparently!?


You can set to max baud and still works fine ie 115200.

cheers
JIm.
There is apparently another method:

"On installation of the Bluetooth Service Manager from compaq, you are exposed to all Bluetooth API's provided by Widcomm such as L2CAP, RFCOMM etc. You can load the dll using LoadLibrary and then GetProcAddress and use the functions and play with them."
Is this legal? Are you allowed to use this in a commercial product?

Regards...

Marco.
Would this BT Service Manager need to be installed on the end device?

While it sounds great for new games (if the dialog pops up) games that can use COM ports will still have some trouble, but I'm not too worried about that.
all seemes legal to me :)

BT Service Manager is installed on all bluetooth enabled devices (ipaq).

JIm.
Sergey Chaban · 12 Nov 2002, 17:52 UTC
Recently I've spent some time trying to figure out how to access Bluetooth stack directly on iPaq 3x70.
If this will be of some help I put some source code for download on this page:

http://mono.eurosoft.od.ua/wince/

Not very useful at the moment but I'm going to spend some time developing this stuff. (In fact what I want is a wrapper to access BT from the .NET Compact Framework).
There are basicaly three ways to work with BT on iPaqs (some of them were already mentioned).
Hard way: Use file handles for "BTS1:" & "BTP1:" devices and I/O CTRL to talk to device directly;
Easy way: Use Widcomm API which resides in the wbtapiCE.dll;
High-level way: Use Compaq's API from BTCore.dll;

API is pretty much straight-forward but there are lots of quirks, e.g. initializing stack requires some ugly cruft.

Have fun,
S.C.
widcomm is not the only one, there is also BTAccess from high point http://www.high-point.com. I don't know which one is better in terms of functionality, I have yet to receive my widcomm lib. Anyway, the BTAccess one is cheaper.

cryo
Sergey Chaban · 25 Nov 2002, 21:06 UTC
As always your mileage may vary, but I'd say that Widcomm SDK would be a much better choice.
First, BTAccess uses BTCore.DLL API, which is a higher level stuff built ontop of Widcomm's DLL.
And due to various quirks in the BT stack on the iPaq you almost certainly would need to access the lower-level APIs from time to time.
Next, as far as I can tell, BTAccess was created by reverse-enginering BTManager.exe to figure out BTCore APIs. For one, legal status of this is unclear. Next, it took me one weekend to figure out how this stuff works, and one more day to create some initial include files to access BT API. It's not exactly a rocket science really.
I hate to say this, but I think that these HighPoint guys just try to sell you nothing for a quite high price.

Then again, this is just my opinion and I could be totally wrong ;)

One more point - Widcomm API (desktop version) is also used in many BT dongles (Tecom, D-Link, Belkin) so it's more portable in a way to use their SDK.

SC