2016-04-02 22:02:38 +02:00
|
|
|
/* -*- c++ -*- */
|
|
|
|
/*
|
|
|
|
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
|
|
|
|
*
|
|
|
|
* This program 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 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_SATNOGS_UPSAT_FSK_FRAME_ACQUISITION_IMPL_H
|
|
|
|
#define INCLUDED_SATNOGS_UPSAT_FSK_FRAME_ACQUISITION_IMPL_H
|
|
|
|
|
2016-04-03 23:29:28 +02:00
|
|
|
#include <satnogs/config.h>
|
2016-04-02 22:02:38 +02:00
|
|
|
#include <satnogs/upsat_fsk_frame_acquisition.h>
|
2016-04-11 20:26:57 +02:00
|
|
|
#include <satnogs/whitening.h>
|
2016-04-02 22:02:38 +02:00
|
|
|
|
|
|
|
namespace gr
|
|
|
|
{
|
|
|
|
namespace satnogs
|
|
|
|
{
|
|
|
|
|
|
|
|
class upsat_fsk_frame_acquisition_impl : public upsat_fsk_frame_acquisition
|
|
|
|
{
|
|
|
|
private:
|
2016-04-03 23:29:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decoding FSM
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SEARCHING, //!< SEARCHING when searching for the start of the preamble
|
|
|
|
HAVE_PREAMBLE, //!< HAVE_PREAMBLE when the decoder is inside the preamble
|
2016-04-07 18:49:41 +02:00
|
|
|
SEARCHING_SYNC_WORD,
|
2016-04-03 23:29:28 +02:00
|
|
|
HAVE_SYNC_WORD, //!< HAVE_SYNC_WORD when the decoder is inside the sync word
|
|
|
|
HAVE_FRAME_LEN, //!< HAVE_FRAME_LEN when the decoder is inside the frame length field
|
|
|
|
HAVE_PAYLOAD //!< HAVE_PAYLOAD when the decoder process the palyload of the frame
|
|
|
|
} decoding_state_t;
|
|
|
|
|
|
|
|
const std::vector<uint8_t> d_preamble;
|
|
|
|
const size_t d_preamble_len;
|
|
|
|
const std::vector<uint8_t> d_sync_word;
|
|
|
|
const size_t d_sync_word_len;
|
2016-04-07 18:49:41 +02:00
|
|
|
const size_t d_search_for_sync_thrhld;
|
2016-04-08 20:41:21 +02:00
|
|
|
const bool d_whitening;
|
|
|
|
const bool d_manchester;
|
|
|
|
const bool d_check_crc;
|
2016-04-26 21:21:42 +02:00
|
|
|
const bool d_is_ax25;
|
2016-04-03 23:29:28 +02:00
|
|
|
decoding_state_t d_state;
|
|
|
|
uint8_t d_shifting_byte;
|
|
|
|
size_t d_decoded_bytes;
|
2016-04-05 20:29:23 +02:00
|
|
|
size_t d_decoded_bits;
|
2016-04-03 23:29:28 +02:00
|
|
|
size_t d_frame_len;
|
2016-04-11 20:26:57 +02:00
|
|
|
whitening d_descrambler;
|
2016-04-03 23:29:28 +02:00
|
|
|
uint8_t *d_pdu;
|
2016-04-29 20:43:09 +02:00
|
|
|
uint8_t *d_ax25_tmp_buf;
|
|
|
|
uint8_t *d_ax25_buf;
|
2016-04-03 23:29:28 +02:00
|
|
|
|
|
|
|
inline void
|
|
|
|
slice_and_shift (float in);
|
|
|
|
|
|
|
|
inline void
|
|
|
|
reset_state ();
|
|
|
|
inline void
|
|
|
|
have_preamble ();
|
|
|
|
inline void
|
2016-04-07 18:49:41 +02:00
|
|
|
searching_sync_word ();
|
|
|
|
inline void
|
2016-04-03 23:29:28 +02:00
|
|
|
have_sync ();
|
|
|
|
inline void
|
|
|
|
have_frame_len ();
|
|
|
|
inline void
|
|
|
|
have_payload ();
|
2016-04-29 20:43:09 +02:00
|
|
|
inline void
|
|
|
|
unpack_ax25_bytes(size_t len_bytes);
|
2016-04-02 22:02:38 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
upsat_fsk_frame_acquisition_impl (const std::vector<uint8_t> &preamble,
|
|
|
|
const std::vector<uint8_t> &sync_word,
|
2016-04-08 20:41:21 +02:00
|
|
|
bool whitening, bool manchester,
|
2016-04-26 21:21:42 +02:00
|
|
|
bool check_crc,
|
|
|
|
bool ax25_format);
|
2016-04-02 22:02:38 +02:00
|
|
|
~upsat_fsk_frame_acquisition_impl ();
|
|
|
|
|
|
|
|
// Where all the action really happens
|
|
|
|
int
|
|
|
|
work (int noutput_items, gr_vector_const_void_star &input_items,
|
|
|
|
gr_vector_void_star &output_items);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace satnogs
|
|
|
|
} // namespace gr
|
|
|
|
|
|
|
|
#endif /* INCLUDED_SATNOGS_UPSAT_FSK_FRAME_ACQUISITION_IMPL_H */
|
|
|
|
|