Skip to content

Commit

Permalink
chore (README) add entry for callbackType in scan options & document …
Browse files Browse the repository at this point in the history
…default values.
  • Loading branch information
Mathis Gardon committed Jan 17, 2023
1 parent 8109c07 commit e7c6223
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions BleManager.js
Expand Up @@ -250,7 +250,7 @@ class BleManager {
}

// (ANDROID) Match as many advertisement per filter as hw could allow
// dependes on current capability and availability of the resources in hw.
// depends on current capability and availability of the resources in hw.
if (scanningOptions.numberOfMatches == null) {
scanningOptions.numberOfMatches = 3;
}
Expand All @@ -260,7 +260,7 @@ class BleManager {
scanningOptions.matchMode = 1;
}

// (ANDROID) Defaults to SCAN_MODE_LOW_POWER on android
// (ANDROID) Defaults to SCAN_MODE_LOW_POWER
if (scanningOptions.scanMode == null) {
scanningOptions.scanMode = 0;
}
Expand All @@ -272,6 +272,7 @@ class BleManager {
scanningOptions.callbackType = 1;
}

// (ANDROID) Defaults to 0ms (report results immediately).
if (scanningOptions.reportDelay == null) {
scanningOptions.reportDelay = 0;
}
Expand Down
11 changes: 6 additions & 5 deletions README.md
Expand Up @@ -122,7 +122,7 @@ BleManager.start({ showAlert: false }).then(() => {

### scan(serviceUUIDs, seconds, allowDuplicates, scanningOptions)

Scan for availables peripherals.
Scan for available peripherals.
Returns a `Promise` object.

**Arguments**
Expand All @@ -131,10 +131,11 @@ Returns a `Promise` object.
- `seconds` - `Integer` - the amount of seconds to scan.
- `allowDuplicates` - `Boolean` - [iOS only] allow duplicates in device scanning
- `scanningOptions` - `JSON` - [Android only] after Android 5.0, user can control specific ble scan behaviors:
- `numberOfMatches` - `Number` - [Android only] corresponding to [`setNumOfMatches`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setNumOfMatches(int)>)
- `matchMode` - `Number` - [Android only] corresponding to [`setMatchMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setMatchMode(int)>)
- `scanMode` - `Number` - [Android only] corresponding to [`setScanMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setScanMode(int)>)
- `reportDelay` - `Number` - [Android only] corresponding to [`setReportDelay`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setReportDelay(long)>)
- `numberOfMatches` - `Number` - [Android only] corresponding to [`setNumOfMatches`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setNumOfMatches(int)>). Defaults to `ScanSettings.MATCH_NUM_MAX_ADVERTISEMENT`.
- `matchMode` - `Number` - [Android only] corresponding to [`setMatchMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setMatchMode(int)>). Defaults to `ScanSettings.MATCH_MODE_AGGRESSIVE`.
- `callbackType` - `Number` - [Android only] corresponding to [`setCallbackType`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setCallbackType(int)>). Defaults `ScanSettings.CALLBACK_TYPE_ALL_MATCHES`.
- `scanMode` - `Number` - [Android only] corresponding to [`setScanMode`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setScanMode(int)>). Defaults to `ScanSettings.SCAN_MODE_LOW_POWER`.
- `reportDelay` - `Number` - [Android only] corresponding to [`setReportDelay`](<https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setReportDelay(long)>). Defaults to `0ms`.
- `phy` - `Number` - [Android only] corresponding to [`setPhy`](https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder#setPhy(int))
- `legacy` - `Boolean` - [Android only] corresponding to [`setLegacy`](https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder#setLegacy(boolean))

Expand Down

0 comments on commit e7c6223

Please sign in to comment.