Edgehog Device SDK ESP32 v0.8.1
ESP32 device SDK for the Edgehog platform
Loading...
Searching...
No Matches
edgehog_battery_status.h File Reference

Edgehog device battery status API. More...

#include "edgehog_device.h"
Include dependency graph for edgehog_battery_status.h:

Go to the source code of this file.

Data Structures

struct  edgehog_battery_status_t
 

Enumerations

enum  edgehog_battery_state {
  BATTERY_INVALID = 0 , BATTERY_IDLE , BATTERY_CHARGING , BATTERY_DISCHARGING ,
  BATTERY_IDLE_OR_CHARGING , BATTERY_FAILURE , BATTERY_REMOVED , BATTERY_UNKNOWN
}
 Edgehog Battery state codes. More...
 

Functions

void edgehog_battery_status_update (edgehog_device_handle_t edgehog_device, const edgehog_battery_status_t *battery_status)
 Update battery status info.
 
void edgehog_battery_status_publish (edgehog_device_handle_t edgehog_device)
 Publish battery status info.
 

Detailed Description

Edgehog device battery status API.

Enumeration Type Documentation

◆ edgehog_battery_state

Edgehog Battery state codes.

Enumerator
BATTERY_INVALID 

The battery state for the device is invalid.

BATTERY_IDLE 

The device is plugged into power and the battery is 100% charged.

BATTERY_CHARGING 

The device is plugged into power and the battery is less than 100% charged.

BATTERY_DISCHARGING 

The device is not plugged into power; the battery is discharging.

BATTERY_IDLE_OR_CHARGING 

The battery state for the device cannot be distinguished between "Idle" and "Charging".

BATTERY_FAILURE 

A generic failure occurred.

BATTERY_REMOVED 

Battery removed from the device

BATTERY_UNKNOWN 

The battery state for the device cannot be determined.

Function Documentation

◆ edgehog_battery_status_publish()

void edgehog_battery_status_publish ( edgehog_device_handle_t edgehog_device)

Publish battery status info.

This function publishes to Astarte all available battery status updates.

Parameters
edgehog_deviceA valid Edgehog device handle.

◆ edgehog_battery_status_update()

void edgehog_battery_status_update ( edgehog_device_handle_t edgehog_device,
const edgehog_battery_status_t * battery_status )

Update battery status info.

This function updates battery status info. This function does not immediately publish the update.

Parameters
edgehog_deviceA valid Edgehog device handle.
battery_statusA battery status structure that contains current battery status. It can be safely allocated on the stack, a copy of it is automatically stored.