Class ClassicDiscovery
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
ConstructorsModifierConstructorDescriptionprotectedCreated byBluetoothClassic; application code receives instances fromstartDiscovery. -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) Equivalent tostop().booleanisActive()truewhile the inquiry is running.protected voidonStop()Hook for the port to abort the platform inquiry; invoked exactly once fromstop().voidstop()Aborts the inquiry; the handle resolves withtrue.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, waitForMethods inherited from class Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Constructor Details
-
ClassicDiscovery
protected ClassicDiscovery()Created byBluetoothClassic; application code receives instances fromstartDiscovery.
-
-
Method Details
-
stop
public void stop()Aborts the inquiry; the handle resolves withtrue. A no-op when discovery already ended. -
isActive
public boolean isActive()truewhile the inquiry is running. -
cancel
public boolean cancel(boolean mayInterruptIfRunning) Equivalent tostop().- Overrides:
cancelin classAsyncResource<Boolean>
-
onStop
protected void onStop()Hook for the port to abort the platform inquiry; invoked exactly once fromstop().
-