aboutsummaryrefslogtreecommitdiff
path: root/dbus/power_manager/power_supply_properties.proto
blob: 733e1948fb304b54d27dc4cdd2635450721bcfd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package power_manager;

// Power supply status sent from powerd to Chrome.
message PowerSupplyProperties {
  // For any of these power sources, the system may be consuming power at a high
  // enough rate that the battery is discharging rather than charging; see
  // BatteryState.
  enum ExternalPower {
    // AC/line/mains or USB PD power is connected. This is typically the
    // highest-power source that can be attached to the system.
    AC = 0;

    // A low-power USB source (SDP, DCP, CDP, or ACA) is connected.
    USB = 1;

    // No external power source is connected.
    DISCONNECTED = 2;

    // Next value to use: 4
  }

  enum BatteryState {
    // The battery is full or close to full.
    FULL = 0;

    // The battery is being charged but is not yet full.
    CHARGING = 1;

    // The battery is discharging. Note that an external power source may be
    // connected but not supplying enough power to offset the system's
    // instantaneous power consumption. This state is also used if the battery
    // is neither charging nor discharging (i.e. current is zero) in a non-full
    // state, which may indicate a battery defect.
    DISCHARGING = 2;

    // The system doesn't have a battery.
    NOT_PRESENT = 3;

    // Next value to use: 4
  }

  // Details about a potential source of power to the system.
  message PowerSource {
    // Opaque ID corresponding to the device; see |external_power_source_id|.
    optional string id = 1;

    // Raw strings read from |manufacturer| and |model_name| files in sysfs.
    optional string manufacturer_id = 4;
    optional string model_id = 5;

    // Maximum power this source is capable of delivering, in watts.
    optional double max_power = 6;

    // True if the power source will automatically deliver charge to the system
    // when connected (assuming there isn't another |active_by_default| source
    // doing so). If false, the source will not deliver charge unless requested
    // to do so by the user.
    optional bool active_by_default = 3;

    // Next ID to use: 7
  }

  // Current state of the external power source.
  optional ExternalPower external_power = 14;

  // ID of the PowerSource that is currently providing power to the system.
  optional string external_power_source_id = 17;

  // Currently-connected external power sources.
  repeated PowerSource available_external_power_source = 18;

  // Current state of the battery.
  optional BatteryState battery_state = 15;

  // Estimated battery charge as a percent of its total capacity, in the
  // range [0.0, 100.0].
  optional double battery_percent = 7;

  // Estimated time until the battery is empty, in seconds, or zero if the
  // battery isn't discharging. -1 if the estimated time would be huge
  // (e.g. because the current is zero or close to zero).
  optional int64 battery_time_to_empty_sec = 5;

  // Estimated time until the battery is full, in seconds, or zero if the
  // battery isn't charging. -1 if the estimated time would be huge (e.g.
  // because the current is zero or close to zero).
  optional int64 battery_time_to_full_sec = 6;

  // True when |battery_time_to_*| can't be trusted, e.g. because the power
  // source just changed.
  optional bool is_calculating_battery_time = 12 [default = false];

  // The battery discharge rate measured in W. Positive if the battery is
  // being discharged and negative if it's being charged.
  optional double battery_discharge_rate = 16;

  // True if it is possible for some connected devices to function as either
  // sources or sinks (i.e. to either deliver or receive charge).
  optional bool supports_dual_role_devices = 19;

  // Next ID to use: 20
}