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#include <cutils/properties.h>
18#ifndef __THERMAL_CLIENT_H__
19#define __THERMAL_CLIENT_H__
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define MAX_ACTIONS  (32)
26
27/* Enum for supported fields */
28enum supported_fields {
29	UNKNOWN_FIELD = 0x0,
30	DISABLE_FIELD = 0x1,
31	SAMPLING_FIELD = 0x2,
32	THRESHOLDS_FIELD = 0x4,
33	SET_POINT_FIELD = THRESHOLDS_FIELD,
34	THRESHOLDS_CLR_FIELD = 0x8,
35	SET_POINT_CLR_FIELD = THRESHOLDS_CLR_FIELD,
36	ACTION_INFO_FIELD = 0x10,
37	SUPPORTED_FIELD_MAX = 0x20,
38};
39
40enum field_data_type {
41	FIELD_INT = 0,
42	FIELD_STR,
43	FIELD_INT_ARR,
44	FIELD_ARR_STR,
45	FIELD_ARR_INT_ARR,
46	FIELD_MAX
47};
48
49struct action_info_data {
50	int info[MAX_ACTIONS];
51	uint32_t num_actions;
52};
53
54struct field_data {
55	char *field_name;
56	enum field_data_type data_type;
57	uint32_t num_data;
58	void *data;
59};
60
61struct config_instance {
62	char *cfg_desc;
63	char *algo_type;
64	unsigned int fields_mask;  /* mask set by client to request to adjust supported fields */
65	uint32_t num_fields;
66	struct field_data *fields;
67};
68
69int thermal_client_config_query(char *algo_type, struct config_instance **configs);
70void thermal_client_config_cleanup(struct config_instance *configs, unsigned int config_size);
71int thermal_client_config_set(struct config_instance *configs, unsigned int config_size);
72
73int thermal_client_register_callback(char *client_name, int (*callback)(int , void *, void *), void *data);
74int thermal_client_request(char *client_name, int req_data);
75void thermal_client_unregister_callback(int client_cb_handle);
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif /* __THERMAL_CLIENT_H__ */
82