public final class BluetoothMap extends Object implements BluetoothProfile
BluetoothProfile.ServiceListener
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_CONNECTION_STATE_CHANGED |
static int |
RESULT_CANCELED
Connection canceled before completion.
|
static int |
RESULT_FAILURE |
static int |
RESULT_SUCCESS |
static int |
STATE_ERROR
There was an error trying to obtain the state
|
A2DP, A2DP_SINK, AVRCP_CONTROLLER, EXTRA_PREVIOUS_STATE, EXTRA_STATE, GATT, GATT_SERVER, HEADSET, HEADSET_CLIENT, HEALTH, INPUT_DEVICE, MAP, PAN, PBAP, PBAP_CLIENT, PRIORITY_AUTO_CONNECT, PRIORITY_OFF, PRIORITY_ON, PRIORITY_UNDEFINED, SAP, STATE_CONNECTED, STATE_CONNECTING, STATE_DISCONNECTED, STATE_DISCONNECTING
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection to the backing service.
|
boolean |
connect(BluetoothDevice device)
Initiate connection.
|
boolean |
disconnect(BluetoothDevice device)
Initiate disconnect.
|
static boolean |
doesClassMatchSink(BluetoothClass btClass)
Check class bits for possible Map support.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
BluetoothDevice |
getClient()
Get the currently connected remote Bluetooth device (PCE).
|
List<BluetoothDevice> |
getConnectedDevices()
Get the list of connected devices.
|
int |
getConnectionState(BluetoothDevice device)
Get connection state of device
|
List<BluetoothDevice> |
getDevicesMatchingConnectionStates(int[] states)
Get the list of devices matching specified states.
|
int |
getPriority(BluetoothDevice device)
Get the priority of the profile.
|
int |
getState()
Get the current state of the BluetoothMap service.
|
boolean |
isConnected(BluetoothDevice device)
Returns true if the specified Bluetooth device is connected.
|
boolean |
setPriority(BluetoothDevice device,
int priority)
Set priority of the profile
The device should already be paired.
|
public static final String ACTION_CONNECTION_STATE_CHANGED
public static final int STATE_ERROR
public static final int RESULT_FAILURE
public static final int RESULT_SUCCESS
public static final int RESULT_CANCELED
protected void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
public void close()
public int getState()
public BluetoothDevice getClient()
public boolean isConnected(BluetoothDevice device)
public boolean connect(BluetoothDevice device)
public boolean disconnect(BluetoothDevice device)
device
- Remote Bluetooth Devicepublic static boolean doesClassMatchSink(BluetoothClass btClass)
public List<BluetoothDevice> getConnectedDevices()
getConnectedDevices
in interface BluetoothProfile
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states)
getDevicesMatchingConnectionStates
in interface BluetoothProfile
states
- Array of states. States can be one of
BluetoothProfile.STATE_CONNECTED
, BluetoothProfile.STATE_CONNECTING
,
BluetoothProfile.STATE_DISCONNECTED
, BluetoothProfile.STATE_DISCONNECTING
,public int getConnectionState(BluetoothDevice device)
getConnectionState
in interface BluetoothProfile
device
- Remote bluetooth device.public boolean setPriority(BluetoothDevice device, int priority)
The device should already be paired.
Priority can be one of BluetoothProfile.PRIORITY_ON
or
BluetoothProfile.PRIORITY_OFF
,
device
- Paired bluetooth devicepriority
- public int getPriority(BluetoothDevice device)
The priority can be any of:
BluetoothProfile.PRIORITY_AUTO_CONNECT
, BluetoothProfile.PRIORITY_OFF
,
BluetoothProfile.PRIORITY_ON
, BluetoothProfile.PRIORITY_UNDEFINED
device
- Bluetooth device