List of usage examples for android.bluetooth BluetoothAdapter SCAN_MODE_NONE
int SCAN_MODE_NONE
To view the source code for android.bluetooth BluetoothAdapter SCAN_MODE_NONE.
Click Source Link
From source file:Main.java
static public String scanMode2String(int scanMode) { final String NONE = "SCAN_MODE_NONE"; final String CONNECTABLE = "SCAN_MODE_CONNECTABLE"; final String CONNECTABLE_DISCOVERABLE = "SCAN_MODE_CONNECTABLE_DISCOVERABLE"; switch (scanMode) { case BluetoothAdapter.SCAN_MODE_NONE: return NONE; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: return CONNECTABLE; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: return CONNECTABLE_DISCOVERABLE; default://from w w w . j a v a2 s . c om return UNKNOWN; } }
From source file:org.thaliproject.p2p.btpollingsynclib.BtPollingSyncService.java
@Override public void BluetoothStateChanged(int state) { if (state == BluetoothAdapter.SCAN_MODE_NONE) { print_line("BT", "Bluetooth DISABLED, stopping"); stopAll();//from www . j a v a 2 s . c o m } else if (state == BluetoothAdapter.SCAN_MODE_CONNECTABLE || state == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) { print_line("BT", "Bluetooth enabled, re-starting"); startAll(); } }
From source file:com.thelastcrusade.soundstream.components.ConnectFragment.java
private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addLocalAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override//from w w w . ja va 2s. c o m public void onReceiveAction(Context context, Intent intent) { joinView.setEnabled(true); joinView.findViewById(R.id.searching).setVisibility(View.INVISIBLE); //switch Transitions.transitionToHome((CoreActivity) getActivity()); ((CoreActivity) getActivity()).enableSlidingMenu(); //add the playbar fragment onto the active content view ((CoreActivity) getActivity()).showPlaybar(); } }).addGlobalAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if (joinView != null) { switch (mode) { case BluetoothAdapter.SCAN_MODE_NONE: //fall through to connectable case BluetoothAdapter.SCAN_MODE_CONNECTABLE: isSearching = false; setJoinToDefaultState(); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: isSearching = true; setJoinToSearchingState(); break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } } }).register(this.getActivity()); }
From source file:com.googlecode.android_scripting.facade.BluetoothFacade.java
@Rpc(description = "Gets the scan mode for the local dongle.\r\n" + "Return values:\r\n" + "\t-1 when Bluetooth is disabled.\r\n" + "\t0 if non discoverable and non connectable.\r\n" + "\r1 connectable non discoverable." + "\r3 connectable and discoverable.") public int bluetoothGetScanMode() { if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_OFF || mBluetoothAdapter.getState() == BluetoothAdapter.STATE_TURNING_OFF) { return -1; }/* w w w . ja v a2s .c o m*/ switch (mBluetoothAdapter.getScanMode()) { case BluetoothAdapter.SCAN_MODE_NONE: return 0; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: return 1; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: return 3; default: return mBluetoothAdapter.getScanMode() - 20; } }
From source file:com.duy.pascal.interperter.libraries.android.connection.bluetooth.AndroidBluetoothLib.java
@SuppressWarnings("unused") @PascalMethod(description = "Gets the scan mode for the local dongle.\r\n" + "Return values:\r\n" + "\t-1 when Bluetooth is disabled.\r\n" + "\t0 if non discoverable and non connectable.\r\n" + "\r1 connectable non discoverable." + "\r3 connectable and discoverable.") public int bluetoothGetScanMode() { if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_OFF || mBluetoothAdapter.getState() == BluetoothAdapter.STATE_TURNING_OFF) { return -1; }//from ww w. j a v a 2 s. c o m switch (mBluetoothAdapter.getScanMode()) { case BluetoothAdapter.SCAN_MODE_NONE: return 0; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: return 1; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: return 3; default: return mBluetoothAdapter.getScanMode() - 20; } }
From source file:com.thelastcrusade.soundstream.components.NetworkFragment.java
private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addLocalAction(ConnectionService.ACTION_FIND_FINISHED, new IBroadcastActionHandler() { @Override//from w w w. j a v a2 s .com public void onReceiveAction(Context context, Intent intent) { onFindFinished(intent); } }).addLocalAction(UserList.ACTION_USER_LIST_UPDATE, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { updateUserView(); } }).addLocalAction(ConnectionService.ACTION_GUEST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { setDisconnectDisbandBtn(); } }).addLocalAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { setDisconnectDisbandBtn(); } }).addGlobalAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if (joinDifferentNetworkButton != null) { switch (mode) { case BluetoothAdapter.SCAN_MODE_NONE: case BluetoothAdapter.SCAN_MODE_CONNECTABLE: setButtonToDefaultState(joinDifferentNetworkButton); isSearchingJoinDifferent = false; break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: setButtonToSearchingState(joinDifferentNetworkButton); isSearchingJoinDifferent = true; break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } } }).register(this.getActivity()); }