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__
21 #include "step_detection.h"
22 #include "pedometer_info.h"
23 #include "pedometer_speed_filter.h"
25 /************************************************************************
26 * stores pedometer engine state.
33 /************************************************************************
34 * enables/disables savitzky filter.
36 void set_savitzky_filter(bool enable);
38 /************************************************************************
39 * resets {@link pedometer} object to initial state.
43 /************************************************************************
44 * called on new acceleration event.
47 * result of pedometer algorithm. valid only it method returns true.
49 * timestamp of acceleration event in ns.
51 * vertical component of global acceleration.
54 * true if new step event was detected.
56 bool get_pedometer(timestamp_t timestamp, double acc, pedometer_info *info);
59 /** detects step and estimates step length. */
60 step_detection m_step_detection;
62 /** sum of lengths all steps from start. */
63 double m_total_length;
65 /** number of steps from start. */
66 long long m_step_count;
68 /** estimates current speed from step length. */
69 pedometer_speed_filter m_pedometer_filter;
71 /** some non zero speed was detected. */
75 #endif /* __PEDOMETER_H__ */