Java bluetooth server thing

R

Rick Fleuren

Greetings,

I have written a small program, based on the AVElink libraries,
which searches for other devices which use bluetooth..

I have used the avelink libraries, because I tried everything else,
and these libraries come with drivers which I can use to overwrite the
USB 3COM Dongle I have...

Anyway, first, the program works, but the program never seems to end..
It just got stuck somewhere and won't exit... Secondly, when I abort
the program, it doesnt work anymore and got stuck at the line
LocalDevice.getLocalDevice()

The class implements the DiscoveryListener and I use this method to
get devices:

public String searchDevices() throws Exception
{
System.out.println("Starting getting local device");
LocalDevice ld = LocalDevice.getLocalDevice();
System.out.println("Local device retrieved");
System.out.println("Starting getting discovery agent");
DiscoveryAgent da = ld.getDiscoveryAgent();
System.out.println("Discovery agent retrieved");

System.out.println("Starting device inquiry...");
da.startInquiry(DiscoveryAgent.GIAC, this);
// wait till the device enquiry is completed

synchronized(this){
this.wait();
}
int[] attrSet = {0,3,4};
UUID[] uuids = new UUID[1];
uuids[0] = new UUID("1105", true);
System.out.println("\nSearching for Service...\n");

int i = 0;
while(i<count)
{
try{
System.out.println("\nSearching for Service @ " +
devices.getBluetoothAddress());
int transactionid = da.searchServices(attrSet, uuids,
devices, this);
if(transactionid != -1)
{
synchronized(this) {
this.wait();
}
}
if(connectionURL != null){
return connectionURL;
}
}catch(Exception e)
{
System.out.println(e.getMessage());
}
++i;
}//while
return null;
}

Does anyone know what might be the problem ?
 

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,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top