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 __STEP_DETECTION_H__
18 #define __STEP_DETECTION_H__
20 #include "average_filter.h"
21 #include "zero_crossing_step_detection.h"
22 #include "savitzky_golay_filter15.h"
23 #include "step_event.h"
26 /************************************************************************
27 * step detection engine state.
29 class step_detection {
34 /************************************************************************
36 void set_peak_threshold(double threshold);
38 /************************************************************************
40 void set_use_savitzky(bool use_savitzky);
42 /************************************************************************
44 bool is_slow_step(void);
46 /************************************************************************
48 bool add_acc_sensor_values_average(
49 timestamp_t timestamp, double acc, step_event* step);
51 /************************************************************************
53 bool add_acc_sensor_values_savitzky(
54 timestamp_t timestamp, double acc, step_event* step);
56 /************************************************************************
58 bool get_step(timestamp_t timestamp, double acc, step_event* step);
60 /************************************************************************
61 * resets step_detection object to initial state.
66 average_filter m_average_filter;
67 average_filter m_average_gfilter;
68 zero_crossing_step_detection m_zero_crossing_up;
69 zero_crossing_step_detection m_zero_crossing_down;
71 savitzky_golay_filter15 m_zc_filter;
72 double m_peak_threshold;
74 timestamp_t m_last_step_timestamp;
75 bool m_zero_crossing_up_detected;
76 bool m_zero_crossing_down_detected;
77 double m_minimum_acceleration;
78 double m_maximum_acceleration;
79 bool m_is_slow_step_detected;
82 #endif /* __STEP_DETECTION_H__ */