GNU Radio's CCSDS Package
synchronizeCADUHard_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 <+YOU OR YOUR COMPANY+>.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_CCSDS_SYNCHRONIZECADUHARD_IMPL_H
22 #define INCLUDED_CCSDS_SYNCHRONIZECADUHARD_IMPL_H
23 
25 enum state{SEARCH, LOCK};
26 namespace gr {
27  namespace ccsds {
28 
30  {
31  private:
32  std::string d_sync;
33  int d_stl;
34  int d_lts;
35  int d_tin;
36  int d_ambiguity;
37  int d_frame_size;
38  bool d_verbose;
39  uint64_t d_access_code_0;
40  uint64_t d_access_code_1;
41  uint64_t d_access_code_2;
42  uint64_t d_access_code_3;
43  std::vector<uint64_t> d_wrong_bits;
44  std::vector<uint64_t> d_nwrong;
45  uint64_t d_data_reg; // used to look for access_code
46  uint64_t d_mask; // masks access_code bits (top N bits are set where
47  // N is the number of bits in the access code)
48  unsigned int d_threshold; // how many bits may be wrong in sync vector
49  unsigned int d_len; // the length of the access code
50 
51  pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
52  const char* hex_char_to_bin(char c);
53  std::string hex_str_to_bin_str(const std::string& hex);
54  void add_tag(int id, uint64_t pos, pmt::pmt_t key);
55  bool set_access_code(const std::string &access_code);
56 
57  uint64_t abs_out_sample_cnt_last;
58  uint64_t abs_out_sample_cnt_now;
59  uint64_t d_consec_sync;
60  uint64_t d_consec_loss;
61  state d_state;
62  public:
63  synchronizeCADUHard_impl(std::string sync, int stl, int lts, int tin, int ambiguity, int frame_size, int verbose);
65 
66  // Where all the action really happens
67  int work(int noutput_items,
68  gr_vector_const_void_star &input_items,
69  gr_vector_void_star &output_items);
70  };
71 
72  } // namespace ccsds
73 } // namespace gr
74 
75 #endif /* INCLUDED_CCSDS_SYNCHRONIZECADUHARD_IMPL_H */
76 
state
Definition: synchronizeCADUHard_impl.h:25
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: synchronizeCADUHard_impl.h:29
synchronizeCADUHard_impl(std::string sync, int stl, int lts, int tin, int ambiguity, int frame_size, int verbose)
Definition: cc_depuncture.h:28
Definition: synchronizeCADUHard_impl.h:25
Definition: synchronizeCADUHard_impl.h:25
<+description of block+>
Definition: synchronizeCADUHard.h:36