2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef _SENSOR_HAL_H_
19 #define _SENSOR_HAL_H_
23 #include "sensor_hal_types.h"
28 typedef void *sensor_device_t;
29 typedef int (*create_t)(sensor_device_t **devices);
32 * Sensor device interface
33 * 1 device must be abstracted from 1 device event node
37 virtual ~sensor_device() {}
39 uint32_t get_hal_version(void)
41 return SENSOR_HAL_VERSION(1, 0);
44 virtual int get_poll_fd(void) = 0;
45 virtual int get_sensors(const sensor_info_t **sensors) = 0;
47 virtual bool enable(uint32_t id) = 0;
48 virtual bool disable(uint32_t id) = 0;
50 virtual int read_fd(uint32_t **ids) = 0;
51 virtual int get_data(uint32_t id, sensor_data_t **data, int *length) = 0;
53 virtual bool set_interval(uint32_t id, unsigned long val)
57 virtual bool set_batch_latency(uint32_t id, unsigned long val)
61 virtual bool set_attribute_int(uint32_t id, int32_t attribute, int32_t value)
65 virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int len)
69 virtual bool flush(uint32_t id)
75 #endif /* _SENSOR_HAL_H_ */