1479023a5abbc04652bba6d3dcb961d33c5ba088
[platform/core/system/sensord.git] / src / sensor / rotation_vector / fusion_base.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19 #ifndef __FUSION_BASE_H__
20 #define __FUSION_BASE_H__
21
22 #include <fusion.h>
23 #include <orientation_filter.h>
24
25 class fusion_base : public virtual fusion {
26 public:
27         fusion_base();
28         virtual ~fusion_base();
29
30         virtual void push_accel(sensor_data_t &data);
31         virtual void push_gyro(sensor_data_t &data);
32         virtual void push_mag(sensor_data_t &data);
33         virtual bool get_rv(unsigned long long &timestamp, float &w, float &x, float &y, float &z);
34
35 protected:
36
37         sensor_data<float> m_accel;
38         sensor_data<float> m_gyro;
39         sensor_data<float> m_magnetic;
40
41         orientation_filter<float> m_orientation_filter;
42
43         bool m_enable_accel;
44         bool m_enable_gyro;
45         bool m_enable_magnetic;
46
47         float m_x;
48         float m_y;
49         float m_z;
50         float m_w;
51         float m_timestamp;
52
53         void clear();
54         void store_orientation(void);
55         virtual bool get_orientation(void) = 0;
56 };
57
58
59
60 #endif /* __FUSION_BASE_H__ */