Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Battery Service (BAS) More...
Battery Service (BAS)
[Experimental] Users should note that the APIs can change as a part of ongoing development.
enum bt_bas_bcs_flags |
#include <include/zephyr/bluetooth/services/bas.h>
Battery Critical Status Characteristic flags.
Enumeration for the flags indicating the presence of various fields in the Battery Critical Status characteristic.
Enumerator | |
---|---|
BT_BAS_BCS_BATTERY_CRITICAL_STATE | Battery Critical Status Bit 0: Critical Power State. |
BT_BAS_BCS_IMMEDIATE_SERVICE_REQUIRED | Battery Critical Status Bit 1: Immediate Service Required. |
#include <include/zephyr/bluetooth/services/bas.h>
Battery Charge Level.
Enumeration for the level of charge in the battery.
#include <include/zephyr/bluetooth/services/bas.h>
Battery Charge State.
Enumeration for the charge state of the battery.
#include <include/zephyr/bluetooth/services/bas.h>
Battery Charge Type.
Enumeration for the type of charging applied to the battery.
#include <include/zephyr/bluetooth/services/bas.h>
Battery Fault Status.
Enumeration for the fault status of the battery.
Enumerator | |
---|---|
BT_BAS_BLS_BATTERY_FAULT_NO | No battery fault. |
BT_BAS_BLS_BATTERY_FAULT_YES | Battery fault present. |
#include <include/zephyr/bluetooth/services/bas.h>
Battery Present Status.
Enumeration for the presence of the battery.
Enumerator | |
---|---|
BT_BAS_BLS_BATTERY_NOT_PRESENT | Battery is not present. |
BT_BAS_BLS_BATTERY_PRESENT | Battery is present. |
#include <include/zephyr/bluetooth/services/bas.h>
Charging Fault Reason.
Enumeration for the reasons of charging faults.
enum bt_bas_bls_flags |
#include <include/zephyr/bluetooth/services/bas.h>
Battery Level Status Characteristic flags.
Enumeration for the flags indicating the presence of various fields in the Battery Level Status characteristic.
#include <include/zephyr/bluetooth/services/bas.h>
Service Required Status.
Enumeration for whether the service is required.
Enumerator | |
---|---|
BT_BAS_BLS_SERVICE_REQUIRED_FALSE | Service is not required. |
BT_BAS_BLS_SERVICE_REQUIRED_TRUE | Service is required. |
BT_BAS_BLS_SERVICE_REQUIRED_UNKNOWN | Service requirement is unknown. |
#include <include/zephyr/bluetooth/services/bas.h>
Wired External Power Source Status.
Enumeration for the status of the wired external power source.
#include <include/zephyr/bluetooth/services/bas.h>
Wireless External Power Source Status.
Enumeration for the status of the wireless external power source.
void bt_bas_bls_set_battery_charge_level | ( | enum bt_bas_bls_battery_charge_level | level | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the battery charge level.
level | The battery charge level to set. |
void bt_bas_bls_set_battery_charge_state | ( | enum bt_bas_bls_battery_charge_state | state | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the battery charge state.
state | The battery charge state to set. |
void bt_bas_bls_set_battery_charge_type | ( | enum bt_bas_bls_battery_charge_type | type | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the battery charge type.
type | The battery charge type to set. |
void bt_bas_bls_set_battery_fault | ( | enum bt_bas_bls_battery_fault | value | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the battery fault status.
CONFIG_BT_BAS_BLS_ADDITIONAL_STATUS_PRESENT.
value | Battery fault status to set. |
void bt_bas_bls_set_battery_present | ( | enum bt_bas_bls_battery_present | present | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the battery present status.
present | The battery present status to set. |
void bt_bas_bls_set_charging_fault_reason | ( | enum bt_bas_bls_charging_fault_reason | reason | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the charging fault reason.
reason | The charging fault reason to set. |
void bt_bas_bls_set_identifier | ( | uint16_t | identifier | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the identifier of the battery.
CONFIG_BT_BAS_BLS_IDENTIFIER_PRESENT.
identifier | Identifier to set. |
void bt_bas_bls_set_service_required | ( | enum bt_bas_bls_service_required | value | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the service required status.
CONFIG_BT_BAS_BLS_ADDITIONAL_STATUS_PRESENT.
value | Service required status to set. |
void bt_bas_bls_set_wired_external_power_source | ( | enum bt_bas_bls_wired_power_source | source | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the wired external power source status.
source | The wired external power source status to set. |
void bt_bas_bls_set_wireless_external_power_source | ( | enum bt_bas_bls_wireless_power_source | source | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Set the wireless external power source status.
source | The wireless external power source status to set. |
uint8_t bt_bas_get_battery_level | ( | void | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Read battery level value.
Read the characteristic value of the battery level
int bt_bas_set_battery_level | ( | uint8_t | level | ) |
#include <include/zephyr/bluetooth/services/bas.h>
Update battery level value.
Update the characteristic value of the battery level This will send a GATT notification to all current subscribers.
level | The battery level in percent. |