1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/* -*- c++ -*- */
/*
* Copyright 2006,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_PAGER_FLEX_SYNC_IMPL_H
#define INCLUDED_PAGER_FLEX_SYNC_IMPL_H
#include <gnuradio/pager/flex_sync.h>
namespace gr {
namespace pager {
class flex_sync_impl : public flex_sync
{
private:
// State machine transitions
void enter_idle();
void enter_syncing();
void enter_sync1();
void enter_sync2();
void enter_data();
int index_avg(int start, int end);
bool test_sync(unsigned char sym);
void parse_fiw();
int output_symbol(unsigned char sym);
// Simple state machine
enum state_t { ST_IDLE, ST_SYNCING, ST_SYNC1, ST_SYNC2, ST_DATA };
state_t d_state;
int d_index; // Index into current baud
int d_start; // Start of good sync
int d_center; // Center of bit
int d_end; // End of good sync
int d_count; // Bit counter
int d_mode; // Current packet mode
int d_baudrate; // Current decoding baud rate
int d_levels; // Current decoding levels
int d_spb; // Current samples per baud
bool d_hibit; // Alternating bit indicator for 3200 bps
int d_fiw; // Frame information word
int d_frame; // Current FLEX frame
int d_cycle; // Current FLEX cycle
int d_unknown1;
int d_unknown2;
unsigned char d_bit_a;
unsigned char d_bit_b;
unsigned char d_bit_c;
unsigned char d_bit_d;
unsigned char *d_phase_a;
unsigned char *d_phase_b;
unsigned char *d_phase_c;
unsigned char *d_phase_d;
std::vector<int64_t> d_sync; // Trial synchronizers
public:
flex_sync_impl();
~flex_sync_impl();
void forecast(int noutput_items, gr_vector_int &inputs_required);
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} /* namespace pager */
} /* namespace gr */
#endif /* INCLUDED_PAGER_FLEX_SYNC_IMPL_H */
|