Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Verify available BlueTooth devices

Reply
Thread Tools

Verify available BlueTooth devices

 
 
Manuel
Guest
Posts: n/a
 
      06-14-2005
Hi,

for a university project I'm trying to implement a "where am I?"-Detection for in-buildings, using Java and Nokia 6630.

I tried to use deviceDiscovered() to build up a vector with all nearby devices, but realized, that devices will be found by deviceDiscovered() even after thy are switched off (up to 1100 seconds later).

As it seems, there is no method to clear the BT-devices-hardwarestack, I tried to verify Devices' availability by searching for services on each discovered device when inquiryCompleted() is called

Code:
public void inquiryCompleted(int complete)
{

UUID[] uuids=new UUID[1];
uuids[0] = uuid;

int[] attrSet = null;

for (int i=0; i< remoteDevices.size(); i++)
{
RemoteDevice remoteDevice = (RemoteDevice) remoteDevices.elementAt(i);
try
{
int transId = agent.searchServices(attrSet, uuids, remoteDevice, this);
}
catch (BluetoothStateException btse)
{
LogFile.log(""+btse);

}
catch (IOException ioe)
{
LogFile.log(""+ioe);
}

}

}


public void servicesDiscovered(int transId, ServiceRecord[] records)
{
String s = new String();
try
{
s = new String(records[0].getHostDevice().getFriendlyName(false));
}
catch (IOException ioe)
{
LogFile.log(""+ioe);
}
if(!verifiedDevices.contains(s))
{
try
{
verifiedDevices.addElement(records[0].getHostDevice().getFriendlyName(false));
}
catch(IOException ioe)
{
LogFile.log(""+ioe);
}
}

}
This, of cause, didn't work neither, due to the for() -loop and the given listener-pattern:

It will work for the 1st found devices, but for the other it will generate a bluetoothstack-exciption: Busy, because the discoveryAgent hasn't finished service discovery on the 1. device.

Does anybody have an idea, how to achieve the goal of building a fast "where am i?"-recognition by using Java and BlueTooth, or do you think, it is just impossible?

Thanks, Manuel

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bluetooth Places vs. Bluetooth Devices - Radio not plugged in? Mike Miller Wireless Networking 2 03-08-2008 08:41 PM
[mobil java] Verify available BlueTooth devices Manuel Java 0 06-14-2005 02:56 PM
Can security devices harm DVDs and electronic devices? curious@nospam.com DVD Video 12 03-02-2005 06:57 AM
Bluetooth Devices =?Utf-8?B?QWxlYmFy?= Wireless Networking 3 02-08-2005 04:29 PM
"Windows CE Devices and Palm Devices Help Needed" Naveen Vaila ASP .Net Mobile 1 06-23-2004 10:12 AM



Advertisments