All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.appium.java_client.battery.BatteryInfo Maven / Gradle / Ivy

There is a newer version: 9.3.0
Show newest version
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.
     *
     * @return Battery state value.
     */
    public abstract  T getState();

    protected Map getInput() {
        return this.input;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy