react-native-ble-manager 8.2.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -131,10 +131,11 @@ Returns a `Promise` object.
|
|
|
131
131
|
- `seconds` - `Integer` - the amount of seconds to scan.
|
|
132
132
|
- `allowDuplicates` - `Boolean` - [iOS only] allow duplicates in device scanning
|
|
133
133
|
- `scanningOptions` - `JSON` - [Android only] after Android 5.0, user can control specific ble scan behaviors:
|
|
134
|
-
- `numberOfMatches` - `Number` - corresponding to [`setNumOfMatches`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setNumOfMatches(int)>)
|
|
135
|
-
- `matchMode` - `Number` - corresponding to [`setMatchMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setMatchMode(int)>)
|
|
136
|
-
- `scanMode` - `Number` - corresponding to [`setScanMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setScanMode(int)>)
|
|
137
|
-
- `reportDelay` - `Number` - corresponding to [`setReportDelay`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setReportDelay(long)>)
|
|
134
|
+
- `numberOfMatches` - `Number` - [Android only] corresponding to [`setNumOfMatches`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setNumOfMatches(int)>)
|
|
135
|
+
- `matchMode` - `Number` - [Android only] corresponding to [`setMatchMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setMatchMode(int)>)
|
|
136
|
+
- `scanMode` - `Number` - [Android only] corresponding to [`setScanMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setScanMode(int)>)
|
|
137
|
+
- `reportDelay` - `Number` - [Android only] corresponding to [`setReportDelay`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setReportDelay(long)>)
|
|
138
|
+
- `phy` - `Number` - [Android only] corresponding to [`setPhy`](https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder#setPhy(int))
|
|
138
139
|
|
|
139
140
|
**Examples**
|
|
140
141
|
|
|
@@ -2,6 +2,7 @@ package it.innove;
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import android.bluetooth.BluetoothAdapter;
|
|
5
|
+
import android.bluetooth.BluetoothDevice;
|
|
5
6
|
import android.bluetooth.le.ScanCallback;
|
|
6
7
|
import android.bluetooth.le.ScanFilter;
|
|
7
8
|
import android.bluetooth.le.ScanResult;
|
|
@@ -54,6 +55,16 @@ public class LollipopScanManager extends ScanManager {
|
|
|
54
55
|
if (options.hasKey("reportDelay")) {
|
|
55
56
|
scanSettingsBuilder.setReportDelay(options.getInt("reportDelay"));
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && options.hasKey("phy")) {
|
|
60
|
+
int phy = options.getInt("phy");
|
|
61
|
+
if (phy == BluetoothDevice.PHY_LE_CODED && getBluetoothAdapter().isLeCodedPhySupported()) {
|
|
62
|
+
scanSettingsBuilder.setPhy(BluetoothDevice.PHY_LE_CODED);
|
|
63
|
+
}
|
|
64
|
+
if (phy == BluetoothDevice.PHY_LE_2M && getBluetoothAdapter().isLe2MPhySupported()) {
|
|
65
|
+
scanSettingsBuilder.setPhy(BluetoothDevice.PHY_LE_2M);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
57
68
|
|
|
58
69
|
if (serviceUUIDs.size() > 0) {
|
|
59
70
|
for(int i = 0; i < serviceUUIDs.size(); i++){
|
package/index.d.ts
CHANGED