# 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()`.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class AsyncResource

  `AsyncResource.AsyncExecutionException, AsyncResource.CancellationException`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ClassicDiscovery()`
  Created by `BluetoothClassic`; application code receives instances from `startDiscovery`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `cancel(boolean mayInterruptIfRunning)`
  Equivalent to `stop()`.
  `boolean`
  `isActive()`
  `true` while the inquiry is running.
  `protected void`
  `onStop()`
  Hook for the port to abort the platform inquiry; invoked exactly once from `stop()`.
  `void`
  `stop()`
  Aborts the inquiry; the handle resolves with `true`.

  ### Methods inherited from class AsyncResource

  `addListener, all, all, asPromise, await, await, await, complete, error, except, except, get, get, get, isCancelled, isCancelled, isDone, isReady, onResult, ready, ready, waitFor`

  ### Methods inherited from class Observable

  `addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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()`.