blob: cc0ea3d6ff87fd48e137d6edb83bf91885634b67 [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>
ptrkrysikf8c7e832015-04-04 12:28:20 +020028
29namespace gr {
30 namespace gsm {
31 class clock_offset_control_impl : public clock_offset_control
32 {
33 private:
34 float d_fc;
Piotr Krysik09826732016-07-15 13:14:24 +020035 float d_samp_rate;
ptrkrysikf8c7e832015-04-04 12:28:20 +020036 float d_alfa;
37 float d_ppm_estimate;
Piotr Krysik09826732016-07-15 13:14:24 +020038 float d_last_ppm_estimate;
ptrkrysikf8c7e832015-04-04 12:28:20 +020039 bool d_first_measurement;
40 int d_counter;
41 std::string d_last_state;
ptrkrysik32c21162015-04-04 14:01:52 +020042 float d_current_time;
43 float d_last_fcch_time;
44 bool d_first_time;
ptrkrysikf8c7e832015-04-04 12:28:20 +020045
46 void process_measurement(pmt::pmt_t msg);
Piotr Krysik09826732016-07-15 13:14:24 +020047 void send_ctrl_messages(float ppm);
ptrkrysikf8c7e832015-04-04 12:28:20 +020048 void timed_reset();
49 void reset();
50 public:
Piotr Krysik09826732016-07-15 13:14:24 +020051 clock_offset_control_impl(float fc, float samp_rate);
ptrkrysikf8c7e832015-04-04 12:28:20 +020052 ~clock_offset_control_impl();
53
54 virtual void set_fc(float fc);
Piotr Krysik09826732016-07-15 13:14:24 +020055 virtual void set_samp_rate(float samp_rate);
ptrkrysikf8c7e832015-04-04 12:28:20 +020056 };
57 } // namespace gsm
58} // namespace gr
59
60#endif /* INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H */
61