2 * Copyright 2006 Free Software Foundation, Inc.
4 * This file is part of GNU Radio
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)
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.
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.
22 #ifndef INCLUDED_PAGER_FLEX_SYNC_H
23 #define INCLUDED_PAGER_FLEX_SYNC_H
27 class pager_flex_sync;
28 typedef boost::shared_ptr<pager_flex_sync> pager_flex_sync_sptr;
29 typedef std::vector<gr_int64> gr_int64_vector;
31 pager_flex_sync_sptr pager_make_flex_sync();
34 * \brief flex sync description
38 class pager_flex_sync : public gr_block
42 friend pager_flex_sync_sptr pager_make_flex_sync();
45 // State machine transitions
52 int index_avg(int start, int end);
53 bool test_sync(unsigned char sym);
55 int output_symbol(unsigned char sym);
57 // Simple state machine
58 enum state_t { ST_IDLE, ST_SYNCING, ST_SYNC1, ST_SYNC2, ST_DATA };
61 int d_index; // Index into current baud
62 int d_start; // Start of good sync
63 int d_center; // Center of bit
64 int d_end; // End of good sync
65 int d_count; // Bit counter
67 int d_mode; // Current packet mode
68 int d_baudrate; // Current decoding baud rate
69 int d_levels; // Current decoding levels
70 int d_spb; // Current samples per baud
71 bool d_hibit; // Alternating bit indicator for 3200 bps
73 gr_int32 d_fiw; // Frame information word
74 int d_frame; // Current FLEX frame
75 int d_cycle; // Current FLEX cycle
79 unsigned char d_bit_a;
80 unsigned char d_bit_b;
81 unsigned char d_bit_c;
82 unsigned char d_bit_d;
84 unsigned char *d_phase_a;
85 unsigned char *d_phase_b;
86 unsigned char *d_phase_c;
87 unsigned char *d_phase_d;
89 gr_int64_vector d_sync; // Trial synchronizers
92 void forecast(int noutput_items, gr_vector_int &inputs_required);
94 int general_work(int noutput_items,
95 gr_vector_int &ninput_items,
96 gr_vector_const_void_star &input_items,
97 gr_vector_void_star &output_items);
100 #endif /* INCLUDED_PAGER_FLEX_SYNC_H */