blob: 823bfdfc98b712c632800915f47c5ebd2aee252e [file] [log] [blame]
ptrkrysikf8c7e832015-04-04 12:28:20 +02001/* -*- c++ -*- */
2/*
3 * @file
4 * @author Piotr Krysik <ptrkrysik@gmail.com>
5 * @section LICENSE
6 *
7 * Gr-gsm is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * Gr-gsm is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with gr-gsm; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H
24#define INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H
25
26#include <grgsm/receiver/clock_offset_control.h>
27#include <string>
28#include <boost/asio.hpp>
29#include <boost/date_time/posix_time/posix_time.hpp>
30
31namespace gr {
32 namespace gsm {
33 class clock_offset_control_impl : public clock_offset_control
34 {
35 private:
36 float d_fc;
37 float d_alfa;
38 float d_ppm_estimate;
39 float d_last_ppm_estimate;
40 bool d_first_measurement;
41 int d_counter;
42 std::string d_last_state;
43 boost::asio::io_service d_io_service;
44 boost::asio::deadline_timer d_timer;
45
46 void process_measurement(pmt::pmt_t msg);
47 void timed_reset();
48 void reset();
49 public:
50 clock_offset_control_impl(float fc);
51 ~clock_offset_control_impl();
52
53 virtual void set_fc(float fc);
54 };
55 } // namespace gsm
56} // namespace gr
57
58#endif /* INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H */
59