GNU Radio 3.6.5 C++ API

pager_flex_sync.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2006 Free Software Foundation, Inc.
00003  *
00004  * This file is part of GNU Radio
00005  *
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  *
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_PAGER_FLEX_SYNC_H
00023 #define INCLUDED_PAGER_FLEX_SYNC_H
00024 
00025 #include <pager_api.h>
00026 #include <gr_block.h>
00027 
00028 class pager_flex_sync;
00029 typedef boost::shared_ptr<pager_flex_sync> pager_flex_sync_sptr;
00030 typedef std::vector<gr_int64> gr_int64_vector;
00031 
00032 PAGER_API pager_flex_sync_sptr pager_make_flex_sync();
00033 
00034 /*!
00035  * \brief flex sync description
00036  * \ingroup pager_blk
00037  */
00038 class PAGER_API pager_flex_sync : public gr_block
00039 {
00040 private:
00041     // Constructors
00042     friend PAGER_API pager_flex_sync_sptr pager_make_flex_sync();
00043     pager_flex_sync();
00044 
00045     // State machine transitions
00046     void enter_idle();
00047     void enter_syncing();
00048     void enter_sync1();
00049     void enter_sync2();
00050     void enter_data();
00051 
00052     int index_avg(int start, int end);
00053     bool test_sync(unsigned char sym);
00054     void parse_fiw();
00055     int output_symbol(unsigned char sym);
00056 
00057     // Simple state machine
00058     enum state_t { ST_IDLE, ST_SYNCING, ST_SYNC1, ST_SYNC2, ST_DATA };
00059     state_t d_state;
00060 
00061     int d_index;    // Index into current baud
00062     int d_start;    // Start of good sync
00063     int d_center;   // Center of bit
00064     int d_end;      // End of good sync
00065     int d_count;    // Bit counter
00066 
00067     int d_mode;     // Current packet mode
00068     int d_baudrate; // Current decoding baud rate
00069     int d_levels;   // Current decoding levels
00070     int d_spb;      // Current samples per baud
00071     bool d_hibit;   // Alternating bit indicator for 3200 bps
00072 
00073     gr_int32 d_fiw; // Frame information word
00074     int d_frame;    // Current FLEX frame
00075     int d_cycle;    // Current FLEX cycle
00076     int d_unknown1;
00077     int d_unknown2;
00078 
00079     unsigned char d_bit_a;
00080     unsigned char d_bit_b;
00081     unsigned char d_bit_c;
00082     unsigned char d_bit_d;
00083 
00084     unsigned char *d_phase_a;
00085     unsigned char *d_phase_b;
00086     unsigned char *d_phase_c;
00087     unsigned char *d_phase_d;
00088 
00089     gr_int64_vector d_sync; // Trial synchronizers
00090 
00091 public:
00092     void forecast(int noutput_items, gr_vector_int &inputs_required);
00093 
00094     int general_work(int noutput_items,
00095                      gr_vector_int &ninput_items,
00096                      gr_vector_const_void_star &input_items,
00097                      gr_vector_void_star &output_items);
00098 };
00099 
00100 #endif /* INCLUDED_PAGER_FLEX_SYNC_H */