mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Rename mobilinkd namespace to modemm17
This commit is contained in:
parent
242a5843d8
commit
1fa3adb669
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <uint16_t Poly = 0x5935, uint16_t Init = 0xFFFF>
|
template <uint16_t Poly = 0x5935, uint16_t Init = 0xFFFF>
|
||||||
@ -48,7 +48,7 @@ struct CRC16
|
|||||||
}
|
}
|
||||||
return reg & MASK;
|
return reg & MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t get()
|
uint16_t get()
|
||||||
{
|
{
|
||||||
auto reg = reg_;
|
auto reg = reg_;
|
||||||
@ -60,7 +60,7 @@ struct CRC16
|
|||||||
}
|
}
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<uint8_t, 2> get_bytes()
|
std::array<uint8_t, 2> get_bytes()
|
||||||
{
|
{
|
||||||
auto crc = get();
|
auto crc = get();
|
||||||
@ -69,4 +69,4 @@ struct CRC16
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
struct CarrierDetect
|
struct CarrierDetect
|
||||||
@ -37,4 +37,4 @@ struct CarrierDetect
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 Mobilinkd LLC.
|
// Copyright 2021 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,4 +239,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
inline constexpr uint32_t convolve_bit(uint32_t poly, uint32_t memory)
|
inline constexpr uint32_t convolve_bit(uint32_t poly, uint32_t memory)
|
||||||
@ -23,4 +23,4 @@ inline constexpr uint32_t update_memory(uint32_t memory, uint32_t input)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "Correlator.h"
|
#include "Correlator.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
// IIR with Nyquist of 1/240.
|
// IIR with Nyquist of 1/240.
|
||||||
const std::array<float,3> Correlator::b = {4.24433681e-05, 8.48867363e-05, 4.24433681e-05};
|
const std::array<float,3> Correlator::b = {4.24433681e-05, 8.48867363e-05, 4.24433681e-05};
|
||||||
const std::array<float,3> Correlator::a = {1.0, -1.98148851, 0.98165828};
|
const std::array<float,3> Correlator::a = {1.0, -1.98148851, 0.98165828};
|
||||||
|
|
||||||
} // namespace mobilinkd
|
} // namespace modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 Rob Riggs <rob@mobilinkd.com>
|
// Copyright 2021 Rob Riggs <rob@modemm17.com>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
struct M17_API Correlator
|
struct M17_API Correlator
|
||||||
{
|
{
|
||||||
@ -205,4 +205,4 @@ struct SyncWord
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 Mobilinkd LLC.
|
// Copyright 2021 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include <complex>
|
#include <complex>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data carrier detection using the difference of two DFTs, one in-band and
|
* Data carrier detection using the difference of two DFTs, one in-band and
|
||||||
@ -73,4 +73,4 @@ struct DataCarrierDetect
|
|||||||
bool dcd() const { return triggered_; }
|
bool dcd() const { return triggered_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t N = 10>
|
template <size_t N = 10>
|
||||||
@ -92,4 +92,4 @@ struct DeviationError
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// Copyright 2015-2021 Mobilinkd LLC.
|
// Copyright 2015-2021 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename NumericType>
|
template <typename NumericType>
|
||||||
@ -11,4 +11,4 @@ struct FilterBase
|
|||||||
virtual NumericType operator()(NumericType input) = 0;
|
virtual NumericType operator()(NumericType input) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2015-2020 Mobilinkd LLC.
|
// Copyright 2015-2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
@ -56,4 +56,4 @@ BaseFirFilter<N> makeFirFilter(const std::array<float, N>& taps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "FreqDevEstimator.h"
|
#include "FreqDevEstimator.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
const std::array<float, 3> FreqDevEstimator::dc_b = { 0.09763107, 0.19526215, 0.09763107 };
|
const std::array<float, 3> FreqDevEstimator::dc_b = { 0.09763107, 0.19526215, 0.09763107 };
|
||||||
const std::array<float, 3> FreqDevEstimator::dc_a = { 1. , -0.94280904, 0.33333333 };
|
const std::array<float, 3> FreqDevEstimator::dc_a = { 1. , -0.94280904, 0.33333333 };
|
||||||
|
|
||||||
} // namespace mobilinkd
|
} // namespace modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 Rob Riggs <rob@mobilinkd.com>
|
// Copyright 2021 Rob Riggs <rob@modemm17.com>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deviation and zero-offset estimator.
|
* Deviation and zero-offset estimator.
|
||||||
@ -127,4 +127,4 @@ public:
|
|||||||
float idev() const { return idev_; }
|
float idev() const { return idev_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t N = 32>
|
template <size_t N = 32>
|
||||||
@ -63,4 +63,4 @@ struct FrequencyError
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@ -153,4 +153,4 @@ struct Fsk4Demod
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "Golay24.h"
|
#include "Golay24.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
std::array<Golay24::SyndromeMapEntry, Golay24::LUT_SIZE> Golay24::LUT = Golay24::make_lut();
|
std::array<Golay24::SyndromeMapEntry, Golay24::LUT_SIZE> Golay24::LUT = Golay24::make_lut();
|
||||||
|
|
||||||
@ -134,4 +134,4 @@ std::array<Golay24::SyndromeMapEntry, Golay24::LUT_SIZE> Golay24::make_lut()
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Rob Riggs <rob@mobilinkd.com>
|
// Copyright 2020 Rob Riggs <rob@modemm17.com>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
// Parts are adapted from:
|
// Parts are adapted from:
|
||||||
// http://aqdi.com/articles/using-the-golay-error-detection-and-correction-code-3/
|
// http://aqdi.com/articles/using-the-golay-error-detection-and-correction-code-3/
|
||||||
@ -108,4 +108,4 @@ private:
|
|||||||
static std::array<SyndromeMapEntry, LUT_SIZE> make_lut();
|
static std::array<SyndromeMapEntry, LUT_SIZE> make_lut();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2015-2021 Mobilinkd LLC.
|
// Copyright 2015-2021 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
@ -49,4 +49,4 @@ BaseIirFilter<N> makeIirFilter(
|
|||||||
return std::move(BaseIirFilter<N>(b, a));
|
return std::move(BaseIirFilter<N>(b, a));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
struct LinkSetupFrame
|
struct LinkSetupFrame
|
||||||
@ -128,4 +128,4 @@ struct LinkSetupFrame
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "M17Demodulator.h"
|
#include "M17Demodulator.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
// const std::array<float, 150> M17Demodulator::rrc_taps = std::array<float, 150>{
|
// const std::array<float, 150> M17Demodulator::rrc_taps = std::array<float, 150>{
|
||||||
// 0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247,
|
// 0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247,
|
||||||
@ -587,4 +587,4 @@ void M17Demodulator::operator()(const float input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020-2021 Rob Riggs <rob@mobilinkd.com>
|
// Copyright 2020-2021 Rob Riggs <rob@modemm17.com>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
struct M17_API M17Demodulator
|
struct M17_API M17Demodulator
|
||||||
{
|
{
|
||||||
@ -121,4 +121,4 @@ private:
|
|||||||
int16_t initializing_count_;
|
int16_t initializing_count_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 Mobilinkd LLC.
|
// Copyright 2021 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -403,4 +403,4 @@ struct M17FrameDecoder
|
|||||||
State state() const { return state_; }
|
State state() const { return state_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t N = 368>
|
template <size_t N = 368>
|
||||||
@ -51,12 +51,12 @@ struct M17Framer
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
buffer_.fill(0);
|
buffer_.fill(0);
|
||||||
index_ = 0;
|
index_ = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "M17Modulator.h"
|
#include "M17Modulator.h"
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -108,5 +108,5 @@ const std::array<float, 150> M17Modulator::rrc_taps = std::array<float, 150>{
|
|||||||
+2.729505e-03, +2.987740e-03, +2.576674e-03, +1.628891e-03, +3.898184e-04,
|
+2.729505e-03, +2.987740e-03, +2.576674e-03, +1.628891e-03, +3.898184e-04,
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mobilinkd
|
} // namespace modemm17
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,18 +119,18 @@ public:
|
|||||||
PolynomialInterleaver<45, 92, 368> interleaver;
|
PolynomialInterleaver<45, 92, 368> interleaver;
|
||||||
CRC16<0x5935, 0xFFFF> crc;
|
CRC16<0x5935, 0xFFFF> crc;
|
||||||
|
|
||||||
mobilinkd::LinkSetupFrame::call_t callsign;
|
modemm17::LinkSetupFrame::call_t callsign;
|
||||||
callsign.fill(0);
|
callsign.fill(0);
|
||||||
std::copy(src.begin(), src.end(), callsign.begin());
|
std::copy(src.begin(), src.end(), callsign.begin());
|
||||||
auto encoded_src = mobilinkd::LinkSetupFrame::encode_callsign(callsign);
|
auto encoded_src = modemm17::LinkSetupFrame::encode_callsign(callsign);
|
||||||
|
|
||||||
mobilinkd::LinkSetupFrame::encoded_call_t encoded_dest = {0xff,0xff,0xff,0xff,0xff,0xff};
|
modemm17::LinkSetupFrame::encoded_call_t encoded_dest = {0xff,0xff,0xff,0xff,0xff,0xff};
|
||||||
|
|
||||||
if (!dest.empty())
|
if (!dest.empty())
|
||||||
{
|
{
|
||||||
callsign.fill(0);
|
callsign.fill(0);
|
||||||
std::copy(dest.begin(), dest.end(), callsign.begin());
|
std::copy(dest.begin(), dest.end(), callsign.begin());
|
||||||
encoded_dest = mobilinkd::LinkSetupFrame::encode_callsign(callsign);
|
encoded_dest = modemm17::LinkSetupFrame::encode_callsign(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto rit = std::copy(encoded_dest.begin(), encoded_dest.end(), lsf.begin());
|
auto rit = std::copy(encoded_dest.begin(), encoded_dest.end(), lsf.begin());
|
||||||
@ -159,25 +159,25 @@ public:
|
|||||||
{
|
{
|
||||||
uint32_t x = (b & 0x80) >> 7;
|
uint32_t x = (b & 0x80) >> 7;
|
||||||
b <<= 1;
|
b <<= 1;
|
||||||
memory = mobilinkd::update_memory<4>(memory, x);
|
memory = modemm17::update_memory<4>(memory, x);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the encoder.
|
// Flush the encoder.
|
||||||
for (size_t i = 0; i != 4; ++i)
|
for (size_t i = 0; i != 4; ++i)
|
||||||
{
|
{
|
||||||
memory = mobilinkd::update_memory<4>(memory, 0);
|
memory = modemm17::update_memory<4>(memory, 0);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<int8_t, 368> punctured;
|
std::array<int8_t, 368> punctured;
|
||||||
auto size = puncture(encoded, punctured, P1);
|
auto size = puncture(encoded, punctured, P1);
|
||||||
|
|
||||||
if (size != 368) {
|
if (size != 368) {
|
||||||
std::cerr << "mobilinkd::M17Modulator::make_lsf: incorrect size (not 368)" << size;
|
std::cerr << "modemm17::M17Modulator::make_lsf: incorrect size (not 368)" << size;
|
||||||
}
|
}
|
||||||
|
|
||||||
interleaver.interleave(punctured);
|
interleaver.interleave(punctured);
|
||||||
@ -196,7 +196,7 @@ public:
|
|||||||
tmp <<= 4;
|
tmp <<= 4;
|
||||||
tmp |= ((segment[1] >> 4) & 0x0F);
|
tmp |= ((segment[1] >> 4) & 0x0F);
|
||||||
// tmp = segment[0] << 4 | ((segment[1] >> 4) & 0x0F);
|
// tmp = segment[0] << 4 | ((segment[1] >> 4) & 0x0F);
|
||||||
encoded = mobilinkd::Golay24::encode24(tmp);
|
encoded = modemm17::Golay24::encode24(tmp);
|
||||||
|
|
||||||
for (size_t i = 0; i != 24; ++i)
|
for (size_t i = 0; i != 24; ++i)
|
||||||
{
|
{
|
||||||
@ -208,7 +208,7 @@ public:
|
|||||||
tmp <<= 8;
|
tmp <<= 8;
|
||||||
tmp |= segment[2];
|
tmp |= segment[2];
|
||||||
// tmp = ((segment[1] & 0x0F) << 8) | segment[2];
|
// tmp = ((segment[1] & 0x0F) << 8) | segment[2];
|
||||||
encoded = mobilinkd::Golay24::encode24(tmp);
|
encoded = modemm17::Golay24::encode24(tmp);
|
||||||
|
|
||||||
for (size_t i = 24; i != 48; ++i)
|
for (size_t i = 24; i != 48; ++i)
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ public:
|
|||||||
tmp <<= 4;
|
tmp <<= 4;
|
||||||
tmp |= ((segment[4] >> 4) & 0x0F);
|
tmp |= ((segment[4] >> 4) & 0x0F);
|
||||||
// tmp = segment[3] << 4 | ((segment[4] >> 4) & 0x0F);
|
// tmp = segment[3] << 4 | ((segment[4] >> 4) & 0x0F);
|
||||||
encoded = mobilinkd::Golay24::encode24(tmp);
|
encoded = modemm17::Golay24::encode24(tmp);
|
||||||
|
|
||||||
for (size_t i = 48; i != 72; ++i)
|
for (size_t i = 48; i != 72; ++i)
|
||||||
{
|
{
|
||||||
@ -232,7 +232,7 @@ public:
|
|||||||
tmp <<= 8;
|
tmp <<= 8;
|
||||||
tmp |= (segment_number << 5);
|
tmp |= (segment_number << 5);
|
||||||
// tmp = ((segment[4] & 0x0F) << 8) | (segment_number << 5);
|
// tmp = ((segment[4] & 0x0F) << 8) | (segment_number << 5);
|
||||||
encoded = mobilinkd::Golay24::encode24(tmp);
|
encoded = modemm17::Golay24::encode24(tmp);
|
||||||
|
|
||||||
for (size_t i = 72; i != 96; ++i)
|
for (size_t i = 72; i != 96; ++i)
|
||||||
{
|
{
|
||||||
@ -259,25 +259,25 @@ public:
|
|||||||
{
|
{
|
||||||
uint32_t x = (b & 0x80) >> 7;
|
uint32_t x = (b & 0x80) >> 7;
|
||||||
b <<= 1;
|
b <<= 1;
|
||||||
memory = mobilinkd::update_memory<4>(memory, x);
|
memory = modemm17::update_memory<4>(memory, x);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the encoder.
|
// Flush the encoder.
|
||||||
for (size_t i = 0; i != 4; ++i)
|
for (size_t i = 0; i != 4; ++i)
|
||||||
{
|
{
|
||||||
memory = mobilinkd::update_memory<4>(memory, 0);
|
memory = modemm17::update_memory<4>(memory, 0);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<int8_t, 272> punctured;
|
std::array<int8_t, 272> punctured;
|
||||||
auto size = mobilinkd::puncture(encoded, punctured, mobilinkd::P2);
|
auto size = modemm17::puncture(encoded, punctured, modemm17::P2);
|
||||||
|
|
||||||
if (size != 272) {
|
if (size != 272) {
|
||||||
std::cerr << "mobilinkd::M17Modulator::make_stream_data_frame: incorrect size (not 272)" << size;
|
std::cerr << "modemm17::M17Modulator::make_stream_data_frame: incorrect size (not 272)" << size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return punctured;
|
return punctured;
|
||||||
@ -330,9 +330,9 @@ public:
|
|||||||
{
|
{
|
||||||
uint32_t x = (b & 0x80) >> 7;
|
uint32_t x = (b & 0x80) >> 7;
|
||||||
b <<= 1;
|
b <<= 1;
|
||||||
memory = mobilinkd::update_memory<4>(memory, x);
|
memory = modemm17::update_memory<4>(memory, x);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,24 +342,24 @@ public:
|
|||||||
{
|
{
|
||||||
uint32_t x = (b & 0x80) >> 7;
|
uint32_t x = (b & 0x80) >> 7;
|
||||||
b <<= 1;
|
b <<= 1;
|
||||||
memory = mobilinkd::update_memory<4>(memory, x);
|
memory = modemm17::update_memory<4>(memory, x);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the encoder.
|
// Flush the encoder.
|
||||||
for (size_t i = 0; i != 4; ++i)
|
for (size_t i = 0; i != 4; ++i)
|
||||||
{
|
{
|
||||||
memory = mobilinkd::update_memory<4>(memory, 0);
|
memory = modemm17::update_memory<4>(memory, 0);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(031, memory);
|
encoded[index++] = modemm17::convolve_bit(031, memory);
|
||||||
encoded[index++] = mobilinkd::convolve_bit(027, memory);
|
encoded[index++] = modemm17::convolve_bit(027, memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<int8_t, 368> punctured;
|
std::array<int8_t, 368> punctured;
|
||||||
auto size = puncture(encoded, punctured, P3);
|
auto size = puncture(encoded, punctured, P3);
|
||||||
|
|
||||||
if (size != 368) {
|
if (size != 368) {
|
||||||
std::cerr << "mobilinkd::M17Modulator::make_packet_frame: incorrect size (not 368)" << size;
|
std::cerr << "modemm17::M17Modulator::make_packet_frame: incorrect size (not 368)" << size;
|
||||||
}
|
}
|
||||||
|
|
||||||
interleaver.interleave(punctured);
|
interleaver.interleave(punctured);
|
||||||
@ -438,7 +438,7 @@ public:
|
|||||||
auto size = puncture(encoded, punctured, P2);
|
auto size = puncture(encoded, punctured, P2);
|
||||||
|
|
||||||
if (size != 368) {
|
if (size != 368) {
|
||||||
std::cerr << "mobilinkd::M17Modulator::make_bert_frame: incorrect size (not 368)" << size;
|
std::cerr << "modemm17::M17Modulator::make_bert_frame: incorrect size (not 368)" << size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return punctured;
|
return punctured;
|
||||||
@ -498,7 +498,7 @@ private:
|
|||||||
return encoded_call;
|
return encoded_call;
|
||||||
}
|
}
|
||||||
|
|
||||||
mobilinkd::LinkSetupFrame::call_t call;
|
modemm17::LinkSetupFrame::call_t call;
|
||||||
call.fill(0);
|
call.fill(0);
|
||||||
std::copy(callsign.begin(), callsign.end(), call.begin());
|
std::copy(callsign.begin(), callsign.end(), call.begin());
|
||||||
encoded_call = LinkSetupFrame::encode_callsign(call);
|
encoded_call = LinkSetupFrame::encode_callsign(call);
|
||||||
@ -566,4 +566,4 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@ -76,4 +76,4 @@ struct M17ByteRandomizer
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
struct M17Synchronizer
|
struct M17Synchronizer
|
||||||
@ -33,4 +33,4 @@ struct M17Synchronizer
|
|||||||
void reset() { buffer_ = 0; }
|
void reset() { buffer_ = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,4 +47,4 @@ struct PhaseEstimator
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t F1= 45, size_t F2 = 92, size_t K = 368>
|
template <size_t F1= 45, size_t F2 = 92, size_t K = 368>
|
||||||
@ -22,14 +22,14 @@ struct PolynomialInterleaver
|
|||||||
{
|
{
|
||||||
return ((F1 * i) + (F2 * i * i)) % K;
|
return ((F1 * i) + (F2 * i * i)) % K;
|
||||||
}
|
}
|
||||||
|
|
||||||
void interleave(buffer_t& data)
|
void interleave(buffer_t& data)
|
||||||
{
|
{
|
||||||
buffer_.fill(0);
|
buffer_.fill(0);
|
||||||
|
|
||||||
for (size_t i = 0; i != K; ++i)
|
for (size_t i = 0; i != K; ++i)
|
||||||
buffer_[index(i)] = data[i];
|
buffer_[index(i)] = data[i];
|
||||||
|
|
||||||
std::copy(std::begin(buffer_), std::end(buffer_), std::begin(data));
|
std::copy(std::begin(buffer_), std::end(buffer_), std::begin(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ struct PolynomialInterleaver
|
|||||||
auto idx = index(i);
|
auto idx = index(i);
|
||||||
buffer_[i] = frame[idx];
|
buffer_[i] = frame[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy(buffer_.begin(), buffer_.end(), frame.begin());
|
std::copy(buffer_.begin(), buffer_.end(), frame.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,4 +70,4 @@ struct PolynomialInterleaver
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 Mobilinkd LLC.
|
// Copyright 2021 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#include <complex>
|
#include <complex>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,4 +132,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
@ -82,4 +82,4 @@ SymbolEvm<N> makeSymbolEvm(
|
|||||||
return std::move(SymbolEvm<float, N>(std::move(filter), erasure_limit));
|
return std::move(SymbolEvm<float, N>(std::move(filter), erasure_limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020-2021 Mobilinkd LLC.
|
// Copyright 2020-2021 modemm17 LLC.
|
||||||
|
|
||||||
// make CXXFLAGS="$(pkg-config --cflags gtest) $(pkg-config --libs gtest) -I. -O3" tests/TrellisTest
|
// make CXXFLAGS="$(pkg-config --cflags gtest) $(pkg-config --libs gtest) -I. -O3" tests/TrellisTest
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
inline constexpr std::array<int8_t, 61> make_p1() {
|
inline constexpr std::array<int8_t, 61> make_p1() {
|
||||||
@ -147,4 +147,4 @@ constexpr Trellis<K, n> makeTrellis(std::array<uint32_t, n> polys)
|
|||||||
return Trellis<K, n>(polys);
|
return Trellis<K, n>(polys);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
// The make_bitset stuff only works as expected in GCC10 and later.
|
// The make_bitset stuff only works as expected in GCC10 and later.
|
||||||
@ -425,4 +425,4 @@ constexpr int popcount( T x ) noexcept
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2020 Mobilinkd LLC.
|
// Copyright 2020 modemm17 LLC.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,4 +239,4 @@ struct Viterbi
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2012-2021 Rob Riggs <rob@mobilinkd.com>
|
// Copyright 2012-2021 Rob Riggs <rob@modemm17.com>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -17,7 +17,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace mobilinkd {
|
namespace modemm17 {
|
||||||
|
|
||||||
struct ax25_frame
|
struct ax25_frame
|
||||||
{
|
{
|
||||||
@ -262,4 +262,4 @@ void write(std::ostream& os, const ax25_frame& frame)
|
|||||||
os << "Info: " << std::endl << frame.info() << std::endl;
|
os << "Info: " << std::endl << frame.info() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
namespace mobilinkd
|
namespace modemm17
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,7 +31,7 @@ private:
|
|||||||
mutable mutex_type mutex_;
|
mutable mutex_type mutex_;
|
||||||
std::condition_variable full_;
|
std::condition_variable full_;
|
||||||
std::condition_variable empty_;
|
std::condition_variable empty_;
|
||||||
|
|
||||||
queue(queue&) = delete;
|
queue(queue&) = delete;
|
||||||
queue& operator=(const queue&) = delete;
|
queue& operator=(const queue&) = delete;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public:
|
|||||||
|
|
||||||
/// A pointer to an element stored in a Queue.
|
/// A pointer to an element stored in a Queue.
|
||||||
using const_pointer = const value_type*;
|
using const_pointer = const value_type*;
|
||||||
|
|
||||||
queue()
|
queue()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -66,11 +66,11 @@ public:
|
|||||||
* in the queue (default is forever, duration::max()).
|
* in the queue (default is forever, duration::max()).
|
||||||
*
|
*
|
||||||
* @return true if a value was returned, otherwise false.
|
* @return true if a value was returned, otherwise false.
|
||||||
*
|
*
|
||||||
* @note The return value me be false if either the timeout expires
|
* @note The return value me be false if either the timeout expires
|
||||||
* or the queue is closed.
|
* or the queue is closed.
|
||||||
*/
|
*/
|
||||||
template<class Clock>
|
template<class Clock>
|
||||||
bool get_until(reference val, std::chrono::time_point<Clock> when)
|
bool get_until(reference val, std::chrono::time_point<Clock> when)
|
||||||
{
|
{
|
||||||
lock_type lock(mutex_);
|
lock_type lock(mutex_);
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
{
|
{
|
||||||
state_ == State::CLOSED;
|
state_ == State::CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
full_.notify_one();
|
full_.notify_one();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -111,11 +111,11 @@ public:
|
|||||||
* in the queue (default is forever, duration::max()).
|
* in the queue (default is forever, duration::max()).
|
||||||
*
|
*
|
||||||
* @return true if a value was returned, otherwise false.
|
* @return true if a value was returned, otherwise false.
|
||||||
*
|
*
|
||||||
* @note The return value me be false if either the timeout expires
|
* @note The return value me be false if either the timeout expires
|
||||||
* or the queue is closed.
|
* or the queue is closed.
|
||||||
*/
|
*/
|
||||||
template<class Rep = int64_t, class Period = std::ratio<1>>
|
template<class Rep = int64_t, class Period = std::ratio<1>>
|
||||||
bool get(reference val, std::chrono::duration<Rep, Period> timeout = std::chrono::duration<Rep, Period>::max())
|
bool get(reference val, std::chrono::duration<Rep, Period> timeout = std::chrono::duration<Rep, Period>::max())
|
||||||
{
|
{
|
||||||
lock_type lock(mutex_);
|
lock_type lock(mutex_);
|
||||||
@ -141,12 +141,12 @@ public:
|
|||||||
{
|
{
|
||||||
state_ == State::CLOSED;
|
state_ == State::CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
full_.notify_one();
|
full_.notify_one();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put an item on the queue.
|
* Put an item on the queue.
|
||||||
*
|
*
|
||||||
@ -155,11 +155,11 @@ public:
|
|||||||
* for more items on the queue (default is forever -- duration::max()).
|
* for more items on the queue (default is forever -- duration::max()).
|
||||||
*
|
*
|
||||||
* @return true if a value was put on the queue, otherwise false.
|
* @return true if a value was put on the queue, otherwise false.
|
||||||
*
|
*
|
||||||
* @note The return value me be false if either the timeout expires
|
* @note The return value me be false if either the timeout expires
|
||||||
* or the queue is closed.
|
* or the queue is closed.
|
||||||
*/
|
*/
|
||||||
template<typename U, class Rep = int64_t, class Period = std::ratio<1>>
|
template<typename U, class Rep = int64_t, class Period = std::ratio<1>>
|
||||||
bool put(U&& val, std::chrono::duration<Rep, Period> timeout = std::chrono::duration<Rep, Period>::max())
|
bool put(U&& val, std::chrono::duration<Rep, Period> timeout = std::chrono::duration<Rep, Period>::max())
|
||||||
{
|
{
|
||||||
// Get the queue mutex.
|
// Get the queue mutex.
|
||||||
@ -169,11 +169,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (timeout.count() == 0)
|
if (timeout.count() == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto expiration = std::chrono::system_clock::now() + timeout;
|
auto expiration = std::chrono::system_clock::now() + timeout;
|
||||||
|
|
||||||
while (SIZE == size_)
|
while (SIZE == size_)
|
||||||
{
|
{
|
||||||
if (State::OPEN != state_)
|
if (State::OPEN != state_)
|
||||||
@ -187,7 +187,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (State::OPEN != state_)
|
if (State::OPEN != state_)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -197,7 +197,7 @@ public:
|
|||||||
size_ += 1;
|
size_ += 1;
|
||||||
|
|
||||||
empty_.notify_one();
|
empty_.notify_one();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,16 +206,16 @@ public:
|
|||||||
guard_type lock(mutex_);
|
guard_type lock(mutex_);
|
||||||
|
|
||||||
state_ = (queue_.empty() ? State::CLOSED : State::CLOSING);
|
state_ = (queue_.empty() ? State::CLOSED : State::CLOSING);
|
||||||
|
|
||||||
full_.notify_all();
|
full_.notify_all();
|
||||||
empty_.notify_all();
|
empty_.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_open() const
|
bool is_open() const
|
||||||
{
|
{
|
||||||
return State::OPEN == state_;
|
return State::OPEN == state_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_closed() const
|
bool is_closed() const
|
||||||
{
|
{
|
||||||
return State::CLOSED == state_;
|
return State::CLOSED == state_;
|
||||||
@ -229,7 +229,7 @@ public:
|
|||||||
guard_type lock(mutex_);
|
guard_type lock(mutex_);
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of items in the queue.
|
* @return the number of items in the queue.
|
||||||
*/
|
*/
|
||||||
@ -248,4 +248,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // mobilinkd
|
} // modemm17
|
||||||
|
@ -65,9 +65,9 @@ void M17DemodProcessor::pushSample(qint16 sample)
|
|||||||
m_demod(sample / 22000.0f);
|
m_demod(sample / 22000.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M17DemodProcessor::handle_frame(mobilinkd::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost)
|
bool M17DemodProcessor::handle_frame(modemm17::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost)
|
||||||
{
|
{
|
||||||
using FrameType = mobilinkd::M17FrameDecoder::FrameType;
|
using FrameType = modemm17::M17FrameDecoder::FrameType;
|
||||||
|
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ void M17DemodProcessor::diagnostic_callback(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M17DemodProcessor::decode_lich(mobilinkd::M17FrameDecoder::lich_buffer_t const& lich)
|
bool M17DemodProcessor::decode_lich(modemm17::M17FrameDecoder::lich_buffer_t const& lich)
|
||||||
{
|
{
|
||||||
uint8_t fragment_number = lich[5]; // Get fragment number.
|
uint8_t fragment_number = lich[5]; // Get fragment number.
|
||||||
fragment_number = (fragment_number >> 5) & 7;
|
fragment_number = (fragment_number >> 5) & 7;
|
||||||
@ -159,17 +159,17 @@ bool M17DemodProcessor::decode_lich(mobilinkd::M17FrameDecoder::lich_buffer_t co
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M17DemodProcessor::decode_lsf(mobilinkd::M17FrameDecoder::lsf_buffer_t const& lsf)
|
bool M17DemodProcessor::decode_lsf(modemm17::M17FrameDecoder::lsf_buffer_t const& lsf)
|
||||||
{
|
{
|
||||||
mobilinkd::LinkSetupFrame::encoded_call_t encoded_call;
|
modemm17::LinkSetupFrame::encoded_call_t encoded_call;
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|
||||||
std::copy(lsf.begin() + 6, lsf.begin() + 12, encoded_call.begin());
|
std::copy(lsf.begin() + 6, lsf.begin() + 12, encoded_call.begin());
|
||||||
mobilinkd::LinkSetupFrame::call_t src = mobilinkd::LinkSetupFrame::decode_callsign(encoded_call);
|
modemm17::LinkSetupFrame::call_t src = modemm17::LinkSetupFrame::decode_callsign(encoded_call);
|
||||||
m_srcCall = QString(src.data());
|
m_srcCall = QString(src.data());
|
||||||
|
|
||||||
std::copy(lsf.begin(), lsf.begin() + 6, encoded_call.begin());
|
std::copy(lsf.begin(), lsf.begin() + 6, encoded_call.begin());
|
||||||
mobilinkd::LinkSetupFrame::call_t dest = mobilinkd::LinkSetupFrame::decode_callsign(encoded_call);
|
modemm17::LinkSetupFrame::call_t dest = modemm17::LinkSetupFrame::decode_callsign(encoded_call);
|
||||||
m_destCall = QString(dest.data());
|
m_destCall = QString(dest.data());
|
||||||
|
|
||||||
uint16_t type = (lsf[12] << 8) | lsf[13];
|
uint16_t type = (lsf[12] << 8) | lsf[13];
|
||||||
@ -280,7 +280,7 @@ void M17DemodProcessor::setDCDOff()
|
|||||||
m_demod.dcd_off();
|
m_demod.dcd_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void M17DemodProcessor::append_packet(std::vector<uint8_t>& result, mobilinkd::M17FrameDecoder::lsf_buffer_t in)
|
void M17DemodProcessor::append_packet(std::vector<uint8_t>& result, modemm17::M17FrameDecoder::lsf_buffer_t in)
|
||||||
{
|
{
|
||||||
uint8_t out = 0;
|
uint8_t out = 0;
|
||||||
size_t b = 0;
|
size_t b = 0;
|
||||||
@ -297,7 +297,7 @@ void M17DemodProcessor::append_packet(std::vector<uint8_t>& result, mobilinkd::M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_t const& packet_segment)
|
bool M17DemodProcessor::decode_packet(modemm17::M17FrameDecoder::packet_buffer_t const& packet_segment)
|
||||||
{
|
{
|
||||||
// qDebug() << tr("M17DemodProcessor::decode_packet: 0x%1").arg((int) packet_segment[25], 2, 16, QChar('0'));
|
// qDebug() << tr("M17DemodProcessor::decode_packet: 0x%1").arg((int) packet_segment[25], 2, 16, QChar('0'));
|
||||||
if (packet_segment[25] & 0x80) // last frame of packet.
|
if (packet_segment[25] & 0x80) // last frame of packet.
|
||||||
@ -320,7 +320,7 @@ bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_
|
|||||||
qDebug() << "M17DemodProcessor::decode_packet: last chunk size:" << packet_size << " packet size:" << m_currentPacket.size();
|
qDebug() << "M17DemodProcessor::decode_packet: last chunk size:" << packet_size << " packet size:" << m_currentPacket.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
mobilinkd::CRC16<0x5935, 0xFFFF> crc16;
|
modemm17::CRC16<0x5935, 0xFFFF> crc16;
|
||||||
crc16.reset();
|
crc16.reset();
|
||||||
|
|
||||||
for (std::vector<uint8_t>::const_iterator it = m_currentPacket.begin(); it != m_currentPacket.end() - 2; ++it) {
|
for (std::vector<uint8_t>::const_iterator it = m_currentPacket.begin(); it != m_currentPacket.end() - 2; ++it) {
|
||||||
@ -345,9 +345,9 @@ bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_
|
|||||||
ax25.push_back(char(c));
|
ax25.push_back(char(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
mobilinkd::ax25_frame frame(ax25);
|
modemm17::ax25_frame frame(ax25);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
mobilinkd::write(oss, frame); // TODO: get details
|
modemm17::write(oss, frame); // TODO: get details
|
||||||
qDebug() << "M17DemodProcessor::decode_packet: AX25:" << oss.str().c_str();
|
qDebug() << "M17DemodProcessor::decode_packet: AX25:" << oss.str().c_str();
|
||||||
}
|
}
|
||||||
else if (m_stdPacketProtocol == StdPacketSMS)
|
else if (m_stdPacketProtocol == StdPacketSMS)
|
||||||
@ -439,7 +439,7 @@ bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M17DemodProcessor::decode_bert(mobilinkd::M17FrameDecoder::bert_buffer_t const& bert)
|
bool M17DemodProcessor::decode_bert(modemm17::M17FrameDecoder::bert_buffer_t const& bert)
|
||||||
{
|
{
|
||||||
for (int j = 0; j != 24; ++j)
|
for (int j = 0; j != 24; ++j)
|
||||||
{
|
{
|
||||||
@ -463,7 +463,7 @@ bool M17DemodProcessor::decode_bert(mobilinkd::M17FrameDecoder::bert_buffer_t co
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool M17DemodProcessor::demodulate_audio(mobilinkd::M17FrameDecoder::audio_buffer_t const& audio, int viterbi_cost)
|
bool M17DemodProcessor::demodulate_audio(modemm17::M17FrameDecoder::audio_buffer_t const& audio, int viterbi_cost)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
std::array<int16_t, 160> buf; // 8k audio
|
std::array<int16_t, 160> buf; // 8k audio
|
||||||
|
@ -93,12 +93,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::vector<uint8_t> m_currentPacket;
|
std::vector<uint8_t> m_currentPacket;
|
||||||
size_t m_packetFrameCounter;
|
size_t m_packetFrameCounter;
|
||||||
mobilinkd::PRBS9 m_prbs;
|
modemm17::PRBS9 m_prbs;
|
||||||
bool m_displayLSF;
|
bool m_displayLSF;
|
||||||
bool m_noiseBlanker;
|
bool m_noiseBlanker;
|
||||||
struct CODEC2 *m_codec2;
|
struct CODEC2 *m_codec2;
|
||||||
static M17DemodProcessor *m_this;
|
static M17DemodProcessor *m_this;
|
||||||
mobilinkd::M17Demodulator m_demod;
|
modemm17::M17Demodulator m_demod;
|
||||||
AudioFifo *m_audioFifo;
|
AudioFifo *m_audioFifo;
|
||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
AudioVector m_audioBuffer;
|
AudioVector m_audioBuffer;
|
||||||
@ -134,7 +134,7 @@ private:
|
|||||||
|
|
||||||
MessageQueue *m_demodInputMessageQueue;
|
MessageQueue *m_demodInputMessageQueue;
|
||||||
|
|
||||||
static bool handle_frame(mobilinkd::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost);
|
static bool handle_frame(modemm17::M17FrameDecoder::output_buffer_t const& frame, int viterbi_cost);
|
||||||
static void diagnostic_callback(
|
static void diagnostic_callback(
|
||||||
bool dcd,
|
bool dcd,
|
||||||
float evm,
|
float evm,
|
||||||
@ -147,13 +147,13 @@ private:
|
|||||||
int clock_index,
|
int clock_index,
|
||||||
int viterbi_cost
|
int viterbi_cost
|
||||||
);
|
);
|
||||||
bool decode_lsf(mobilinkd::M17FrameDecoder::lsf_buffer_t const& lsf);
|
bool decode_lsf(modemm17::M17FrameDecoder::lsf_buffer_t const& lsf);
|
||||||
bool decode_lich(mobilinkd::M17FrameDecoder::lich_buffer_t const& lich);
|
bool decode_lich(modemm17::M17FrameDecoder::lich_buffer_t const& lich);
|
||||||
bool decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_t const& packet_segment);
|
bool decode_packet(modemm17::M17FrameDecoder::packet_buffer_t const& packet_segment);
|
||||||
bool decode_bert(mobilinkd::M17FrameDecoder::bert_buffer_t const& bert);
|
bool decode_bert(modemm17::M17FrameDecoder::bert_buffer_t const& bert);
|
||||||
bool demodulate_audio(mobilinkd::M17FrameDecoder::audio_buffer_t const& audio, int viterbi_cost);
|
bool demodulate_audio(modemm17::M17FrameDecoder::audio_buffer_t const& audio, int viterbi_cost);
|
||||||
void decode_type(uint16_t type);
|
void decode_type(uint16_t type);
|
||||||
void append_packet(std::vector<uint8_t>& result, mobilinkd::M17FrameDecoder::lsf_buffer_t in);
|
void append_packet(std::vector<uint8_t>& result, modemm17::M17FrameDecoder::lsf_buffer_t in);
|
||||||
|
|
||||||
void processAudio(const std::array<int16_t, 160>& in);
|
void processAudio(const std::array<int16_t, 160>& in);
|
||||||
void upsample(int upsampling, const int16_t *in, int nbSamplesIn);
|
void upsample(int upsampling, const int16_t *in, int nbSamplesIn);
|
||||||
|
@ -166,28 +166,28 @@ void M17ModProcessor::processPacket(const QString& sourceCall, const QString& de
|
|||||||
|
|
||||||
// LSF
|
// LSF
|
||||||
std::array<uint8_t, 30> lsf;
|
std::array<uint8_t, 30> lsf;
|
||||||
std::array<int8_t, 368> lsf_frame = mobilinkd::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can);
|
std::array<int8_t, 368> lsf_frame = modemm17::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can);
|
||||||
output_baseband(mobilinkd::M17Modulator::LSF_SYNC_WORD, lsf_frame);
|
output_baseband(modemm17::M17Modulator::LSF_SYNC_WORD, lsf_frame);
|
||||||
|
|
||||||
// Packets
|
// Packets
|
||||||
int remainderCount = packetBytes.size();
|
int remainderCount = packetBytes.size();
|
||||||
int packetCount = 0;
|
int packetCount = 0;
|
||||||
std::array<int8_t, 368> packet_frame;
|
std::array<int8_t, 368> packet_frame;
|
||||||
// std::copy(mobilinkd::M17Modulator::DATA_SYNC_WORD.begin(), mobilinkd::M17Modulator::DATA_SYNC_WORD.end(), fullframe_symbols.begin());
|
// std::copy(modemm17::M17Modulator::DATA_SYNC_WORD.begin(), modemm17::M17Modulator::DATA_SYNC_WORD.end(), fullframe_symbols.begin());
|
||||||
mobilinkd::M17Modulator::packet_t packet;
|
modemm17::M17Modulator::packet_t packet;
|
||||||
|
|
||||||
while (remainderCount > 25)
|
while (remainderCount > 25)
|
||||||
{
|
{
|
||||||
std::copy(packetBytes.begin() + (packetCount*25), packetBytes.begin() + ((packetCount+1)*25), packet.begin());
|
std::copy(packetBytes.begin() + (packetCount*25), packetBytes.begin() + ((packetCount+1)*25), packet.begin());
|
||||||
packet_frame = m_m17Modulator.make_packet_frame(packetCount, 25, false, packet);
|
packet_frame = m_m17Modulator.make_packet_frame(packetCount, 25, false, packet);
|
||||||
output_baseband(mobilinkd::M17Modulator::PACKET_SYNC_WORD, packet_frame);
|
output_baseband(modemm17::M17Modulator::PACKET_SYNC_WORD, packet_frame);
|
||||||
remainderCount -= 25;
|
remainderCount -= 25;
|
||||||
packetCount++;
|
packetCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy(packetBytes.begin() + (packetCount*25), packetBytes.begin() + (packetCount*25) + remainderCount, packet.begin());
|
std::copy(packetBytes.begin() + (packetCount*25), packetBytes.begin() + (packetCount*25) + remainderCount, packet.begin());
|
||||||
packet_frame = m_m17Modulator.make_packet_frame(packetCount, remainderCount, true, packet);
|
packet_frame = m_m17Modulator.make_packet_frame(packetCount, remainderCount, true, packet);
|
||||||
output_baseband(mobilinkd::M17Modulator::PACKET_SYNC_WORD, packet_frame);
|
output_baseband(modemm17::M17Modulator::PACKET_SYNC_WORD, packet_frame);
|
||||||
qDebug("M17ModProcessor::processPacket: last: packetCount: %d remainderCount: %d", packetCount, remainderCount);
|
qDebug("M17ModProcessor::processPacket: last: packetCount: %d remainderCount: %d", packetCount, remainderCount);
|
||||||
|
|
||||||
send_eot(); // EOT
|
send_eot(); // EOT
|
||||||
@ -205,15 +205,15 @@ void M17ModProcessor::audioStart(const QString& sourceCall, const QString& destC
|
|||||||
|
|
||||||
// LSF
|
// LSF
|
||||||
std::array<uint8_t, 30> lsf;
|
std::array<uint8_t, 30> lsf;
|
||||||
std::array<int8_t, 368> lsf_frame = mobilinkd::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can, true);
|
std::array<int8_t, 368> lsf_frame = modemm17::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can, true);
|
||||||
output_baseband(mobilinkd::M17Modulator::LSF_SYNC_WORD, lsf_frame);
|
output_baseband(modemm17::M17Modulator::LSF_SYNC_WORD, lsf_frame);
|
||||||
|
|
||||||
// Prepare LICH
|
// Prepare LICH
|
||||||
for (size_t i = 0; i < m_lich.size(); ++i)
|
for (size_t i = 0; i < m_lich.size(); ++i)
|
||||||
{
|
{
|
||||||
std::array<uint8_t, 5> segment;
|
std::array<uint8_t, 5> segment;
|
||||||
std::copy(lsf.begin() + i*5, lsf.begin() + (i + 1)*5, segment.begin());
|
std::copy(lsf.begin() + i*5, lsf.begin() + (i + 1)*5, segment.begin());
|
||||||
mobilinkd::M17Modulator::lich_segment_t lich_segment = mobilinkd::M17Modulator::make_lich_segment(segment, i);
|
modemm17::M17Modulator::lich_segment_t lich_segment = modemm17::M17Modulator::make_lich_segment(segment, i);
|
||||||
std::copy(lich_segment.begin(), lich_segment.end(), m_lich[i].begin());
|
std::copy(lich_segment.begin(), lich_segment.end(), m_lich[i].begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ void M17ModProcessor::send_preamble()
|
|||||||
// Preamble is simple... bytes -> symbols -> baseband.
|
// Preamble is simple... bytes -> symbols -> baseband.
|
||||||
std::array<uint8_t, 48> preamble_bytes;
|
std::array<uint8_t, 48> preamble_bytes;
|
||||||
preamble_bytes.fill(0x77);
|
preamble_bytes.fill(0x77);
|
||||||
std::array<int8_t, 192> preamble_symbols = mobilinkd::M17Modulator::bytes_to_symbols(preamble_bytes);
|
std::array<int8_t, 192> preamble_symbols = modemm17::M17Modulator::bytes_to_symbols(preamble_bytes);
|
||||||
std::array<int16_t, 1920> preamble_baseband = m_m17Modulator.symbols_to_baseband(preamble_symbols);
|
std::array<int16_t, 1920> preamble_baseband = m_m17Modulator.symbols_to_baseband(preamble_symbols);
|
||||||
m_basebandFifo.write(preamble_baseband.data(), 1920);
|
m_basebandFifo.write(preamble_baseband.data(), 1920);
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ void M17ModProcessor::send_preamble()
|
|||||||
void M17ModProcessor::processAudioFrame()
|
void M17ModProcessor::processAudioFrame()
|
||||||
{
|
{
|
||||||
std::array<uint8_t, 16> audioPayload = encodeAudio(m_audioFrame);
|
std::array<uint8_t, 16> audioPayload = encodeAudio(m_audioFrame);
|
||||||
std::array<int8_t, 272> audioDataBits = mobilinkd::M17Modulator::make_stream_data_frame(m_audioFrameNumber++, audioPayload);
|
std::array<int8_t, 272> audioDataBits = modemm17::M17Modulator::make_stream_data_frame(m_audioFrameNumber++, audioPayload);
|
||||||
|
|
||||||
if (m_audioFrameNumber == 0x8000) {
|
if (m_audioFrameNumber == 0x8000) {
|
||||||
m_audioFrameNumber = 0;
|
m_audioFrameNumber = 0;
|
||||||
@ -259,16 +259,16 @@ void M17ModProcessor::processAudioFrame()
|
|||||||
std::array<int8_t, 368> temp;
|
std::array<int8_t, 368> temp;
|
||||||
auto it = std::copy(lich.begin(), lich.end(), temp.begin());
|
auto it = std::copy(lich.begin(), lich.end(), temp.begin());
|
||||||
std::copy(audioDataBits.begin(), audioDataBits.end(), it);
|
std::copy(audioDataBits.begin(), audioDataBits.end(), it);
|
||||||
mobilinkd::M17Modulator::interleave_and_randomize(temp);
|
modemm17::M17Modulator::interleave_and_randomize(temp);
|
||||||
|
|
||||||
output_baseband(mobilinkd::M17Modulator::STREAM_SYNC_WORD, temp);
|
output_baseband(modemm17::M17Modulator::STREAM_SYNC_WORD, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void M17ModProcessor::processBERTFrame()
|
void M17ModProcessor::processBERTFrame()
|
||||||
{
|
{
|
||||||
std::array<int8_t, 368> temp = mobilinkd::M17Modulator::make_bert_frame(m_prbs);
|
std::array<int8_t, 368> temp = modemm17::M17Modulator::make_bert_frame(m_prbs);
|
||||||
mobilinkd::M17Modulator::interleave_and_randomize(temp);
|
modemm17::M17Modulator::interleave_and_randomize(temp);
|
||||||
output_baseband(mobilinkd::M17Modulator::BERT_SYNC_WORD, temp);
|
output_baseband(modemm17::M17Modulator::BERT_SYNC_WORD, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<uint8_t, 16> M17ModProcessor::encodeAudio(std::array<int16_t, 320*6>& audioFrame)
|
std::array<uint8_t, 16> M17ModProcessor::encodeAudio(std::array<int16_t, 320*6>& audioFrame)
|
||||||
@ -290,15 +290,15 @@ void M17ModProcessor::send_eot()
|
|||||||
std::copy(EOT_SYNC.begin(), EOT_SYNC.end(), eot_bytes.begin() + i);
|
std::copy(EOT_SYNC.begin(), EOT_SYNC.end(), eot_bytes.begin() + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<int8_t, 192> eot_symbols = mobilinkd::M17Modulator::bytes_to_symbols(eot_bytes);
|
std::array<int8_t, 192> eot_symbols = modemm17::M17Modulator::bytes_to_symbols(eot_bytes);
|
||||||
std::array<int16_t, 1920> eot_baseband = m_m17Modulator.symbols_to_baseband(eot_symbols);
|
std::array<int16_t, 1920> eot_baseband = m_m17Modulator.symbols_to_baseband(eot_symbols);
|
||||||
m_basebandFifo.write(eot_baseband.data(), 1920);
|
m_basebandFifo.write(eot_baseband.data(), 1920);
|
||||||
}
|
}
|
||||||
|
|
||||||
void M17ModProcessor::output_baseband(std::array<uint8_t, 2> sync_word, const std::array<int8_t, 368>& frame)
|
void M17ModProcessor::output_baseband(std::array<uint8_t, 2> sync_word, const std::array<int8_t, 368>& frame)
|
||||||
{
|
{
|
||||||
std::array<int8_t, 184> symbols = mobilinkd::M17Modulator::bits_to_symbols(frame); // 368 bits -> 184 dibit symbols
|
std::array<int8_t, 184> symbols = modemm17::M17Modulator::bits_to_symbols(frame); // 368 bits -> 184 dibit symbols
|
||||||
std::array<int8_t, 8> sw = mobilinkd::M17Modulator::bytes_to_symbols(sync_word); // 16 bits -> 8 dibit symbols
|
std::array<int8_t, 8> sw = modemm17::M17Modulator::bytes_to_symbols(sync_word); // 16 bits -> 8 dibit symbols
|
||||||
|
|
||||||
std::array<int8_t, 192> temp; // 384 = 368 + 16 bits -> 192 dibit symbols
|
std::array<int8_t, 192> temp; // 384 = 368 + 16 bits -> 192 dibit symbols
|
||||||
auto fit = std::copy(sw.begin(), sw.end(), temp.begin()); // start with sync word dibits
|
auto fit = std::copy(sw.begin(), sw.end(), temp.begin()); // start with sync word dibits
|
||||||
|
@ -241,14 +241,14 @@ private:
|
|||||||
int m_basebandFifoHigh;
|
int m_basebandFifoHigh;
|
||||||
int m_basebandFifoLow;
|
int m_basebandFifoLow;
|
||||||
M17ModDecimator m_decimator; //!< 48k -> 8k decimator
|
M17ModDecimator m_decimator; //!< 48k -> 8k decimator
|
||||||
mobilinkd::M17Modulator m_m17Modulator;
|
modemm17::M17Modulator m_m17Modulator;
|
||||||
std::array<mobilinkd::M17Modulator::lich_segment_t, 6> m_lich; //!< LICH bits
|
std::array<modemm17::M17Modulator::lich_segment_t, 6> m_lich; //!< LICH bits
|
||||||
int m_lichSegmentIndex;
|
int m_lichSegmentIndex;
|
||||||
std::array<int16_t, 320*6> m_audioFrame;
|
std::array<int16_t, 320*6> m_audioFrame;
|
||||||
int m_audioFrameIndex;
|
int m_audioFrameIndex;
|
||||||
uint16_t m_audioFrameNumber;
|
uint16_t m_audioFrameNumber;
|
||||||
struct CODEC2 *m_codec2;
|
struct CODEC2 *m_codec2;
|
||||||
mobilinkd::PRBS9 m_prbs;
|
modemm17::PRBS9 m_prbs;
|
||||||
bool m_insertPositionToggle;
|
bool m_insertPositionToggle;
|
||||||
|
|
||||||
bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user