Home | History | Annotate | Download | only in power_manager
      1 // Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 syntax = "proto2";
      6 
      7 option optimize_for = LITE_RUNTIME;
      8 
      9 package power_manager;
     10 
     11 // Power supply status sent from powerd to Chrome.
     12 message PowerSupplyProperties {
     13   // For any of these power sources, the system may be consuming power at a high
     14   // enough rate that the battery is discharging rather than charging; see
     15   // BatteryState.
     16   enum ExternalPower {
     17     // AC/line/mains or USB PD power is connected. This is typically the
     18     // highest-power source that can be attached to the system.
     19     AC = 0;
     20 
     21     // A low-power USB source (SDP, DCP, CDP, or ACA) is connected.
     22     USB = 1;
     23 
     24     // No external power source is connected.
     25     DISCONNECTED = 2;
     26 
     27     // Next value to use: 4
     28   }
     29 
     30   enum BatteryState {
     31     // The battery is full or close to full.
     32     FULL = 0;
     33 
     34     // The battery is being charged but is not yet full.
     35     CHARGING = 1;
     36 
     37     // The battery is discharging. Note that an external power source may be
     38     // connected but not supplying enough power to offset the system's
     39     // instantaneous power consumption. This state is also used if the battery
     40     // is neither charging nor discharging (i.e. current is zero) in a non-full
     41     // state, which may indicate a battery defect.
     42     DISCHARGING = 2;
     43 
     44     // The system doesn't have a battery.
     45     NOT_PRESENT = 3;
     46 
     47     // Next value to use: 4
     48   }
     49 
     50   // Details about a potential source of power to the system.
     51   message PowerSource {
     52     enum Port {
     53       // The location of the port is unknown, or there's only one port.
     54       UNKNOWN = 0;
     55 
     56       // Various positions on the device. The first word describes the side of
     57       // the device where the port is located while the second clarifies the
     58       // position. For example, LEFT_BACK means the farthest-back port on the
     59       // left side, while BACK_LEFT means the leftmost port on the back of the
     60       // device.
     61       LEFT        = 1;
     62       RIGHT       = 2;
     63       BACK        = 3;
     64       FRONT       = 4;
     65       LEFT_FRONT  = 5;
     66       LEFT_BACK   = 6;
     67       RIGHT_FRONT = 7;
     68       RIGHT_BACK  = 8;
     69       BACK_LEFT   = 9;
     70       BACK_RIGHT  = 10;
     71 
     72       // Next value to use: 11
     73     }
     74 
     75     // Opaque ID corresponding to the device; see |external_power_source_id|.
     76     optional string id = 1;
     77 
     78     // The charging port to which this power source is connected.
     79     optional Port port = 7;
     80 
     81     // Raw strings read from |manufacturer| and |model_name| files in sysfs.
     82     optional string manufacturer_id = 4;
     83     optional string model_id = 5;
     84 
     85     // Maximum power this source is capable of delivering, in watts.
     86     optional double max_power = 6;
     87 
     88     // True if the power source will automatically deliver charge to the system
     89     // when connected (assuming there isn't another |active_by_default| source
     90     // doing so). If false, the source will not deliver charge unless requested
     91     // to do so by the user.
     92     optional bool active_by_default = 3;
     93 
     94     // Next ID to use: 8
     95   }
     96 
     97   // Current state of the external power source.
     98   optional ExternalPower external_power = 14;
     99 
    100   // ID of the PowerSource that is currently providing power to the system.
    101   optional string external_power_source_id = 17;
    102 
    103   // Currently-connected external power sources.
    104   repeated PowerSource available_external_power_source = 18;
    105 
    106   // Current state of the battery.
    107   optional BatteryState battery_state = 15;
    108 
    109   // Estimated battery charge as a percent of its total capacity, in the
    110   // range [0.0, 100.0]. Unset if a battery isn't present.
    111   optional double battery_percent = 7 [default = -1.0];
    112 
    113   // Estimated time until the battery is empty, in seconds, or zero if the
    114   // battery isn't discharging. -1 if the estimated time would be huge
    115   // (e.g. because the current is zero or close to zero). Unset if a battery
    116   // isn't present.
    117   optional int64 battery_time_to_empty_sec = 5;
    118 
    119   // Estimated time until the battery is full, in seconds, or zero if the
    120   // battery isn't charging. -1 if the estimated time would be huge (e.g.
    121   // because the current is zero or close to zero). Unset if a battery isn't
    122   // present.
    123   optional int64 battery_time_to_full_sec = 6;
    124 
    125   // True when |battery_time_to_*| can't be trusted, e.g. because the power
    126   // source just changed. Unset if a battery isn't present.
    127   optional bool is_calculating_battery_time = 12 [default = false];
    128 
    129   // The battery discharge rate measured in W. Positive if the battery is being
    130   // discharged, negative if it's being charged, or unset if a battery isn't
    131   // present.
    132   optional double battery_discharge_rate = 16;
    133 
    134   // True if it is possible for some connected devices to function as either
    135   // sources or sinks (i.e. to either deliver or receive charge).
    136   optional bool supports_dual_role_devices = 19;
    137 
    138   // Next ID to use: 20
    139 }
    140