sensord: enable samsung pedometer sensor for fused location
[platform/core/system/sensord.git] / src / sensor / pedometer / average_filter.h
1 /*
2  *  Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
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 #ifndef __AVERAGE_FILTER_H__
18 #define __AVERAGE_FILTER_H__
19
20 #include <memory>
21 #include "common.h"
22
23 class average_filter {
24 public:
25         average_filter(int size);
26         ~average_filter();
27
28         /************************************************************************
29          * Filters input data.
30          */
31         double filter(double value);
32
33         /************************************************************************
34          * Resets average filter to initial state.
35          */
36         void reset(void);
37
38 private:
39         /************************************************************************
40          * Average filter state.
41          */
42         double *m_array;
43         int m_size;
44         int m_index;
45         bool m_ready;
46 };
47
48 #endif /* __AVERAGE_FILTER_H__ */