Java Code Examples for android.bluetooth.le.ScanResult#getScanRecord()
The following examples show how to use
android.bluetooth.le.ScanResult#getScanRecord() .
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: BleScanner.java From EasyBle with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private boolean hasResultByFilterUuids(ScanResult result) { if (mServiceUuids == null || mServiceUuids.length <= 0) {//no filtered uuids return true; } ScanRecord scanRecord = result.getScanRecord(); if (scanRecord == null) { return false; } List<ParcelUuid> serviceUuidList = new ArrayList<>(); for (UUID uuid : mServiceUuids) { serviceUuidList.add(new ParcelUuid(uuid)); } List<ParcelUuid> scanServiceUuids = result.getScanRecord().getServiceUuids(); return scanServiceUuids != null && scanServiceUuids.containsAll(serviceUuidList); }
Example 2
Source File: LollipopBleScanner.java From FimiX8-RE with MIT License | 5 votes |
public void onScanResult(int callbackType, ScanResult result) { super.onScanResult(callbackType, result); LogUtil.i(LollipopBleScanner.TAG, "onScanResult: " + callbackType + " ScanResult:" + result); if (result.getScanRecord() != null) { LollipopBleScanner.this.mScanCallback.onBleScan(result.getDevice(), result.getRssi(), result.getScanRecord().getBytes()); } }
Example 3
Source File: AbstractScanner.java From easyble-x with Apache License 2.0 | 5 votes |
@RequiresApi(Build.VERSION_CODES.LOLLIPOP) void parseScanResult(BluetoothDevice device, @Nullable ScanResult result) { if (result == null) { parseScanResult(device, false); } else { ScanRecord record = result.getScanRecord(); parseScanResult(device, false, result, result.getRssi(), record == null ? null : record.getBytes()); } }
Example 4
Source File: DeviceDiscovererV21.java From science-journal with Apache License 2.0 | 5 votes |
private void manageScanResult(ScanResult result) { List<String> serviceUuids = new ArrayList<>(); ScanRecord record = result.getScanRecord(); if (record != null) { List<ParcelUuid> parcelUuids = record.getServiceUuids(); if (parcelUuids != null) { for (ParcelUuid uuid : parcelUuids) { serviceUuids.add(uuid.toString()); } } } addOrUpdateDevice(new NativeDevice(result.getDevice(), serviceUuids), result.getRssi()); }
Example 5
Source File: BleManager.java From FastBle with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public BleDevice convertBleDevice(ScanResult scanResult) { if (scanResult == null) { throw new IllegalArgumentException("scanResult can not be Null!"); } BluetoothDevice bluetoothDevice = scanResult.getDevice(); int rssi = scanResult.getRssi(); ScanRecord scanRecord = scanResult.getScanRecord(); byte[] bytes = null; if (scanRecord != null) bytes = scanRecord.getBytes(); long timestampNanos = scanResult.getTimestampNanos(); return new BleDevice(bluetoothDevice, rssi, bytes, timestampNanos); }
Example 6
Source File: ScanResultCompat.java From AndroidBleManager with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) ScanResultCompat(ScanResult result) { mDevice = new BluetoothLeDevice(result.getDevice(), result.getRssi(), result.getScanRecord().getBytes(), System.currentTimeMillis());//result.getTimestampNanos() mScanRecord = new ScanRecordCompat(result.getScanRecord()); mRssi = result.getRssi(); mTimestampNanos = System.currentTimeMillis();//result.getTimestampNanos(); }
Example 7
Source File: LollipopBleScanner.java From bleYan with GNU General Public License v2.0 | 5 votes |
@Override public void onScanResult(int callbackType, ScanResult result) { super.onScanResult(callbackType, result); BleLog.i(TAG, "onScanResult: " + callbackType + " ScanResult:" + result); if (result.getScanRecord() != null) { mScanCallback.onBleScan(result.getDevice(), result.getRssi(), result.getScanRecord().getBytes()); } }
Example 8
Source File: EddystoneScannerService.java From nearby-beacons with MIT License | 5 votes |
private void processResult(ScanResult result) { ScanRecord record = result.getScanRecord(); if (record == null) { Log.w(TAG, "Invalid scan record."); return; } final byte[] data = record.getServiceData(UID_SERVICE); if (data == null) { Log.w(TAG, "Invalid Eddystone scan result."); return; } final String deviceAddress = result.getDevice().getAddress(); final int rssi = result.getRssi(); byte frameType = data[0]; switch (frameType) { case TYPE_UID: mCallbackHandler.post(new Runnable() { @Override public void run() { processUidPacket(deviceAddress, rssi, data); } }); break; case TYPE_TLM: case TYPE_URL: //Do nothing, ignoring these return; default: Log.w(TAG, "Invalid Eddystone scan result."); } }
Example 9
Source File: ScanCallbackBridge.java From BlueSTSDK_Android with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onScanResult(int callbackType, ScanResult result) { super.onScanResult(callbackType, result); ScanRecord record = result.getScanRecord(); if(record!=null) mCallbackPre21.onLeScan(result.getDevice(),result.getRssi(),record.getBytes()); }
Example 10
Source File: InternalScanResultCreator.java From RxAndroidBle with Apache License 2.0 | 4 votes |
@RequiresApi(21 /* Build.VERSION_CODES.LOLLIPOP */) public RxBleInternalScanResult create(ScanResult result) { final ScanRecordImplNativeWrapper scanRecord = new ScanRecordImplNativeWrapper(result.getScanRecord()); return new RxBleInternalScanResult(result.getDevice(), result.getRssi(), result.getTimestampNanos(), scanRecord, ScanCallbackType.CALLBACK_TYPE_BATCH); }
Example 11
Source File: InternalScanResultCreator.java From RxAndroidBle with Apache License 2.0 | 4 votes |
@RequiresApi(21 /* Build.VERSION_CODES.LOLLIPOP */) public RxBleInternalScanResult create(int callbackType, ScanResult result) { final ScanRecordImplNativeWrapper scanRecord = new ScanRecordImplNativeWrapper(result.getScanRecord()); return new RxBleInternalScanResult(result.getDevice(), result.getRssi(), result.getTimestampNanos(), scanRecord, toScanCallbackType(callbackType)); }
Example 12
Source File: LollipopPeripheral.java From react-native-ble-manager with Apache License 2.0 | 4 votes |
public LollipopPeripheral(ReactContext reactContext, ScanResult result) { super(result.getDevice(), result.getRssi(), result.getScanRecord().getBytes(), reactContext); this.advertisingData = result.getScanRecord(); this.scanResult = result; }