Bluetooth MIDlet

A

Ante

Hi folks!
I need a tiny midlet that searches for Bluetooth devices in range and
returns the ID's of the fond devices.
Has anyone sample code here fore?

(Obviously thephone itself must be Bluetooth enablend, I know. ;-))

I know it should be something using the discoveryAgent, but I just
cannot produce runnable code (i.e. on a Nokia 3650).

Any ideas?
Thanks for any comment...
 
D

Darryl L. Pierce

Ante said:
Hi folks!
I need a tiny midlet that searches for Bluetooth devices in range and
returns the ID's of the fond devices.
Has anyone sample code here fore?

Take a look at the APIs supplied by JSR-82. From my quick read, it seems
you want to grab an instance of the javax.bluetooth.DiscoveryAgent for your
local device:

LocalDevice ldevice = LocalDevice.getLocalDevice();
DiscoveryAgent agent = ldevice.getDiscoveryAgent();

Then, you use the discovery agent to query the PAN for other Blue Tooth
devices in your vicinity:

agent.startInquiry(DiscoveryAgent.GIAC,new DiscoveryListener()
{
public void deviceDiscovered(RemoteDevice rdevice,DeviceClass clazz)
{
// do something with the rdevice object
}

// other methods ignored for brevity...
});
 
D

Darryl L. Pierce

Darryl L. Pierce wrote:
<snip>

A follow up to the original poster: Does your 3650 support JSR-82? I just
wrote a quick test MIDlet for both of mine and neither of them support the
APIs from JSR-82...
 
D

Darryl L. Pierce

Ante said:
Well this was quite helpfull so far. Thanks!!

No problem, mate.
Could it be that the phone must be MIDP 2.0 comatible to support Java
access to the Bluetoth device? Or to put it in other words: Does
JSR-82 require the device to be MIDP 2.0 compliant?

No, there's no such requirement. JSR 82 was completed before the MIDP 2.0
specification was finalized.
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top