Soletta™ Framework
|
Functions | |
int | sol_power_supply_exists (const char *name, bool *exist) |
Check if a given power supply can be found. More... | |
int | sol_power_supply_free_list (struct sol_ptr_vector *list) |
Free a list of power supply names. More... | |
int | sol_power_supply_get_capacity (const char *name, int *capacity) |
Get power supply capacity percentage. More... | |
int | sol_power_supply_get_capacity_level (const char *name, enum sol_power_supply_capacity_level *capacity_level) |
Get capacity level, as provided by driver (critical, low, normal, high, full). More... | |
int | sol_power_supply_get_list (struct sol_ptr_vector *list) |
Retrieves a list of names of all power supplies found. More... | |
int | sol_power_supply_get_list_by_type (struct sol_ptr_vector *list, enum sol_power_supply_type type) |
Retrieves a list of names of all power supplies found that match a specified type. More... | |
int | sol_power_supply_get_manufacturer (const char *name, struct sol_buffer *manufacturer_buf) |
Get manufacturer of a given power supply. More... | |
int | sol_power_supply_get_max_voltage (const char *name, int *voltage) |
Get maximum voltage measured by hardware. More... | |
int | sol_power_supply_get_max_voltage_design (const char *name, int *voltage) |
Get value of voltage when supply is full as defined by design. More... | |
int | sol_power_supply_get_min_voltage (const char *name, int *voltage) |
Get minimum voltage measured by hardware. More... | |
int | sol_power_supply_get_min_voltage_design (const char *name, int *voltage) |
Get value of voltage when supply is empty as defined by design. More... | |
int | sol_power_supply_get_model_name (const char *name, struct sol_buffer *model_name_buf) |
Get model name of a given power supply. More... | |
int | sol_power_supply_get_serial_number (const char *name, struct sol_buffer *serial_number_buf) |
Get serial number of a given power supply. More... | |
int | sol_power_supply_get_status (const char *name, enum sol_power_supply_status *status) |
Get power supply status (charging, discharging, not charging, full). More... | |
int | sol_power_supply_get_type (const char *name, enum sol_power_supply_type *type) |
Get type of power supply (battery, USB, ...) More... | |
int | sol_power_supply_get_voltage (const char *name, int *voltage) |
Get current voltage. More... | |
int | sol_power_supply_is_online (const char *name, bool *online) |
Check if a power supply is online. More... | |
int | sol_power_supply_is_present (const char *name, bool *present) |
Check if a power supply is present. More... | |
Power supply capacity level.
It represents capacity as provided by sol_power_supply_get_capacity() in well defined ranges.
It doesn't apply to some types of power supplies. Batteries usually provide capacity level.
Type of power supply.
It may be unknown, battery, mains (like ac), and usb variants.
int sol_power_supply_exists | ( | const char * | name, |
bool * | exist | ||
) |
Check if a given power supply can be found.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
exist | On success, if power supply is found, exist will be set to True . Otherwise it'll be set to false. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_free_list | ( | struct sol_ptr_vector * | list | ) |
Free a list of power supply names.
It will free strings and vector data.
list | A vector returned by sol_power_supply_get_list() or sol_power_supply_get_list_by_type(). |
0
. On error, a negative value is returned. int sol_power_supply_get_capacity | ( | const char * | name, |
int * | capacity | ||
) |
Get power supply capacity percentage.
Value should vary from 0 to 100 (full).
Usually provided by batteries.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
capacity | Capacity percentage will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_capacity_level | ( | const char * | name, |
enum sol_power_supply_capacity_level * | capacity_level | ||
) |
Get capacity level, as provided by driver (critical, low, normal, high, full).
Usually provided by batteries.
If interested on evaluate level using other ranges, or interested on make them consistent for the same percentage between different drivers, sol_power_supply_get_capacity() should be used.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
capacity_level | Capacity level of power supply will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_list | ( | struct sol_ptr_vector * | list | ) |
Retrieves a list of names of all power supplies found.
Types may vary.
list | A vector that will be initialized and filled with all power supply names found. It's required to free it with sol_power_supply_free_list() after usage. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_list_by_type | ( | struct sol_ptr_vector * | list, |
enum sol_power_supply_type | type | ||
) |
Retrieves a list of names of all power supplies found that match a specified type.
list | A vector that will be initialized and filled with all power supply names found. It's required to free it with sol_power_supply_free_list() after usage. |
type | Type of power supply to be fetched. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_manufacturer | ( | const char * | name, |
struct sol_buffer * | manufacturer_buf | ||
) |
Get manufacturer of a given power supply.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
manufacturer_buf | Manufacturer of power supply will be appended to this buffer. The buffer must be already initialized. |
0
. On error, a negative value is returned and the property value will not be appended to manufacturer_buf
. int sol_power_supply_get_max_voltage | ( | const char * | name, |
int * | voltage | ||
) |
Get maximum voltage measured by hardware.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
voltage | Maximum voltage measured by hardwared will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_max_voltage_design | ( | const char * | name, |
int * | voltage | ||
) |
Get value of voltage when supply is full as defined by design.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
voltage | Maximum voltage as defined by design will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_min_voltage | ( | const char * | name, |
int * | voltage | ||
) |
Get minimum voltage measured by hardware.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
voltage | Minimum voltage measured by hardwared will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_min_voltage_design | ( | const char * | name, |
int * | voltage | ||
) |
Get value of voltage when supply is empty as defined by design.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
voltage | Minimum voltage as defined by design will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_model_name | ( | const char * | name, |
struct sol_buffer * | model_name_buf | ||
) |
Get model name of a given power supply.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
model_name_buf | Model name of power supply will be appended to this buffer. The buffer must be already initialized. |
0
. On error, a negative value is returned and the property value will not be appended to model_name_buf
int sol_power_supply_get_serial_number | ( | const char * | name, |
struct sol_buffer * | serial_number_buf | ||
) |
Get serial number of a given power supply.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
serial_number_buf | Serial number of power supply will be appended to this buffer. The buffer must be already initialized. |
0
. On error, a negative value is returned and the property value will not be appended to serial_number_buf
. int sol_power_supply_get_status | ( | const char * | name, |
enum sol_power_supply_status * | status | ||
) |
Get power supply status (charging, discharging, not charging, full).
Usually provided by batteries.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
status | Status of power supply will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_type | ( | const char * | name, |
enum sol_power_supply_type * | type | ||
) |
Get type of power supply (battery, USB, ...)
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
type | Type of power supply will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_get_voltage | ( | const char * | name, |
int * | voltage | ||
) |
Get current voltage.
There are two possible voltage ranges: defined by design and measured by hardware.
Minimal and maximal voltages defined by design means expected voltage at normal conditions for supply when it's empty and full. Such values are provided by sol_power_supply_get_min_voltage_design() and sol_power_supply_get_max_voltage_design().
If hardware is able to measure and retain voltage information, these thresholds may be provided by sol_power_supply_get_min_voltage() and sol_power_supply_get_max_voltage().
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
voltage | Current voltage will be set on this pointer on success. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_is_online | ( | const char * | name, |
bool * | online | ||
) |
Check if a power supply is online.
Usually provided by AC / USB power supplies.
For example, if a charger is connected to the wall it would be considered online.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
online | On success, if power supply is online this pointer will be set to True or to False otherwise. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid). int sol_power_supply_is_present | ( | const char * | name, |
bool * | present | ||
) |
Check if a power supply is present.
Usually provided by batteries.
name | Name of power supply. A list of all board supplies names may be fetched with sol_power_supply_get_list(). |
present | On success, if power supply is present this pointer will be set to True or to False if not attached to the board at the moment. |
0
. On error, a negative value is returned and properties won't be set (pointers won't be valid).