Class SensorScanSettings

java.lang.Object
com.codename1.health.sensors.SensorScanSettings

public final class SensorScanSettings extends Object
Which sensors to look for and for how long.
  • Constructor Details

    • SensorScanSettings

      public SensorScanSettings()
  • Method Details

    • addProfile

      public SensorScanSettings addProfile(HealthSensorProfile profile)
      Looks for devices advertising this profile. Add several to scan for more than one kind at once; adding none scans for every profile this framework understands.
    • getProfiles

      public List<HealthSensorProfile> getProfiles()
      The profiles being scanned for, empty meaning all of them.
    • setTimeoutMillis

      public SensorScanSettings setTimeoutMillis(int timeoutMillis)

      Stops the scan after this many milliseconds. Defaults to 15 seconds.

      A bounded scan is not a convenience: BLE scanning is one of the most expensive things an app can do to a phone's battery, and both platforms throttle or silently stop an app that scans indefinitely.

    • getTimeoutMillis

      public int getTimeoutMillis()
      The scan timeout in milliseconds.
    • setLowPower

      public SensorScanSettings setLowPower(boolean lowPower)
      Scans at a lower duty cycle, trading discovery latency for battery. Worth setting when scanning in the background or for a long time.
    • isLowPower

      public boolean isLowPower()
      true when a low-power scan was requested.