Package com.ferrumx.system.hardware
Class Win32_Battery
java.lang.Object
com.ferrumx.system.hardware.Win32_Battery
This class contains methods that query Win32_Battery class of WMI to fetch
Battery information.
Fetches the following properties: Caption, Description, Name, Status, DeviceID, PowerManagementCapabilities, PowerManagementSupported, BatteryStatus, BatteryChemistry, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, EstimatedChargeRemaining
Version
- Author:
- Egg-03
-
Method Summary
Modifier and TypeMethodDescriptionThis method calls theCIM_ML.getPropertiesAndTheirValues(String, String)
function and passes the WMI Classname and the properties whose values we want to fetch, as parameters
-
Method Details
-
getBattery
public static Map<String,String> getBattery() throws IOException, IndexOutOfBoundsException, ShellException, InterruptedExceptionThis method calls theCIM_ML.getPropertiesAndTheirValues(String, String)
function and passes the WMI Classname and the properties whose values we want to fetch, as parameters- Returns:
- the Caption, Description, Name, Status, DeviceID,
PowerManagementCapabilities, PowerManagementSupported, BatteryStatus,
BatteryChemistry, DesignCapacity, DesignVoltage,
EstimatedChargeRemaining, EstimatedRunTime details of your Battery in
the form of a
Map
- Throws:
IOException
- re-throws the exception thrown byCIM_ML.getPropertiesAndTheirValues(String, String)
when there are I/O Errors during streaming of data from and to Powershell and other generated filesIndexOutOfBoundsException
- re-throws the exception thrown byCIM_ML.getPropertiesAndTheirValues(String, String)
when there is a parsing error of data fetched from Windows PowershellShellException
- if any internal command used in the powershell throws errorsInterruptedException
- if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
-