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