Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Enumerations | Functions
sol-power-supply.h File Reference

Power Supply API provides a way to get information about battery, UPS, AC or DC power supply. More...

#include <stdlib.h>
#include <sol-vector.h>
#include <sol-buffer.h>

Go to the source code of this file.

Enumerations

enum  sol_power_supply_capacity_level {
  SOL_POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN, SOL_POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL, SOL_POWER_SUPPLY_CAPACITY_LEVEL_LOW, SOL_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
  SOL_POWER_SUPPLY_CAPACITY_LEVEL_HIGH, SOL_POWER_SUPPLY_CAPACITY_LEVEL_FULL
}
 Power supply capacity level. More...
 
enum  sol_power_supply_status {
  SOL_POWER_SUPPLY_STATUS_UNKNOWN, SOL_POWER_SUPPLY_STATUS_CHARGING, SOL_POWER_SUPPLY_STATUS_DISCHARGING, SOL_POWER_SUPPLY_STATUS_NOT_CHARGING,
  SOL_POWER_SUPPLY_STATUS_FULL
}
 Power supply charging status. More...
 
enum  sol_power_supply_type {
  SOL_POWER_SUPPLY_TYPE_UNKNOWN, SOL_POWER_SUPPLY_TYPE_BATTERY, SOL_POWER_SUPPLY_TYPE_UPS, SOL_POWER_SUPPLY_TYPE_MAINS,
  SOL_POWER_SUPPLY_TYPE_USB, SOL_POWER_SUPPLY_TYPE_USB_DCP, SOL_POWER_SUPPLY_TYPE_USB_CDP, SOL_POWER_SUPPLY_TYPE_USB_ACA
}
 Type of power supply. More...
 

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...
 

Detailed Description

Power Supply API provides a way to get information about battery, UPS, AC or DC power supply.

Some information only is provided by some kinds of power supplies and depends on platform and drivers.