Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
krzysztof
Posts: 10
Registered: ‎07-18-2008
My Device: Not Specified
Accepted Solution

Get the BT Address from paired device

[ Edited ]

Hi all,

I would like to get the BT address from the device (client), which is currently connected to my applet on BlackBerry Phone (server). Is it possible to get it?

 

I use JDE 4.3.0.

 

I register SPP Server


//Open a port to listen for incoming connections.
_port = new BluetoothSerialPort("My spp connection", BluetoothSerialPort.BAUD_115200, BluetoothSerialPort.DATA_FORMAT_PARITY_NONE | BluetoothSerialPort.DATA_FORMAT_STOP_BITS_1 | BluetoothSerialPort.DATA_FORMAT_DATA_BITS_8, BluetoothSerialPort.FLOW_CONTROL_NONE, 1024, 1024, this);
_deviceName = "unknown";

 

I established the BT connection from the PC to the registered port "My spp connecion".

Then I try to get the BT address in this way:

 

BluetoothSerialPortInfo[] info = _port.getSerialPortInfo();
System.out.println("Connected to device " + info[0].getDeviceName() + info[0].getDeviceAddress());

 

when I like to print the result I have ArrayIndexOutBoundsException

 

On a pop up debug I see correct _port._remoteAddress from the BT client, but I don't know how to get the access to this method.

 

Does anybody has expiernce in that case?

Thank you in advance

Chris

Message Edited by krzysztof on 07-18-2008 06:33 AM
Please use plain text.
BlackBerry Development Advisor (Retired)
bzubert
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: Get the BT Address from paired device

Try using javax.bluetooth.RemoteDevice.getBluetoothAddress().
Brian Zubert
Technical Partnership Manager
Research In Motion
Please use plain text.
New Developer
krzysztof
Posts: 10
Registered: ‎07-18-2008
My Device: Not Specified

Re: Get the BT Address from paired device

I'm using Bluetooth sample code.

 

Is it possible to get access to the BT address from this sample code using javax.bluetooth.RemoteDevice library or I have to rewrite all code using only javax.bluetooth.* library to implement spp connection and then I'll get access to the BT address?

 

Could you provide some example code?

 

Thank you

Chris

Please use plain text.
BlackBerry Development Advisor (Retired)
bzubert
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: Get the BT Address from paired device

Using DiscoveryAgent.retrieveDevices(), retrieving all CACHED devices, you can then call RemoteDevice.getBluetoothAddress().  This can be done within the context of any app.
Brian Zubert
Technical Partnership Manager
Research In Motion
Please use plain text.
New Developer
krzysztof
Posts: 10
Registered: ‎07-18-2008
My Device: Not Specified

Re: Get the BT Address from paired device

I've implemented that and works fine. In next step I would like to get the device which is currently connect.

Retrieving all CACHED devices or PREKNOWN - I don't know which BT link is active now.

 

Is it possible to find out, by checking flags or other way - which device is currently connected to the handheld (Bluetooth link is active to a device)?

 

Thank you

Chris

Please use plain text.
New Developer
krzysztof
Posts: 10
Registered: ‎07-18-2008
My Device: Not Specified

Re: Get the BT Address from paired device

Is it possible to get an information, which devices are currently connect by Bluetooth to Handheld (Bluetooth link is active)?

 

In the Handheld in Set up Bluetooth menu - this information is show by bold device name. Is it possible somehow to get this information by applet, which devices from the paired device list are currently connect?

 

Do you have any ideas?

 

Thank you for your response

Chris

Please use plain text.