| // 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. |
| closed protocol BatterySimulatorController { |
| |
| /// Gets battery info. This should be called after |
| /// DisconnectRealBattery |
| strict GetBatteryInfo() -> (struct { |
| info fuchsia.power.battery.BatteryInfo; |
| }); |
| |
| /// Sets Battery Status. This should be called after |
| /// DisconnectRealBattery |
| strict SetBatteryStatus(struct { |
| battery_status fuchsia.power.battery.BatteryStatus; |
| }); |
| |
| /// Sets Charge Status. This should be called after |
| /// DisconnectRealBattery |
| strict SetChargeStatus(struct { |
| charge_status fuchsia.power.battery.ChargeStatus; |
| }); |
| |
| /// Sets Charge Source. This should be called after |
| /// DisconnectRealBattery |
| strict SetChargeSource(struct { |
| charge_source fuchsia.power.battery.ChargeSource; |
| }); |
| |
| /// Sets Battery Percentage. This should be called after |
| /// DisconnectRealBattery |
| strict SetBatteryPercentage(struct { |
| percent float32; |
| }); |
| |
| /// Sets Level Status. This should be called after |
| /// DisconnectRealBattery |
| strict SetLevelStatus(struct { |
| level_status fuchsia.power.battery.LevelStatus; |
| }); |
| |
| /// Sets Time Remaining to full charge / depletion |
| /// This should be called after DisconnectRealBattery |
| strict SetTimeRemaining(struct { |
| duration zx.Duration; |
| }); |
| |
| /// Disconnect the real battery connection |
| strict DisconnectRealBattery(); |
| |
| /// Gets Simulation State |
| strict IsSimulating() -> (struct { |
| simulation_state bool; |
| }); |
| |
| /// Reconnect to the real battery |
| /// This should be called after DisconnectRealBattery |
| strict ReconnectRealBattery(); |
| |
| /// Sets Present Voltage in mV. This should be called after |
| /// DisconnectRealBattery |
| strict SetPresentVoltageMv(struct { |
| voltage uint32; |
| }); |
| |
| /// Sets Remaining Capacity Uah. This should be called after |
| /// DisconnectRealBattery |
| strict SetRemainingCapacityUah(struct { |
| capacity uint32; |
| }); |
| |
| /// Sets the BatterySpec |
| strict SetBatterySpec(struct { |
| spec fuchsia.power.battery.BatterySpec; |
| }); |
| }; |
| |
| /// Simulator interface for battery simulation |
| @discoverable |
| closed protocol BatterySimulator { |
| // Provides commands to modify battery state |
| compose BatterySimulatorController; |
| }; |