Determines when the battery state changes.
More...
Determines when the battery state changes.
The BatteryStateService API lets you know when the battery state changes, that is, its current charge level, whether it is plugged and charging. It uses the BatteryChargeState structure to describe the current power state of Pebble.
Refer to the classio-battery-connection example, which demonstrates using the battery state service in a watchface.
◆ BatteryStateHandler [1/2]
Callback type for battery state change events
- Parameters
-
◆ BatteryStateHandler [2/2]
Callback type for battery state change events
- Parameters
-
◆ battery_state_service_peek()
Peek at the last known battery state.
- Returns
- a BatteryChargeState containing the last known data
◆ battery_state_service_subscribe()
Subscribe to the battery state event service. Once subscribed, the handler gets called on every battery state change
- Parameters
-
handler | A callback to be executed on battery state change event |
◆ battery_state_service_unsubscribe()
void battery_state_service_unsubscribe |
( |
void |
| ) |
|
Unsubscribe from the battery state event service. Once unsubscribed, the previously registered handler will no longer be called.