blob: ab6cee703aa711d334e2ff2969c4d7c7e68f1252 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.power;
enum Status {
OK = 0;
NotAvailable = 1;
// Provides battery status
struct BatteryStatus {
// Error status
Status status;
// If battery is present
bool batteryPresent;
// If battery is charging
bool charging;
// If battery is dis-charging
bool discharging;
// If battery is at critical level
bool critical;
// If power cable is plugged in
bool powerAdapterOnline;
// To distinguish between latest and stale status
int64 timestamp;
// Battery level in percentage
float32 level;
// Remaining Battery life in hours. It is negative when battery is not discharging
float32 remainingBatteryLife;
// Manager Interface used to manage power
protocol PowerManager {
// Gets battery status
GetBatteryStatus() -> (BatteryStatus status);
// watcher called when battery status changes
Watch(PowerManagerWatcher watcher);
// Watcher on battery status
protocol PowerManagerWatcher {
OnChangeBatteryStatus(BatteryStatus battery_status);