r2 - 28 Oct 2004 - 18:55:37 - RichardBrown?You are here: SuperWaba >  Main Web  > BluetoothUse
Bluetooth in SuperWaba on Palms (at least on the T3) is handled as just another serial port connecting to the peer via rfcomm protocol. The peer has to run the rfcomm service and the SuperWaba application just has to open a SerialPort as follows:

SerialPort btPort = new SerialPort(SerialPort.BLUETOOTH,portSpeed);

This will pop up a T3/PalmOS Bluetooth device discovery dialog from which the user selects the desired peer.

Port speed value is ignored and is always 115200 baud.

-- VikOlliver - 26 Jan 2004

Pocket PC Developers:

Connecting to a Bluetooth device on a Pocket PC machine is accomplished in much the same way as when developing for the Palm OS. However, a common problem (in my experience) can be that the SerialPort.BLUETOOTH constant incorrectly maps to the Bluetooth COM Port. The best way to get around this is to find the actual COM Port that Bluetooth is using on the system, and configure the SerialPort object to directly open that port number:

1) Make sure that Bluetooth is enabled on the Pocket PC device. A good way to tell if this is the case is to navigate to the "Today" screen and look for the icon resembling a white "B" with a blue oval background, which should reside at the bottom right of the screen. If the icon is not present, chances are that Bluetooth is not enabled on the machine. Consult the "Settings", then "Connections" tab to enable the device for Bluetooth.

2) Once the Bluetooth icon is visible in the "Today" screen, tap the icon once to bring up a menu. Click on "Advanced Features", which will spawn a sub-menu to the right. From that sub-menu, click on "My Bluetooth Device". This should bring up a window with 3 tabs/buttons at the bottom. Click on the "COM Ports" tab. At the bottom of this window, you should see the text "Bluetooth COM Port". On the far right of the screen, but on the same line as that text, you should be something like "COMx", where "x" is a number. This is the actual COM Port number that you would use to initialize the SerialPort object in Superwaba!

The code to establish a connection to a bluetooth device would look something like the following (modified slightly from VikOlliver's version):

int realComPort = 5;  //this is the "real" bluetooth value I got from step 2
...
SerialPort btPort = new SerialPort(realComPort,portSpeed);

Much like with the Palm OS, the creation of the SerialPort object will pop up a Bluetooth device selection/discovery window.

Unfortunately, I don't know of a way for a Superwaba program to obtain the Bluetooth COM Port number from the system automatically, so I would suggest making the COM port configurable for the user, so that they can change it if it happens to change on the system.

-- RichardBrown? - 28 Oct 2004

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
SuperWaba home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding SuperWaba? Send feedback