GNU Radio's DECT2 Package
packet_decoder_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Pavel Yazev <pyazev@gmail.com>
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_DECT2_PACKET_DECODER_IMPL_H
22 #define INCLUDED_DECT2_PACKET_DECODER_IMPL_H
23 
24 #include <dect2/packet_decoder.h>
25 
26 #define MAX_PARTS 8
27 #define A_FIELD_BITS 64
28 #define B_FIELD_BITS 320
29 
30 
31 namespace gr {
32  namespace dect2 {
33 
35  {
36 
37  private:
38  typedef enum {_RFP_, _PP_} part_type;
39 
40  typedef struct part_descriptor_item
41  {
42  bool active;
43  bool voice_present;
44  bool log_update;
45  bool part_id_rcvd;
46  bool qt_rcvd;
47 
48  bool rpf_fn_cor; // set true if frame number was corrected from RFP part
49 
50  uint8_t frame_number;
51  uint64_t rx_seq;
52  uint8_t part_id[5];
53  part_type type;
54 
55  uint64_t packet_cnt;
56  uint64_t afield_bad_crc_cnt;
57 
58  struct part_descriptor_item *pair;
59  } part_descriptor_item;
60 
61  part_descriptor_item d_part_descriptor[MAX_PARTS];
62  part_descriptor_item *d_cur_part;
63  uint32_t d_selected_rx_id;
64 
65 
66  uint32_t decode_afield(uint8_t *field_data);
67 
68  int calculate_output_stream_length(const gr_vector_int &ninput_items);
69  void msg_event_handler(pmt::pmt_t msg);
70 
71  void print_parts(void);
72 
73  public:
74 
77 
78  virtual void select_rx_part(uint32_t rx_id);
79 
80  int work(int noutput_items,
81  gr_vector_int &ninput_items,
82  gr_vector_const_void_star &input_items,
83  gr_vector_void_star &output_items);
84  };
85 
86  } // namespace dect2
87 } // namespace gr
88 
89 #endif /* INCLUDED_DECT2_PACKET_DECODER_IMPL_H */
90 
int work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
#define MAX_PARTS
Definition: packet_decoder_impl.h:26
Definition: packet_decoder.h:28
<+description of block+>
Definition: packet_decoder.h:36
virtual void select_rx_part(uint32_t rx_id)
Definition: packet_decoder_impl.h:34