[MARGE-13] hasInquiryFinished() always returns true Created: 11/Apr/08  Updated: 12/Apr/08  Resolved: 12/Apr/08

Status: Resolved
Project: marge
Component/s: marge-core
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: frapaa Assignee: brunogh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS X
Platform: Macintosh


Attachments: Java Source File Main.java    
Issuezilla Id: 13

 Description   

A small test program shows that te method hasInquiryFinished() always returns
true. Even before startInquiry() is called.

I'm using Mac OSX Leopard, Java 1.5, Bluecove 2.0.2 and Marge 0.5.0.

My test program is as follow (i will upload a file if possible in later steps):

package test;

import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.RemoteDevice;

import net.java.dev.marge.inquiry.DeviceDiscoverer;
import net.java.dev.marge.inquiry.InquiryListener;

/**

  • @author frapaa
    *
    */
    public class Main implements InquiryListener {

public static void main(String[] args)

{ new Main(); }

private DeviceDiscoverer instance;

public Main() {
try

{ instance = DeviceDiscoverer.getInstance(); System.out.println("before startInquiry: hasInquiryFinished = " + instance.hasInquiryFinished()); instance.startInquiryGIAC(this); System.out.println("just after startInquiry: hasInquiryFinished = " + instance.hasInquiryFinished()); sleep(15); System.out.println("after 15 seconds: hasInquiryFinished = " + instance.hasInquiryFinished()); }

catch (BluetoothStateException e)

{ // TODO Auto-generated catch block e.printStackTrace(); }

}

public void deviceDiscovered(RemoteDevice device, DeviceClass deviceClass)

{ System.out.println("deviceDiscovered: hasInquiryFinished = " + instance.hasInquiryFinished()); }

public void inquiryCompleted(RemoteDevice[] devices)

{ System.out.println("inquiryCompleted: hasInquiryFinished = " + instance.hasInquiryFinished()); }

public void inquiryError()

{ System.out.println("inquiryError: hasInquiryFinished = " + instance.hasInquiryFinished()); }

public static void sleep(int sec) {
System.out.println("Please wait: ");
for (int i = 0; i < sec; i++) {
try

{ System.out.println(sec - i + " "); Thread.sleep(1000); }

catch (InterruptedException e)

{ e.printStackTrace(); }

}
}
}

The output is:

BlueCove version 2.0.2 on mac
before startInquiry: hasInquiryFinished = true
just after startInquiry: hasInquiryFinished = true
Please wait:
15
14
deviceDiscovered: hasInquiryFinished = true
13
deviceDiscovered: hasInquiryFinished = true
12
deviceDiscovered: hasInquiryFinished = true
11
deviceDiscovered: hasInquiryFinished = true
10
deviceDiscovered: hasInquiryFinished = true
9
8
7
6
5
4
3
2
1
inquiryError: hasInquiryFinished = true
after 15 seconds: hasInquiryFinished = true
BlueCove stack shutdown completed



 Comments   
Comment by frapaa [ 11/Apr/08 ]

Created an attachment (id=1)
Test program

Comment by frapaa [ 11/Apr/08 ]

Sorry, it seems like I cannot edit my comment to remove the java-code. I have
uploaded the test code as file now.

Comment by brunogh [ 11/Apr/08 ]

Thanks for reporting! I will take a deep look on it.

Comment by brunogh [ 12/Apr/08 ]

The problem was because hasInquiryFinished variable was being initialized with
true, you can check that the constructor is right now
(https://marge.dev.java.net/source/browse/marge/trunk/src/marge-core/src/net/java/dev/marge/inquiry/DefaultDiscoveryListener.java?rev=482&view=markup).

Generated at Sun Apr 26 20:37:19 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.