io.appium.java_client.battery.BatteryInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Java client for Appium Mobile Webdriver
package io.appium.java_client.battery;
import java.util.Map;
public abstract class BatteryInfo {
private final Map input;
public BatteryInfo(Map input) {
this.input = input;
}
/**
* Returns battery level.
*
* @return Battery level in range [0.0, 1.0], where 1.0 means 100% charge.
*/
public double getLevel() {
final Object value = getInput().get("level");
if (value instanceof Long) {
return ((Long) value).doubleValue();
}
return (double) value;
}
/**
* Returns battery state.
*
* @param The type of state data object for the corresponding platform.
* @return Battery state value.
*/
public abstract T getState();
protected Map getInput() {
return this.input;
}
}