How to Identify Bluetooth Bonded Devices

G

Guest

I've been using the opennetcf classes to work with a Zebra QL220 Bluetooth
enabled printer. I'm able to successfully print to the printer if I first do
device discovery, display the devices in a combo box, and then select one as
shown in the example application.

I have a device already bonded on my pocket PC and would like to use this
device directly without using the combobox control for selection. Is there a
way I identify the bonded devices that already exist on my Pocket PC and use
this to create an endpoint and then a client connection?

Thanks
RonF
 
P

Peter Foot [MVP]

The BluetoothClient class has a BondedDevices property which returns an
array of previously bonded devices. You can use this to check for a specific
device name and then use the DeviceID (of type BluetoothAddress) to create a
BluetoothEndPoint to establish a connection. You can also store bluetooth
addresses yourself e.g. in config files, registry etc, and later use the
BluetoothAddress.Parse or constructor overloads to get them back into a
BluetoothAddress instance.

Peter
 
G

Guest

Peter, Thanks much for your quick reply. I've been trying unsuccessfully to
use this. If I look on my PPC under the settings/connection/bluetooth tab, I
see that I have a device named PR2 bonded. When I try to access the
bluetoothclient.bondeddevices property, I get a null exception.

Here is my code:

Dim btclient As OpenNETCF.Net.Sockets.BluetoothClient = New BluetoothClient
Dim btdeviceinfo() As BluetoothDeviceInfo = btclient.DiscoverDevices(4)
'The above always works fine

Dim btbondinfo() As BluetoothDeviceInfo = btclient.BondedDevices

'I get a null reference exception from btclient.bondeddevices above
Can you see anything I'm doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top