1 /* -*- c++ -*- */
2 /* Copyright 2016 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 
26 #include <gnuradio/digital/header_format_base.h>
27 #include <gnuradio/math.h>
28 #include <string.h>
29 #include <volk/volk.h>
30 #include <iostream>
31 
32 namespace gr {
33 namespace digital {
34 
header_format_base()35 header_format_base::header_format_base()
36 {
37     enter_search();
38     configure_default_loggers(d_logger, d_debug_logger, "packet formatter");
39 }
40 
~header_format_base()41 header_format_base::~header_format_base() {}
42 
header_nbytes() const43 size_t header_format_base::header_nbytes() const { return header_nbits() / 8; }
44 
enter_search()45 inline void header_format_base::enter_search() { d_state = STATE_SYNC_SEARCH; }
46 
enter_have_sync()47 inline void header_format_base::enter_have_sync() { d_state = STATE_HAVE_SYNC; }
48 
enter_have_header(int payload_len)49 inline void header_format_base::enter_have_header(int payload_len)
50 {
51     d_state = STATE_SYNC_SEARCH;
52 }
53 
54 } /* namespace digital */
55 } /* namespace gr */
56