blob: 7c9bd4e6216f08618b12f7429ed1134c56d3a468 [file] [log] [blame]
Polina Bondarenko1c408b02015-11-13 17:04:00 +01001/*
2 * Copyright (C) 2015 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 ANDROID_INCLUDE_HARDWARE_HARDWAREPROPERTIES_H
18#define ANDROID_INCLUDE_HARDWARE_HARDWAREPROPERTIES_H
19
20#include <stdint.h>
21#include <sys/cdefs.h>
22#include <sys/types.h>
23
24#include <hardware/hardware.h>
25
26__BEGIN_DECLS
27
28#define HARDWARE_PROPERTIES_HARDWARE_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
29
30/**
31 * The id of this module
32 */
33#define HARDWARE_PROPERTIES_HARDWARE_MODULE_ID "hardware_properties"
34
35/**
36 * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
37 * and the fields of this data structure must begin with hw_module_t
38 * followed by module specific information.
39 */
40typedef struct hardware_properties_module {
41 struct hw_module_t common;
42
43 /*
44 * (*getCpuTemperatures) is called to get CPU temperatures in Celsius of
45 * each core.
46 *
47 * Returns number of cores or negative value on error.
48 *
49 */
50 ssize_t (*getCpuTemperatures)(struct hardware_properties_module *module, float **temps);
51
52 /*
53 * (*getGpuTemperatures) is called to get GPU temperatures in Celsius of
54 * each GPU.
55 *
56 * Returns number of GPUs or negative value on error.
57 *
58 */
59 ssize_t (*getGpuTemperatures)(struct hardware_properties_module *module, float **temps);
60
61 /*
62 * (*getBatteryTemperatures) is called to get battery temperatures in
63 * Celsius.
64 *
65 * Returns number of battery temperatures or negative value on error.
66 *
67 */
68 ssize_t (*getBatteryTemperatures)(struct hardware_properties_module *module, float **temps);
69
70 /*
71 * (*getCpuUsages) is called to get CPU usage information of each core:
72 * active and total times in ms since first boot.
73 *
74 * Returns number of cores or negative value on error.
75 *
76 */
77 ssize_t (*getCpuUsages)(struct hardware_properties_module *module,
78 int64_t **active_times, int64_t **total_times);
79
80 /*
81 * (*getFanSpeeds) is called to get the fan speeds in RPM of each fan.
82 *
83 * Returns number of fans or negative value on error.
84 *
85 */
86 ssize_t (*getFanSpeeds)(struct hardware_properties_module *module,
87 float **fan_speeds);
88} hardware_properties_module_t;
89
90__END_DECLS
91
92#endif // ANDROID_INCLUDE_HARDWARE_HARDWAREPROPERTIES_H