Class SensorScanSettings
java.lang.Object
com.codename1.health.sensors.SensorScanSettings
Which sensors to look for and for how long.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProfile(HealthSensorProfile profile) Looks for devices advertising this profile.The profiles being scanned for, empty meaning all of them.intThe scan timeout in milliseconds.booleantruewhen a low-power scan was requested.setLowPower(boolean lowPower) Scans at a lower duty cycle, trading discovery latency for battery.setTimeoutMillis(int timeoutMillis) Stops the scan after this many milliseconds.
-
Constructor Details
-
SensorScanSettings
public SensorScanSettings()
-
-
Method Details
-
addProfile
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
The profiles being scanned for, empty meaning all of them. -
setTimeoutMillis
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
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()truewhen a low-power scan was requested.
-