4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #pragma once /* __SENSOR_ADAPTER_H__ */
22 #include <sensor_internal.h>
26 sensor_info(sensor_type_t _type, int _index, int _interval, int _batch_latency, int _powersave, sensor_cb_t _cb, void *_user_data)
30 , batch_latency(_batch_latency)
31 , powersave(_powersave)
33 , user_data(_user_data)
45 class sensor_adapter {
47 static bool is_supported(sensor_type_t type);
48 static int get_count(sensor_type_t type);
49 static bool get_handle(sensor_info info, int &handle);
51 static bool start(sensor_info info, int &handle);
52 static bool stop(sensor_info info, int handle);
54 static bool change_interval(int handle, int interval);
55 static bool change_batch_latency(int handle, int batch_latency);
56 static bool change_powersave(int handle, int powersave);
57 static bool set_attribute(int handle, int attribute, int value);
58 static bool set_attribute(int handle, int attribute, char *value, int size);
60 static bool get_data(int handle, sensor_type_t type, sensor_data_t &data);
61 static bool flush(int handle);