Sandeep Patil | c7a5ff7 | 2016-11-08 16:35:04 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.hardware.health@1.0; |
| 18 | |
| 19 | interface IHealth { |
| 20 | /** |
| 21 | * This function lets you change healthd configuration from default if |
| 22 | * desired. It must be called exactly once at startup time. |
| 23 | * |
| 24 | * The configuration values are described in 'struct HealthConfig'. |
| 25 | * To use default configuration, simply return without modifying the |
| 26 | * fields of the config parameter. |
| 27 | * |
| 28 | * @param default healthd configuration. |
| 29 | */ |
| 30 | init(HealthConfig config) generates (HealthConfig configOut); |
| 31 | |
| 32 | /** |
| 33 | * This function is a hook to update/change device's HealthInfo (as described |
| 34 | * in 'struct HealthInfo'). |
| 35 | * |
| 36 | * 'HealthInfo' describes device's battery and charging status, typically |
| 37 | * read from kernel. These values may be modified in this call. |
| 38 | * |
| 39 | * @param Device Health info as described in 'struct HealthInfo'. |
| 40 | * @return skipLogging Indication to the caller to add 'or' skip logging the health |
| 41 | * information. Return 'true' to skip logging the update. |
| 42 | * @return infoOut HealthInfo to be sent to client code. (May or may |
| 43 | * not be modified). |
| 44 | */ |
| 45 | update(HealthInfo info) generates (bool skipLogging, HealthInfo infoOut); |
| 46 | |
| 47 | /** |
| 48 | * This function is called by healthd when framework queries for remaining |
| 49 | * energy in the Battery through BatteryManager APIs. |
| 50 | * |
| 51 | * @return result Result of querying enery counter for the battery. |
| 52 | * @return energy Battery remaining energy in nanowatt-hours. |
| 53 | * Must be '0' if result is anything other than Result::SUCCESS. |
| 54 | */ |
| 55 | energyCounter() generates (Result result, int64_t energy); |
| 56 | }; |