List of usage examples for android.bluetooth BluetoothDevice BOND_BONDING
int BOND_BONDING
To view the source code for android.bluetooth BluetoothDevice BOND_BONDING.
Click Source Link
From source file:Main.java
public static String formatBondState(int bondState) { switch (bondState) { case BluetoothDevice.BOND_NONE: return "Not Bonded"; case BluetoothDevice.BOND_BONDING: return "Bonding"; case BluetoothDevice.BOND_BONDED: return "Bonded"; default://from ww w . j a v a 2s . c om return "Unknown"; } }
From source file:com.wolkabout.hexiwear.activity.MainActivity.java
@Receiver(actions = BluetoothDevice.ACTION_BOND_STATE_CHANGED) void onBondStateChanged(Intent intent) { final BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); final int previousBondState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, -1); final int newBondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, -1); Log.d(TAG, device.getName() + "(" + device.getAddress() + ") changed state: " + previousBondState + " -> " + newBondState);//from w w w .j a va2 s . c o m adapter.notifyDataSetChanged(); if (newBondState == BluetoothDevice.BOND_BONDED) { onBonded(device); } else if (previousBondState == BluetoothDevice.BOND_BONDING && newBondState == BluetoothDevice.BOND_NONE) { device.createBond(); } }
From source file:nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebblePairingActivity.java
protected void performPair(GBDevice gbDevice) { int bondState = mBtDevice.getBondState(); if (bondState == BluetoothDevice.BOND_BONDED) { GB.toast(getString(R.string.pairing_already_bonded, mBtDevice.getName(), mBtDevice.getAddress()), Toast.LENGTH_SHORT, GB.INFO); return;/*from w w w . jav a 2s.c om*/ } if (bondState == BluetoothDevice.BOND_BONDING) { GB.toast(this, getString(R.string.pairing_in_progress, mBtDevice.getName(), macAddress), Toast.LENGTH_LONG, GB.INFO); return; } GB.toast(this, getString(R.string.pairing_creating_bond_with, mBtDevice.getName(), macAddress), Toast.LENGTH_LONG, GB.INFO); GBApplication.deviceService().disconnect(); // just to make sure... if (isLEPebble) { performConnect(gbDevice); } else { mBtDevice.createBond(); } }
From source file:co.aurasphere.bluepair.bluetooth.BluetoothController.java
/** * Returns the status of the current pairing and cleans up the state if the pairing is done. * * @return the current pairing status./*from w ww. j a va 2 s .c om*/ * @see BluetoothDevice#getBondState() */ public int getPairingDeviceStatus() { if (this.boundingDevice == null) { throw new IllegalStateException("No device currently bounding"); } int bondState = this.boundingDevice.getBondState(); // If the new state is not BOND_BONDING, the pairing is finished, cleans up the state. if (bondState != BluetoothDevice.BOND_BONDING) { this.boundingDevice = null; } return bondState; }
From source file:com.rosterloh.moodring.profile.BleProfileService.java
@Override public void onBondingRequired() { Log.v(TAG, "Bond state: Bonding..."); showToast(R.string.bonding);/*from ww w . j av a 2 s . c o m*/ final Intent broadcast = new Intent(BROADCAST_BOND_STATE); broadcast.putExtra(EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); }
From source file:com.diy.blelib.profile.BleProfileService.java
@Override public void onBondingRequired() { Log.v(TAG, "Bond state: Bonding..."); // showToast(R.string.bonding); final Intent broadcast = new Intent(BROADCAST_BOND_STATE); broadcast.putExtra(EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); }
From source file:com.example.RITW.Ble.BleProfileService.java
@Override public void onBondingRequired() { // Logger.v(mLogSession, "Bond state: Bonding..."); showToast(R.string.bonding);/*ww w . jav a2s.c o m*/ final Intent broadcast = new Intent(BROADCAST_BOND_STATE); broadcast.putExtra(EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); }
From source file:no.android.proxime.profile.BleProfileService.java
@Override public void onBondingRequired() { Logger.v(mLogSession, "Bond state: Bonding..."); showToast(R.string.bonding);//from w w w . ja v a2s . co m final Intent broadcast = new Intent(BROADCAST_BOND_STATE); broadcast.putExtra(EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); }