blob: 895be40dc9d6c3e02b3ecb34306c6918b57dd5fc [file] [log] [blame]
Todd Poynor10b235e2013-08-07 15:25:14 -07001/*
2 * Copyright (C) 2013 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#ifndef _HEALTHD_H_
18#define _HEALTHD_H_
19
20#include <batteryservice/BatteryService.h>
21
Todd Poynor9face5c2013-08-08 12:24:53 -070022// periodic_chores_interval_fast, periodic_chores_interval_slow: intervals at
23// which healthd wakes up to poll health state and perform periodic chores,
24// in units of seconds:
25//
26// periodic_chores_interval_fast is used while the device is not in
27// suspend, or in suspend and connected to a charger (to watch for battery
28// overheat due to charging). The default value is 60 (1 minute). Value
29// -1 turns off periodic chores (and wakeups) in these conditions.
30//
31// periodic_chores_interval_slow is used when the device is in suspend and
32// not connected to a charger (to watch for a battery drained to zero
33// remaining capacity). The default value is 600 (10 minutes). Value -1
34// tuns off periodic chores (and wakeups) in these conditions.
35
36struct healthd_config {
37 int periodic_chores_interval_fast;
38 int periodic_chores_interval_slow;
39};
40
Todd Poynor10b235e2013-08-07 15:25:14 -070041// The following are implemented in libhealthd_board to handle board-specific
42// behavior.
43//
Todd Poynor10b235e2013-08-07 15:25:14 -070044//
45// To use the default values, this function can simply return without
46// modifying the parameters.
47
Todd Poynor9face5c2013-08-08 12:24:53 -070048void healthd_board_init(struct healthd_config *config);
Todd Poynor10b235e2013-08-07 15:25:14 -070049
50// Process updated battery property values. This function is called when
51// the kernel sends updated battery status via a uevent from the power_supply
52// subsystem, or when updated values are polled by healthd, as for periodic
53// poll of battery state.
54//
55// props are the battery properties read from the kernel. These values may
56// be modified in this call, prior to sending the modified values to the
57// Android runtime.
58//
59// Return 0 to indicate the usual kernel log battery status heartbeat message
60// is to be logged, or non-zero to prevent logging this information.
61
62int healthd_board_battery_update(struct android::BatteryProperties *props);
63
64#endif /* _HEALTHD_H_ */