2 * Copyright (c) 2016-2017 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.
17 #ifndef __PEDOMETER_H__
18 #define __PEDOMETER_H__
20 #include "step_detection.h"
21 #include "pedometer_info.h"
22 #include "pedometer_speed_filter.h"
23 #include "sensor_frequency_compensator.h"
24 #include "timestamp.h"
26 /************************************************************************
27 * stores pedometer engine state.
34 /************************************************************************
35 * enables/disables Savitzky filter.
37 void set_savitzky_filter(bool enable);
39 /************************************************************************
40 * resets {@link pedometer} object to initial state.
44 /************************************************************************
45 * called on new acceleration event.
48 * result of pedometer algorithm. valid only it method returns true.
50 * timestamp of acceleration event in [ns].
52 * global acceleration vector in [m/s^2].
55 * true if new step event was detected.
57 bool new_acceleration(pedometer_info *info, timestamp_t timestamp, double acc[]);
60 /** detects step and estimates step length. */
61 step_detection m_step_detection;
63 /** sum of lengths all steps from start in [m]. */
64 double m_total_length;
66 /** number of steps from start. */
67 long long m_step_count;
69 /** estimates current speed from step length. */
70 pedometer_speed_filter m_pedometer_filter;
72 /** some non zero speed was detected. */
75 sensor_frequency_compensator m_acceleration_compensator;
78 #endif /* __PEDOMETER_H__ */