05-21-2009 01:19 AM
Hi
I tried to detect bluetooth devices with this code -
try { LocalDevice localDevice = LocalDevice.getLocalDevice(); DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent(); discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this); } catch(Exception e) { }
It detects one or two devices, and device discovered method is called, and sudenly inquiryCompleted is called, and no other device is detected.
What I want is to make the inquiry mode longer so that it can detect all the devices active near me. How can I do that?
Thanks.
05-26-2009 02:10 AM
Hi
I really in need of help in this issue.
If my problem is not clear, please ask me.
06-11-2009 11:05 PM
Do you have more than two devices around that you want to detect?
Make the other devices are discoverable if you want GIAC inquiry to find them.
Use retreiveDevices(CACHED/PREKNOWN) to get list of previously pair
devices. Link:javax.bluetooth
06-12-2009 12:43 AM
Hi Bottomfish
Thanks for reply.
Yes, I have more than two discoverable devices around.
When I search 1/2 device(s) is discovered. If I search immediately it discovers 1/2 devices again, sometimes same devices, some times another 1/2 devices. No consistency. What should I do then?
06-12-2009 12:54 AM
Your other devices may be only set to be discoverable for only a limited period.
For example, my pearl can be set to be discoverable for only 2 minutes beside
the yes or no options.
Try a stub discoverylistener object and pass it startInquiry.
Print out any devices discovered and inquiry completed status
for both startInquiry(GIAC and LIAC, listener)...
Please provide more info about your other devices.
06-12-2009 01:24 AM
Bottomfish wrote:Your other devices may be only set to be discoverable for only a limited period.
I don't think so, the bluetooth demo that came with blackberry can discover all of those 7/8 devices.
Bottomfish wrote:
Try a stub discoverylistener object and pass it startInquiry.
Print out any devices discovered and inquiry completed status
for both startInquiry(GIAC and LIAC, listener)...
Can you give me sample code?
Thanks.
06-12-2009 01:34 AM
Post your code, let us see what your are doing for
devicediscovered and inquirycomplete methods.
06-12-2009 02:00 AM
I coded in office, now this is weekend. I will go to office next Sunday, and will give you the code.
Thanks for posting.
Best Regards
11-05-2009 05:03 PM
Bottomfish,
I have the same issue.I also tried to call agent.startInquiry(DiscoveryAgent.GIAC, this) more than once, but without success. I have 3 diffrent BT-GPS (V10, 382502) and it only find finds one @ a time, but sometimes two;
Below is my code posted..
public void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass)
{
String strDevName = null;
try {
strDevName = remoteDevice.getFriendlyName(true);
}
catch (Exception e) {
//TODO
e.printStackTrace();
}
if (strDevName != null && !hstDevInfo.containsKey(strDevName) ) {
hstDevInfo.put(strDevName, new Boolean(false));
activeDevices.append(strDevName, null);
devicesFound.addElement(remoteDevice);
}
if (iInquiryCounter < 5) {
iInquiryCounter++;
System.out.println("==========>starting Inguiry #" + iInquiryCounter);
try {
agent.startInquiry(DiscoveryAgent.GIAC, this);
} catch (BluetoothStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void inquiryCompleted(int param)
{
switch (param) {
case DiscoveryListener.INQUIRY_COMPLETED:
if (devicesFound.size() > 0) {
activeDevices.addCommand(select);
activeDevices.setSelectCommand(select);
} else {
try {
activeDevices.append("No Devices Found", null);
}
catch (Exception e) {
//TODO
}
}
display.setCurrent(activeDevices);
break;
case DiscoveryListener.INQUIRY_ERROR:
break;
case DiscoveryListener.INQUIRY_TERMINATED:
break;
}
}
01-19-2010 02:03 PM
Did you ever get resolution for this issue? I had the same problem and resolved it by not calling getFriendlyName from the diveceDiscovered callback. Store up the remote devices and go through the names after words.