| // Copyright 2022 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.battery.test; |
| |
| using fuchsia.power.battery; |
| using zx; |
| |
| /// Controller interface to allow modification of battery state. |
| protocol BatterySimulatorController { |
| |
| /// Gets battery info. This should be called after |
| /// DisconnectRealBattery |
| GetBatteryInfo() -> (struct { |
| info fuchsia.power.battery.BatteryInfo; |
| }); |
| |
| /// Sets Battery Status. This should be called after |
| /// DisconnectRealBattery |
| SetBatteryStatus(struct { |
| battery_status fuchsia.power.battery.BatteryStatus; |
| }); |
| |
| /// Sets Charge Status. This should be called after |
| /// DisconnectRealBattery |
| SetChargeStatus(struct { |
| charge_status fuchsia.power.battery.ChargeStatus; |
| }); |
| |
| /// Sets Charge Source. This should be called after |
| /// DisconnectRealBattery |
| SetChargeSource(struct { |
| charge_source fuchsia.power.battery.ChargeSource; |
| }); |
| |
| /// Sets Battery Percentage. This should be called after |
| /// DisconnectRealBattery |
| SetBatteryPercentage(struct { |
| percent float32; |
| }); |
| |
| /// Sets Level Status. This should be called after |
| /// DisconnectRealBattery |
| SetLevelStatus(struct { |
| level_status fuchsia.power.battery.LevelStatus; |
| }); |
| |
| /// Sets Time Remaining to full charge / depletion |
| /// This should be called after DisconnectRealBattery |
| SetTimeRemaining(struct { |
| duration zx.duration; |
| }); |
| |
| /// Disconnect the real battery connection |
| DisconnectRealBattery(); |
| |
| /// Gets Simulation State |
| IsSimulating() -> (struct { |
| simulation_state bool; |
| }); |
| |
| /// Reconnect to the real battery |
| /// This should be called after DisconnectRealBattery |
| ReconnectRealBattery(); |
| }; |
| |
| /// Simulator interface for battery simulation |
| @discoverable |
| protocol BatterySimulator { |
| // Provides commands to modify battery state |
| compose BatterySimulatorController; |
| }; |