Class ClassicDiscovery

java.lang.Object
java.util.Observable
com.codename1.util.AsyncResource<Boolean>
com.codename1.bluetooth.classic.ClassicDiscovery

public class ClassicDiscovery extends AsyncResource<Boolean>

Live handle of a running classic discovery (inquiry scan, ~12 seconds) returned by BluetoothClassic.startDiscovery(ClassicDiscoveryListener).

As an AsyncResource<Boolean> the handle resolves when discovery ends: with true when the inquiry finished (naturally or via stop()), or with a BluetoothException when the OS aborted it. cancel() is equivalent to stop().

  • Constructor Details

    • ClassicDiscovery

      protected ClassicDiscovery()
      Created by BluetoothClassic; application code receives instances from startDiscovery.
  • Method Details

    • stop

      public void stop()
      Aborts the inquiry; the handle resolves with true. A no-op when discovery already ended.
    • isActive

      public boolean isActive()
      true while the inquiry is running.
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Equivalent to stop().
      Overrides:
      cancel in class AsyncResource<Boolean>
    • onStop

      protected void onStop()
      Hook for the port to abort the platform inquiry; invoked exactly once from stop().