Skip to content

Commit

Permalink
Add possibility to use custom ScanSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
weliem committed Jan 18, 2025
1 parent 3951069 commit baaf9fe
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class BluetoothCentralManager(private val context: Context, private val bluetoot
private var currentCallback: ScanCallback? = null
private var currentFilters: List<ScanFilter>? = null
private var scanSettings: ScanSettings
private val autoConnectScanSettings: ScanSettings
private var autoConnectScanSettings: ScanSettings
private val connectionRetries: MutableMap<String, Int> = ConcurrentHashMap()
internal val pinCodes: MutableMap<String, String> = ConcurrentHashMap()
private var transport = DEFAULT_TRANSPORT
Expand Down Expand Up @@ -260,6 +260,24 @@ class BluetoothCentralManager(private val context: Context, private val bluetoot
scanSettings = getScanSettings(scanMode)
}

/**
* Set the default ScanSettings
*
* @param scanSettings the ScanSettings to set
*/
fun setScanSettings(scanSettings: ScanSettings) {
this.scanSettings = scanSettings
}

/**
* Set autoconnect ScanSettings, used when scanning to autoconnect
*
* @param scanSettings the ScanSettings to set
*/
fun setAutoConnectScanSettings(scanSettings: ScanSettings) {
this.autoConnectScanSettings = scanSettings
}

/**
* Get the transport to be used during connection phase.
*
Expand Down

0 comments on commit baaf9fe

Please sign in to comment.