Antrromet
Antrromet

Reputation: 15414

Getting information about remote device in blackberry bluetooth

I am developing a blackberry mobile app and I am using the javax.bluetooth api for using bluetooth in my application. I was wondering whether its possible to get the information about the remote device. I am able to fetch the name and address of the remote bluetooth deices but I also want to know the type of the device. I want to know whether the remote device is a Phone or PC. Is it possible to determine this in Blackberry OS 5?
I am using the following code to get the name and the address of the remote device.

System.out.println((i + 1) + ". "
                                + remoteDevice.getBluetoothAddress() + " ("
                                + remoteDevice.getFriendlyName(true) + ")");

Thanks in advance

Upvotes: 1

Views: 498

Answers (2)

Antrromet
Antrromet

Reputation: 15414

I figured out how to get the type of the device. The device type can be found by using the Device Class. In deviceDiscovered() method of the Discovery Agent we get the Remote Device along with the Device class. We can use the getMajorDeviceClass() method of the Device Class to get the type of Device.
The type of Major Device Class is given in this link.

Upvotes: 1

AlexR
AlexR

Reputation: 115328

It seems that you should use DiscoveryAgent.searchServices() method to retrieve this information:

public int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, DiscoveryListener listener) throws BluetoothStateException

Take a look on javadoc for more info: http://www.blackberry.com/developers/docs/5.0.0api/javax/bluetooth/DiscoveryAgent.html

Upvotes: 0

Related Questions