GNU Radio's CCSDS Package
synchronizeCADUSoft_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_SYNCHRONIZECADUSOFT_IMPL_H
22 #define INCLUDED_CCSDS_SYNCHRONIZECADUSOFT_IMPL_H
23 
25 enum state{SEARCH, LOCK};
27 namespace gr {
28  namespace ccsds {
29 
31  {
32  private:
33  std::string d_sync;
34  int d_stl;
35  int d_lts;
36  int d_slip;
37  int d_frame_size;
38  int d_scramble;
39  int d_fec;
40  std::string d_tag_name;
41 
42  uint64_t d_access_code_0;
43  uint64_t d_access_code_1;
44  uint64_t d_access_code_2;
45  uint64_t d_access_code_3;
46  std::vector<uint64_t> d_wrong_bits;
47  std::vector<uint64_t> d_nwrong;
48 
49  unsigned long long d_access_code; // access code to locate start of packet
50  // access code is left justified in the word
51  unsigned long long d_data_reg; // used to look for access_code
52  unsigned long long d_mask; // masks access_code bits (top N bits are set where
53  // N is the number of bits in the access code)
54  unsigned int d_threshold; // how many bits may be wrong in sync vector
55  unsigned int d_len; // the length of the access code
56 
57  pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
58  const char* hex_char_to_bin(char c);
59  std::string hex_str_to_bin_str(const std::string& hex);
60  gr::thread::mutex d_mutex_access_code;
61 
62  uint64_t abs_out_sample_cnt_last;
63  uint64_t abs_out_sample_cnt_now;
64  uint64_t d_consec_sync;
65  uint64_t d_consec_loss;
66  int d_ambiguity;
67  state d_state;
68 
69  //Handling forward error correction
70  bool d_invert_g1, d_invert_g2;
71  std::string convEncode(std::string in, bool invG1, bool invG2, int code);
72 
73  public:
74  synchronizeCADUSoft_impl(std::string sync, int stl, int lts, int slip, int frame_size, int fec, int invCC, std::string tag_name);
76 
77  // Where all the action really happens
78  int work(int noutput_items,
79  gr_vector_const_void_star &input_items,
80  gr_vector_void_star &output_items);
81  bool set_access_code(const std::string &access_code);
82  };
83 
84  } // namespace ccsds
85 } // namespace gr
86 
87 #endif /* INCLUDED_CCSDS_SYNCHRONIZECADUSOFT_IMPL_H */
88 
cc
Definition: synchronizeCADUSoft_impl.h:26
Definition: synchronizeCADUSoft_impl.h:26
Definition: synchronizeCADUSoft_impl.h:25
bool set_access_code(const std::string &access_code)
synchronizeCADUSoft_impl(std::string sync, int stl, int lts, int slip, int frame_size, int fec, int invCC, std::string tag_name)
state
Definition: synchronizeCADUHard_impl.h:25
Definition: synchronizeCADUSoft_impl.h:26
Definition: cc_depuncture.h:28
Definition: synchronizeCADUSoft_impl.h:30
Definition: synchronizeCADUSoft_impl.h:26
Definition: synchronizeCADUSoft_impl.h:25
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
<+description of block+>
Definition: synchronizeCADUSoft.h:36
Definition: synchronizeCADUSoft_impl.h:26
Definition: synchronizeCADUSoft_impl.h:26