com.welie.blessed.BluetoothCentral Java Examples
The following examples show how to use
com.welie.blessed.BluetoothCentral.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BluetoothHandler.java From blessed-android with MIT License | 5 votes |
private BluetoothHandler(Context context) { this.context = context; // Plant a tree Timber.plant(new Timber.DebugTree()); // Create BluetoothCentral central = new BluetoothCentral(context, bluetoothCentralCallback, new Handler()); // Scan for peripherals with a certain service UUIDs central.startPairingPopupHack(); central.scanForPeripheralsWithServices(new UUID[]{BLP_SERVICE_UUID, HTS_SERVICE_UUID, HRS_SERVICE_UUID}); }
Example #2
Source File: PBluetoothLEClient.java From PHONK with GNU General Public License v3.0 | 5 votes |
public PBluetoothLEClient(AppRunner appRunner, BluetoothAdapter bleAdapter) { super(appRunner); mAppRunner = appRunner; mContext = appRunner.getAppContext(); mBleAdapter = bleAdapter; mConnectionStatus = DISCONNECTED; central = new BluetoothCentral(appRunner.getAppContext(), bluetoothCentralCallback, new Handler()); // central.startPairingPopupHack(); // central.scanForPeripherals(); mAppRunner.whatIsRunning.add(this); }
Example #3
Source File: BluetoothSettingsFragment.java From openScale with GNU General Public License v3.0 | 5 votes |
private void startBluetoothDiscovery() { deviceListView.removeAllViews(); foundDevices.clear(); central = new BluetoothCentral(getContext(), bluetoothCentralCallback, new Handler(Looper.getMainLooper())); central.scanForPeripherals(); txtSearching.setVisibility(View.VISIBLE); txtSearching.setText(R.string.label_bluetooth_searching); progressBar.setVisibility(View.VISIBLE); progressHandler = new Handler(); // Don't let the BLE discovery run forever progressHandler.postDelayed(new Runnable() { @Override public void run() { stopBluetoothDiscovery(); txtSearching.setText(R.string.label_bluetooth_searching_finished); progressBar.setVisibility(View.GONE); BluetoothDeviceView notSupported = new BluetoothDeviceView(context); notSupported.setDeviceName(getString(R.string.label_scale_not_supported)); notSupported.setSummaryText(getString(R.string.label_click_to_help_add_support)); notSupported.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent notSupportedIntent = new Intent(Intent.ACTION_VIEW); notSupportedIntent.setData( Uri.parse("https://github.com/oliexdev/openScale/wiki/Supported-scales-in-openScale")); startActivity(notSupportedIntent); } }); deviceListView.addView(notSupported); } }, 20 * 1000); }
Example #4
Source File: BluetoothCommunication.java From openScale with GNU General Public License v3.0 | 5 votes |
public BluetoothCommunication(Context context) { this.context = context; this.disconnectHandler = new Handler(); this.stepNr = 0; this.stopped = false; this.central = new BluetoothCentral(context, bluetoothCentralCallback, new Handler(Looper.getMainLooper())); }