2015-08-27 16:31:39 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* 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 2, 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; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2015-11-10 17:07:07 -05:00
|
|
|
#ifndef __PROC_AIS_H__
|
|
|
|
#define __PROC_AIS_H__
|
2015-08-27 16:31:39 -04:00
|
|
|
|
|
|
|
#include "baseband_processor.hpp"
|
|
|
|
|
|
|
|
#include "channel_decimator.hpp"
|
2015-09-28 14:02:39 -04:00
|
|
|
#include "matched_filter.hpp"
|
2015-08-27 16:31:39 -04:00
|
|
|
|
|
|
|
#include "clock_recovery.hpp"
|
2015-09-26 01:13:36 -04:00
|
|
|
#include "symbol_coding.hpp"
|
2015-08-27 16:31:39 -04:00
|
|
|
#include "packet_builder.hpp"
|
|
|
|
|
|
|
|
#include "message.hpp"
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <cstddef>
|
|
|
|
#include <bitset>
|
|
|
|
|
2015-11-10 17:04:50 -05:00
|
|
|
#include "ais_baseband.hpp"
|
|
|
|
|
2015-11-10 17:07:07 -05:00
|
|
|
class AISProcessor : public BasebandProcessor {
|
2015-08-27 16:31:39 -04:00
|
|
|
public:
|
2015-10-03 01:37:05 -04:00
|
|
|
using payload_t = std::bitset<1024>;
|
|
|
|
|
2015-08-27 16:31:39 -04:00
|
|
|
void execute(buffer_c8_t buffer) override;
|
|
|
|
|
|
|
|
private:
|
2015-11-10 17:04:50 -05:00
|
|
|
ChannelDecimator decimator { ChannelDecimator::DecimationFactor::By32 };
|
|
|
|
dsp::matched_filter::MatchedFilter mf { baseband::ais::rrc_taps_76k8_4t_p, 4 };
|
2015-08-27 16:31:39 -04:00
|
|
|
|
2015-10-03 01:32:58 -04:00
|
|
|
clock_recovery::ClockRecovery<clock_recovery::FixedErrorFilter> clock_recovery {
|
2015-11-10 17:04:50 -05:00
|
|
|
19200, 9600, { 0.0555f },
|
2015-09-26 01:13:36 -04:00
|
|
|
[this](const float symbol) { this->consume_symbol(symbol); }
|
|
|
|
};
|
|
|
|
symbol_coding::NRZIDecoder nrzi_decode;
|
2015-11-09 17:38:09 -05:00
|
|
|
PacketBuilder<BitPattern, BitPattern, BitPattern> packet_builder {
|
|
|
|
{ 0b0101010101111110, 16, 1 },
|
|
|
|
{ 0b111110, 6 },
|
|
|
|
{ 0b01111110, 8 },
|
|
|
|
[this](const payload_t& payload, const size_t bits_received) {
|
2015-09-28 15:46:44 -04:00
|
|
|
this->payload_handler(payload, bits_received);
|
|
|
|
}
|
|
|
|
};
|
2015-08-27 16:31:39 -04:00
|
|
|
|
2015-09-26 01:13:36 -04:00
|
|
|
void consume_symbol(const float symbol);
|
2015-10-03 01:37:05 -04:00
|
|
|
void payload_handler(const payload_t& payload, const size_t bits_received);
|
2015-08-27 16:31:39 -04:00
|
|
|
};
|
|
|
|
|
2015-11-10 17:07:07 -05:00
|
|
|
#endif/*__PROC_AIS_H__*/
|