marge
  1. marge
  2. MARGE-13

hasInquiryFinished() always returns true

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: marge-core
    • Labels:
      None
    • Environment:

      Operating System: Mac OS X
      Platform: Macintosh

    • 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

        Activity

        Hide
        frapaa added a comment -

        Created an attachment (id=1)
        Test program

        Show
        frapaa added a comment - Created an attachment (id=1) Test program
        Hide
        frapaa added a comment -

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

        Show
        frapaa added a comment - Sorry, it seems like I cannot edit my comment to remove the java-code. I have uploaded the test code as file now.
        Hide
        brunogh added a comment -

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

        Show
        brunogh added a comment - Thanks for reporting! I will take a deep look on it.
        Hide
        brunogh added a comment -

        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).

        Show
        brunogh added a comment - 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 ).

          People

          • Assignee:
            brunogh
            Reporter:
            frapaa
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: