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 #ifndef __FUSION_SENSOR_H__
21 #define __FUSION_SENSOR_H__
25 #include <sensor_types.h>
29 #ifndef FUSION_SENSOR_VERSION
30 #define FUSION_SENSOR_VERSION(maj, min) \
31 ((((maj) & 0xFFFF) << 24) | ((min) & 0xFFFF))
47 typedef void *fusion_sensor_t;
48 typedef int (*create_fusion_t)(fusion_sensor_t **sensors);
50 typedef void *observer_h;
57 virtual ~fusion_sensor() {}
59 inline uint32_t get_version(void) { return FUSION_SENSOR_VERSION(1, 0); }
61 virtual int get_sensors(const sensor_info2_t **sensors) = 0;
62 virtual void get_required_sensors(std::vector<std::string> &sensors) = 0;
64 /* if update() returns positive value, then get_data() is called */
65 virtual int update(const char *uri, sensor_data_t *data, int len) = 0;
66 virtual int get_data(sensor_data_t **data, int *len) = 0;
68 virtual int start(observer_h ob)
73 virtual int stop(observer_h ob)
78 virtual int set_interval(observer_h ob, int32_t &interval)
83 virtual int set_batch_latency(observer_h ob, int32_t &latency)
88 virtual int set_attribute(observer_h ob, int32_t attr, int32_t value)
93 virtual int set_attribute(observer_h ob, int32_t attr, const char *value, int len)
98 virtual int flush(observer_h ob)
104 #endif /* __FUSION_SENSOR_H__ */