Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
bas.h File Reference
#include <stdint.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

Enumerations

enum  bt_bas_bcs_flags { BT_BAS_BCS_BATTERY_CRITICAL_STATE = BIT(0) , BT_BAS_BCS_IMMEDIATE_SERVICE_REQUIRED = BIT(1) }
 Battery Critical Status Characteristic flags. More...
 
enum  bt_bas_bls_flags { BT_BAS_BLS_FLAG_IDENTIFIER_PRESENT = BIT(0) , BT_BAS_BLS_FLAG_BATTERY_LEVEL_PRESENT = BIT(1) , BT_BAS_BLS_FLAG_ADDITIONAL_STATUS_PRESENT = BIT(2) }
 Battery Level Status Characteristic flags. More...
 
enum  bt_bas_bls_battery_present { BT_BAS_BLS_BATTERY_NOT_PRESENT = 0 , BT_BAS_BLS_BATTERY_PRESENT = 1 }
 Battery Present Status. More...
 
enum  bt_bas_bls_wired_power_source { BT_BAS_BLS_WIRED_POWER_NOT_CONNECTED = 0 , BT_BAS_BLS_WIRED_POWER_CONNECTED = 1 , BT_BAS_BLS_WIRED_POWER_UNKNOWN = 2 }
 Wired External Power Source Status. More...
 
enum  bt_bas_bls_wireless_power_source { BT_BAS_BLS_WIRELESS_POWER_NOT_CONNECTED = 0 , BT_BAS_BLS_WIRELESS_POWER_CONNECTED = 1 , BT_BAS_BLS_WIRELESS_POWER_UNKNOWN = 2 }
 Wireless External Power Source Status. More...
 
enum  bt_bas_bls_battery_charge_state { BT_BAS_BLS_CHARGE_STATE_UNKNOWN = 0 , BT_BAS_BLS_CHARGE_STATE_CHARGING = 1 , BT_BAS_BLS_CHARGE_STATE_DISCHARGING_ACTIVE = 2 , BT_BAS_BLS_CHARGE_STATE_DISCHARGING_INACTIVE = 3 }
 Battery Charge State. More...
 
enum  bt_bas_bls_battery_charge_level { BT_BAS_BLS_CHARGE_LEVEL_UNKNOWN = 0 , BT_BAS_BLS_CHARGE_LEVEL_GOOD = 1 , BT_BAS_BLS_CHARGE_LEVEL_LOW = 2 , BT_BAS_BLS_CHARGE_LEVEL_CRITICAL = 3 }
 Battery Charge Level. More...
 
enum  bt_bas_bls_battery_charge_type {
  BT_BAS_BLS_CHARGE_TYPE_UNKNOWN = 0 , BT_BAS_BLS_CHARGE_TYPE_CONSTANT_CURRENT = 1 , BT_BAS_BLS_CHARGE_TYPE_CONSTANT_VOLTAGE = 2 , BT_BAS_BLS_CHARGE_TYPE_TRICKLE = 3 ,
  BT_BAS_BLS_CHARGE_TYPE_FLOAT = 4
}
 Battery Charge Type. More...
 
enum  bt_bas_bls_charging_fault_reason { BT_BAS_BLS_FAULT_REASON_NONE = 0 , BT_BAS_BLS_FAULT_REASON_BATTERY = BIT(0) , BT_BAS_BLS_FAULT_REASON_EXTERNAL_POWER = BIT(1) , BT_BAS_BLS_FAULT_REASON_OTHER = BIT(2) }
 Charging Fault Reason. More...
 
enum  bt_bas_bls_service_required { BT_BAS_BLS_SERVICE_REQUIRED_FALSE = 0 , BT_BAS_BLS_SERVICE_REQUIRED_TRUE = 1 , BT_BAS_BLS_SERVICE_REQUIRED_UNKNOWN = 2 }
 Service Required Status. More...
 
enum  bt_bas_bls_battery_fault { BT_BAS_BLS_BATTERY_FAULT_NO = 0 , BT_BAS_BLS_BATTERY_FAULT_YES = 1 }
 Battery Fault Status. More...
 

Functions

uint8_t bt_bas_get_battery_level (void)
 Read battery level value.
 
int bt_bas_set_battery_level (uint8_t level)
 Update battery level value.
 
void bt_bas_bls_set_battery_present (enum bt_bas_bls_battery_present present)
 Set the battery present status.
 
void bt_bas_bls_set_wired_external_power_source (enum bt_bas_bls_wired_power_source source)
 Set the wired external power source status.
 
void bt_bas_bls_set_wireless_external_power_source (enum bt_bas_bls_wireless_power_source source)
 Set the wireless external power source status.
 
void bt_bas_bls_set_battery_charge_state (enum bt_bas_bls_battery_charge_state state)
 Set the battery charge state.
 
void bt_bas_bls_set_battery_charge_level (enum bt_bas_bls_battery_charge_level level)
 Set the battery charge level.
 
void bt_bas_bls_set_battery_charge_type (enum bt_bas_bls_battery_charge_type type)
 Set the battery charge type.
 
void bt_bas_bls_set_charging_fault_reason (enum bt_bas_bls_charging_fault_reason reason)
 Set the charging fault reason.
 
void bt_bas_bls_set_identifier (uint16_t identifier)
 Set the identifier of the battery.
 
void bt_bas_bls_set_service_required (enum bt_bas_bls_service_required value)
 Set the service required status.
 
void bt_bas_bls_set_battery_fault (enum bt_bas_bls_battery_fault value)
 Set the battery fault status.