ScannerConfiguration.Builder¶
-
public static class
Builder
¶ Builder class. Allows the creation of a valid
ScannerConfiguration
.Follows the Builder pattern for an easy configuration:
ScannerConfiguration mScannerConfiguration = new ScannerConfiguration.Builder() .withResponsiveCycle() .build();
Methods¶
build¶
-
public ScannerConfiguration
build
()¶ Builds a new instance of a
ScannerConfiguration
using the configured parameters.- Returns
A valid
ScannerConfiguration
.
buildDefault¶
-
public ScannerConfiguration
buildDefault
()¶ Builds a new instance of a
ScannerConfiguration
using the default parameters.Equivalent to:
ScannerConfiguration mScannerConfiguration = new ScannerConfiguration.Builder() .withMediumDuration() .withBalancedCycle() .build();
- Returns
A valid
ScannerConfiguration
.
continuous¶
-
public ScannerConfiguration.Builder
continuous
()¶ Set the scan to
Continuous
.Will only be stopped with a
Stop
configuration.- Returns
This Builder instance.
stop¶
-
public ScannerConfiguration.Builder
stop
()¶ Set the scan to
Stopped
.Will stop any running scan.
- Returns
This Builder instance.
withBalancedCycle¶
-
public ScannerConfiguration.Builder
withBalancedCycle
()¶ Sets the duration time to
BALANCED_SCANNER
seconds.Helper method that call
withCycle(int)
.- Returns
This Builder instance.
withCycle¶
-
public ScannerConfiguration.Builder
withCycle
(int cycleTime)¶ Set the cycle duration time.
Represents the amount of time that the scanner waits after finishing a scan before starting a new scan.
Will set the mode to
Cyclic
if the configuration was not explicitly configured bycontinuous()
orstop()
calls. Ifduration
is not set, will callwithShortDuration()
.- Parameters
cycleTime – The desired scan cycle duration, in seconds. Ignored if
<= 0
and truncated toMAX_CYCLE_DURATION
.
- Returns
This Builder instance.
withDuration¶
-
public ScannerConfiguration.Builder
withDuration
(int duration)¶ Set the scan duration time.
Will set the mode to
One Shot
if the configuration was not explicitly configured bycontinuous()
orstop()
calls andcycle time
is not set.- Parameters
duration – The desired scan duration, in seconds. Ignored if
<= 0
and truncated toMAX_DURATION
.
- Returns
This Builder instance.
withLegacyDiscoveryFallback¶
-
public ScannerConfiguration.Builder
withLegacyDiscoveryFallback
()¶ Sets if legacy
Kallisto
device discovery is enabled.If this is enabled, the scanner will connect to the device in order to discoverFeatures the device features, if the advertising data doesn’t use the firmware SDK Advertising Manager.
Disabled by default.
- Returns
true
if legacy discovery is enabled.
withListener¶
-
public ScannerConfiguration.Builder
withListener
(ScanListener listener)¶ Sets a scan event listener.
Gives more information than simply waiting for a SCAN_FOUND_DEVICE event.
- Parameters
listener – The
listener
to receive scan events.
- Returns
This Builder instance.
withLongDuration¶
-
public ScannerConfiguration.Builder
withLongDuration
()¶ Sets the duration time to
LONG_SCAN
seconds.Helper method that call
withDuration(int)
.- Returns
This Builder instance.
withLowPowerCycle¶
-
public ScannerConfiguration.Builder
withLowPowerCycle
()¶ Sets the duration time to
LOW_POWER_SCANNER
seconds.Helper method that call
withCycle(int)
.- Returns
This Builder instance.
withMediumDuration¶
-
public ScannerConfiguration.Builder
withMediumDuration
()¶ Sets the duration time to
MEDIUM_SCAN
seconds.Helper method that call
withDuration(int)
.- Returns
This Builder instance.
withResponsiveCycle¶
-
public ScannerConfiguration.Builder
withResponsiveCycle
()¶ Sets the duration time to
RESPONSIVE_SCANNER
seconds.Helper method that call
withCycle(int)
.- Returns
This Builder instance.
withShortDuration¶
-
public ScannerConfiguration.Builder
withShortDuration
()¶ Sets the duration time to
SHORT_SCAN
seconds.Helper method that call
withDuration(int)
.- Returns
This Builder instance.