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
ScannerConfigurationusing the configured parameters.- Returns
A valid
ScannerConfiguration.
buildDefault¶
-
public ScannerConfiguration
buildDefault()¶ Builds a new instance of a
ScannerConfigurationusing 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
Stopconfiguration.- 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_SCANNERseconds.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
Cyclicif the configuration was not explicitly configured bycontinuous()orstop()calls. Ifdurationis not set, will callwithShortDuration().- Parameters
cycleTime – The desired scan cycle duration, in seconds. Ignored if
<= 0and 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 Shotif the configuration was not explicitly configured bycontinuous()orstop()calls andcycle timeis not set.- Parameters
duration – The desired scan duration, in seconds. Ignored if
<= 0and truncated toMAX_DURATION.
- Returns
This Builder instance.
withLegacyDiscoveryFallback¶
-
public ScannerConfiguration.Builder
withLegacyDiscoveryFallback()¶ Sets if legacy
Kallistodevice 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
trueif 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
listenerto receive scan events.
- Returns
This Builder instance.
withLongDuration¶
-
public ScannerConfiguration.Builder
withLongDuration()¶ Sets the duration time to
LONG_SCANseconds.Helper method that call
withDuration(int).- Returns
This Builder instance.
withLowPowerCycle¶
-
public ScannerConfiguration.Builder
withLowPowerCycle()¶ Sets the duration time to
LOW_POWER_SCANNERseconds.Helper method that call
withCycle(int).- Returns
This Builder instance.
withMediumDuration¶
-
public ScannerConfiguration.Builder
withMediumDuration()¶ Sets the duration time to
MEDIUM_SCANseconds.Helper method that call
withDuration(int).- Returns
This Builder instance.
withResponsiveCycle¶
-
public ScannerConfiguration.Builder
withResponsiveCycle()¶ Sets the duration time to
RESPONSIVE_SCANNERseconds.Helper method that call
withCycle(int).- Returns
This Builder instance.
withShortDuration¶
-
public ScannerConfiguration.Builder
withShortDuration()¶ Sets the duration time to
SHORT_SCANseconds.Helper method that call
withDuration(int).- Returns
This Builder instance.