Code example for Lock

Methods: newCondition

0
    private Context mContext;
    private BluetoothAdapter mBluetoothAdapter;
    private BluetoothDevice mTargetDevice;
    private final Lock mDeviceLock = new ReentrantLock();
    private final Condition mDeviceChangedCondition =
            mDeviceLock.newCondition();
    private BroadcastReceiver mReceiver;
 
    /** 
     * The DeviceManager requires an Android Context in order to send the intent 
     * to enable Bluetooth if it isn't already on. 
     */ 
    public DeviceManager(Context context) throws BluetoothException {
        mContext = context;
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        if(mBluetoothAdapter == null) {
            String message = "This device most likely does not have " +
                    "a Bluetooth adapter"; 
            Log.w(TAG, message);
            throw new BluetoothException(message);
        }