diff --git a/modems/m17/CRC16.h b/modems/m17/CRC16.h index 05e3d2a54..d7c91e9ce 100644 --- a/modems/m17/CRC16.h +++ b/modems/m17/CRC16.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -6,7 +6,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -48,7 +48,7 @@ struct CRC16 } return reg & MASK; } - + uint16_t get() { auto reg = reg_; @@ -60,7 +60,7 @@ struct CRC16 } return reg; } - + std::array get_bytes() { auto crc = get(); @@ -69,4 +69,4 @@ struct CRC16 } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/CarrierDetect.h b/modems/m17/CarrierDetect.h index 2bc7dcf5c..89c34edb2 100644 --- a/modems/m17/CarrierDetect.h +++ b/modems/m17/CarrierDetect.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -10,7 +10,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { struct CarrierDetect @@ -37,4 +37,4 @@ struct CarrierDetect } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/ClockRecovery.h b/modems/m17/ClockRecovery.h index de2760846..4ae4c2b56 100644 --- a/modems/m17/ClockRecovery.h +++ b/modems/m17/ClockRecovery.h @@ -1,4 +1,4 @@ -// Copyright 2021 Mobilinkd LLC. +// Copyright 2021 modemm17 LLC. #pragma once @@ -8,7 +8,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { /** @@ -239,4 +239,4 @@ public: } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Convolution.h b/modems/m17/Convolution.h index e8dbd4b0a..30cc84070 100644 --- a/modems/m17/Convolution.h +++ b/modems/m17/Convolution.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -8,7 +8,7 @@ #include "Util.h" -namespace mobilinkd +namespace modemm17 { 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 diff --git a/modems/m17/Correlator.cpp b/modems/m17/Correlator.cpp index 579ba7e5a..b419a6337 100644 --- a/modems/m17/Correlator.cpp +++ b/modems/m17/Correlator.cpp @@ -1,9 +1,9 @@ #include "Correlator.h" -namespace mobilinkd { +namespace modemm17 { // IIR with Nyquist of 1/240. const std::array Correlator::b = {4.24433681e-05, 8.48867363e-05, 4.24433681e-05}; const std::array Correlator::a = {1.0, -1.98148851, 0.98165828}; -} // namespace mobilinkd +} // namespace modemm17 diff --git a/modems/m17/Correlator.h b/modems/m17/Correlator.h index d1c6fc4ed..b63cecfe2 100644 --- a/modems/m17/Correlator.h +++ b/modems/m17/Correlator.h @@ -1,4 +1,4 @@ -// Copyright 2021 Rob Riggs +// Copyright 2021 Rob Riggs // All rights reserved. #pragma once @@ -16,7 +16,7 @@ #include "export.h" -namespace mobilinkd { +namespace modemm17 { struct M17_API Correlator { @@ -205,4 +205,4 @@ struct SyncWord } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/DataCarrierDetect.h b/modems/m17/DataCarrierDetect.h index fac4f218b..94b96c518 100644 --- a/modems/m17/DataCarrierDetect.h +++ b/modems/m17/DataCarrierDetect.h @@ -1,4 +1,4 @@ -// Copyright 2021 Mobilinkd LLC. +// Copyright 2021 modemm17 LLC. #pragma once @@ -8,7 +8,7 @@ #include #include -namespace mobilinkd { +namespace modemm17 { /** * Data carrier detection using the difference of two DFTs, one in-band and @@ -73,4 +73,4 @@ struct DataCarrierDetect bool dcd() const { return triggered_; } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/DeviationError.h b/modems/m17/DeviationError.h index a18301b7e..b4357cc8d 100644 --- a/modems/m17/DeviationError.h +++ b/modems/m17/DeviationError.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -6,7 +6,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -92,4 +92,4 @@ struct DeviationError } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Filter.h b/modems/m17/Filter.h index 92f3a4e8d..b80911a43 100644 --- a/modems/m17/Filter.h +++ b/modems/m17/Filter.h @@ -1,8 +1,8 @@ -// Copyright 2015-2021 Mobilinkd LLC. +// Copyright 2015-2021 modemm17 LLC. #pragma once -namespace mobilinkd +namespace modemm17 { template @@ -11,4 +11,4 @@ struct FilterBase virtual NumericType operator()(NumericType input) = 0; }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/FirFilter.h b/modems/m17/FirFilter.h index e33457755..cff378bee 100644 --- a/modems/m17/FirFilter.h +++ b/modems/m17/FirFilter.h @@ -1,4 +1,4 @@ -// Copyright 2015-2020 Mobilinkd LLC. +// Copyright 2015-2020 modemm17 LLC. #pragma once @@ -7,7 +7,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -56,4 +56,4 @@ BaseFirFilter makeFirFilter(const std::array& taps) } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/FreqDevEstimator.cpp b/modems/m17/FreqDevEstimator.cpp index ce248ce7f..1c3d1c36a 100644 --- a/modems/m17/FreqDevEstimator.cpp +++ b/modems/m17/FreqDevEstimator.cpp @@ -1,8 +1,8 @@ #include "FreqDevEstimator.h" -namespace mobilinkd { +namespace modemm17 { const std::array FreqDevEstimator::dc_b = { 0.09763107, 0.19526215, 0.09763107 }; const std::array FreqDevEstimator::dc_a = { 1. , -0.94280904, 0.33333333 }; -} // namespace mobilinkd +} // namespace modemm17 diff --git a/modems/m17/FreqDevEstimator.h b/modems/m17/FreqDevEstimator.h index 0e8b066d1..92ba59405 100644 --- a/modems/m17/FreqDevEstimator.h +++ b/modems/m17/FreqDevEstimator.h @@ -1,4 +1,4 @@ -// Copyright 2021 Rob Riggs +// Copyright 2021 Rob Riggs // All rights reserved. #pragma once @@ -12,7 +12,7 @@ #include "export.h" -namespace mobilinkd { +namespace modemm17 { /** * Deviation and zero-offset estimator. @@ -127,4 +127,4 @@ public: float idev() const { return idev_; } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/FrequencyError.h b/modems/m17/FrequencyError.h index d65ede721..e6ffbfb9c 100644 --- a/modems/m17/FrequencyError.h +++ b/modems/m17/FrequencyError.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -8,7 +8,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -63,4 +63,4 @@ struct FrequencyError } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Fsk4Demod.h b/modems/m17/Fsk4Demod.h index 792fbf29a..38fa5df53 100644 --- a/modems/m17/Fsk4Demod.h +++ b/modems/m17/Fsk4Demod.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -11,7 +11,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { namespace detail @@ -153,4 +153,4 @@ struct Fsk4Demod } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Golay24.cpp b/modems/m17/Golay24.cpp index 846ecc297..6a72c8552 100644 --- a/modems/m17/Golay24.cpp +++ b/modems/m17/Golay24.cpp @@ -1,7 +1,7 @@ #include "Util.h" #include "Golay24.h" -namespace mobilinkd { +namespace modemm17 { std::array Golay24::LUT = Golay24::make_lut(); @@ -134,4 +134,4 @@ std::array Golay24::make_lut() return tmp; } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Golay24.h b/modems/m17/Golay24.h index b3dbcf45c..630f6cef0 100644 --- a/modems/m17/Golay24.h +++ b/modems/m17/Golay24.h @@ -1,4 +1,4 @@ -// Copyright 2020 Rob Riggs +// Copyright 2020 Rob Riggs // All rights reserved. #pragma once @@ -11,7 +11,7 @@ #include "export.h" -namespace mobilinkd { +namespace modemm17 { // Parts are adapted from: // http://aqdi.com/articles/using-the-golay-error-detection-and-correction-code-3/ @@ -108,4 +108,4 @@ private: static std::array make_lut(); }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/IirFilter.h b/modems/m17/IirFilter.h index fc6251263..38a9bffe1 100644 --- a/modems/m17/IirFilter.h +++ b/modems/m17/IirFilter.h @@ -1,4 +1,4 @@ -// Copyright 2015-2021 Mobilinkd LLC. +// Copyright 2015-2021 modemm17 LLC. #pragma once @@ -7,7 +7,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -49,4 +49,4 @@ BaseIirFilter makeIirFilter( return std::move(BaseIirFilter(b, a)); } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/LinkSetupFrame.h b/modems/m17/LinkSetupFrame.h index 96c39c099..e1e30c867 100644 --- a/modems/m17/LinkSetupFrame.h +++ b/modems/m17/LinkSetupFrame.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -8,7 +8,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { struct LinkSetupFrame @@ -128,4 +128,4 @@ struct LinkSetupFrame } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17Demodulator.cpp b/modems/m17/M17Demodulator.cpp index 2cb50ff3b..2b1eab658 100644 --- a/modems/m17/M17Demodulator.cpp +++ b/modems/m17/M17Demodulator.cpp @@ -1,6 +1,6 @@ #include "M17Demodulator.h" -namespace mobilinkd { +namespace modemm17 { // const std::array M17Demodulator::rrc_taps = std::array{ // 0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247, @@ -587,4 +587,4 @@ void M17Demodulator::operator()(const float input) } } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17Demodulator.h b/modems/m17/M17Demodulator.h index bb2fea0a3..6b9c11b6a 100644 --- a/modems/m17/M17Demodulator.h +++ b/modems/m17/M17Demodulator.h @@ -1,4 +1,4 @@ -// Copyright 2020-2021 Rob Riggs +// Copyright 2020-2021 Rob Riggs // All rights reserved. #pragma once @@ -20,7 +20,7 @@ #include "export.h" -namespace mobilinkd { +namespace modemm17 { struct M17_API M17Demodulator { @@ -121,4 +121,4 @@ private: int16_t initializing_count_; }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17FrameDecoder.h b/modems/m17/M17FrameDecoder.h index 7d32f22fc..987e5e63b 100644 --- a/modems/m17/M17FrameDecoder.h +++ b/modems/m17/M17FrameDecoder.h @@ -1,4 +1,4 @@ -// Copyright 2021 Mobilinkd LLC. +// Copyright 2021 modemm17 LLC. #pragma once @@ -17,7 +17,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { @@ -403,4 +403,4 @@ struct M17FrameDecoder State state() const { return state_; } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17Framer.h b/modems/m17/M17Framer.h index c80365e99..419b3e4f4 100644 --- a/modems/m17/M17Framer.h +++ b/modems/m17/M17Framer.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -7,7 +7,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -51,12 +51,12 @@ struct M17Framer } return 0; } - + void reset() - { + { buffer_.fill(0); index_ = 0; } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17Modulator.cpp b/modems/m17/M17Modulator.cpp index 135e647b5..032e35841 100644 --- a/modems/m17/M17Modulator.cpp +++ b/modems/m17/M17Modulator.cpp @@ -1,6 +1,6 @@ #include "M17Modulator.h" -namespace mobilinkd +namespace modemm17 { /* @@ -108,5 +108,5 @@ const std::array M17Modulator::rrc_taps = std::array{ +2.729505e-03, +2.987740e-03, +2.576674e-03, +1.628891e-03, +3.898184e-04, }; -} // namespace mobilinkd +} // namespace modemm17 diff --git a/modems/m17/M17Modulator.h b/modems/m17/M17Modulator.h index 6083482aa..f4d81680c 100644 --- a/modems/m17/M17Modulator.h +++ b/modems/m17/M17Modulator.h @@ -18,7 +18,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { /** @@ -119,18 +119,18 @@ public: PolynomialInterleaver<45, 92, 368> interleaver; CRC16<0x5935, 0xFFFF> crc; - mobilinkd::LinkSetupFrame::call_t callsign; + modemm17::LinkSetupFrame::call_t callsign; callsign.fill(0); 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()) { callsign.fill(0); 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()); @@ -159,25 +159,25 @@ public: { uint32_t x = (b & 0x80) >> 7; b <<= 1; - memory = mobilinkd::update_memory<4>(memory, x); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, x); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } } // Flush the encoder. for (size_t i = 0; i != 4; ++i) { - memory = mobilinkd::update_memory<4>(memory, 0); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, 0); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } std::array punctured; auto size = puncture(encoded, punctured, P1); 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); @@ -196,7 +196,7 @@ public: tmp <<= 4; tmp |= ((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) { @@ -208,7 +208,7 @@ public: tmp <<= 8; tmp |= 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) { @@ -220,7 +220,7 @@ public: tmp <<= 4; tmp |= ((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) { @@ -232,7 +232,7 @@ public: tmp <<= 8; tmp |= (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) { @@ -259,25 +259,25 @@ public: { uint32_t x = (b & 0x80) >> 7; b <<= 1; - memory = mobilinkd::update_memory<4>(memory, x); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, x); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } } // Flush the encoder. for (size_t i = 0; i != 4; ++i) { - memory = mobilinkd::update_memory<4>(memory, 0); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, 0); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } std::array punctured; - auto size = mobilinkd::puncture(encoded, punctured, mobilinkd::P2); + auto size = modemm17::puncture(encoded, punctured, modemm17::P2); 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; @@ -330,9 +330,9 @@ public: { uint32_t x = (b & 0x80) >> 7; b <<= 1; - memory = mobilinkd::update_memory<4>(memory, x); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, x); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } } @@ -342,24 +342,24 @@ public: { uint32_t x = (b & 0x80) >> 7; b <<= 1; - memory = mobilinkd::update_memory<4>(memory, x); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, x); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } // Flush the encoder. for (size_t i = 0; i != 4; ++i) { - memory = mobilinkd::update_memory<4>(memory, 0); - encoded[index++] = mobilinkd::convolve_bit(031, memory); - encoded[index++] = mobilinkd::convolve_bit(027, memory); + memory = modemm17::update_memory<4>(memory, 0); + encoded[index++] = modemm17::convolve_bit(031, memory); + encoded[index++] = modemm17::convolve_bit(027, memory); } std::array punctured; auto size = puncture(encoded, punctured, P3); 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); @@ -438,7 +438,7 @@ public: auto size = puncture(encoded, punctured, P2); 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; @@ -498,7 +498,7 @@ private: return encoded_call; } - mobilinkd::LinkSetupFrame::call_t call; + modemm17::LinkSetupFrame::call_t call; call.fill(0); std::copy(callsign.begin(), callsign.end(), call.begin()); encoded_call = LinkSetupFrame::encode_callsign(call); @@ -566,4 +566,4 @@ private: } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17Randomizer.h b/modems/m17/M17Randomizer.h index f3d9c002e..8b1deb850 100644 --- a/modems/m17/M17Randomizer.h +++ b/modems/m17/M17Randomizer.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -6,7 +6,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { namespace detail @@ -76,4 +76,4 @@ struct M17ByteRandomizer }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/M17Synchronizer.h b/modems/m17/M17Synchronizer.h index d28da5837..065df20ad 100644 --- a/modems/m17/M17Synchronizer.h +++ b/modems/m17/M17Synchronizer.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -7,7 +7,7 @@ #include "Util.h" -namespace mobilinkd +namespace modemm17 { struct M17Synchronizer @@ -33,4 +33,4 @@ struct M17Synchronizer void reset() { buffer_ = 0; } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/PhaseEstimator.h b/modems/m17/PhaseEstimator.h index d69df0371..2e504b48b 100644 --- a/modems/m17/PhaseEstimator.h +++ b/modems/m17/PhaseEstimator.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -6,7 +6,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { /** @@ -47,4 +47,4 @@ struct PhaseEstimator } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/PolynomialInterleaver.h b/modems/m17/PolynomialInterleaver.h index 57575b551..75dad5717 100644 --- a/modems/m17/PolynomialInterleaver.h +++ b/modems/m17/PolynomialInterleaver.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -7,7 +7,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -22,14 +22,14 @@ struct PolynomialInterleaver { return ((F1 * i) + (F2 * i * i)) % K; } - + void interleave(buffer_t& data) { buffer_.fill(0); for (size_t i = 0; i != K; ++i) buffer_[index(i)] = data[i]; - + std::copy(std::begin(buffer_), std::end(buffer_), std::begin(data)); } @@ -53,7 +53,7 @@ struct PolynomialInterleaver auto idx = index(i); buffer_[i] = frame[idx]; } - + std::copy(buffer_.begin(), buffer_.end(), frame.begin()); } @@ -70,4 +70,4 @@ struct PolynomialInterleaver }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/SlidingDFT.h b/modems/m17/SlidingDFT.h index 76c28a050..f1d3abd74 100644 --- a/modems/m17/SlidingDFT.h +++ b/modems/m17/SlidingDFT.h @@ -1,4 +1,4 @@ -// Copyright 2021 Mobilinkd LLC. +// Copyright 2021 modemm17 LLC. #pragma once @@ -7,7 +7,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { /** @@ -132,4 +132,4 @@ public: } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/SymbolEvm.h b/modems/m17/SymbolEvm.h index 1dc9692af..d092db2ea 100644 --- a/modems/m17/SymbolEvm.h +++ b/modems/m17/SymbolEvm.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -10,7 +10,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { template @@ -82,4 +82,4 @@ SymbolEvm makeSymbolEvm( return std::move(SymbolEvm(std::move(filter), erasure_limit)); } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Trellis.h b/modems/m17/Trellis.h index c9a1b4903..cfe0cd801 100644 --- a/modems/m17/Trellis.h +++ b/modems/m17/Trellis.h @@ -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 @@ -11,7 +11,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { inline constexpr std::array make_p1() { @@ -147,4 +147,4 @@ constexpr Trellis makeTrellis(std::array polys) return Trellis(polys); } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Util.h b/modems/m17/Util.h index 0fb98ac79..8a18c7b65 100644 --- a/modems/m17/Util.h +++ b/modems/m17/Util.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -11,7 +11,7 @@ #include -namespace mobilinkd +namespace modemm17 { // The make_bitset stuff only works as expected in GCC10 and later. @@ -425,4 +425,4 @@ constexpr int popcount( T x ) noexcept return count; } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/Viterbi.h b/modems/m17/Viterbi.h index ed3594378..dd269fcad 100644 --- a/modems/m17/Viterbi.h +++ b/modems/m17/Viterbi.h @@ -1,4 +1,4 @@ -// Copyright 2020 Mobilinkd LLC. +// Copyright 2020 modemm17 LLC. #pragma once @@ -13,7 +13,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { /** @@ -239,4 +239,4 @@ struct Viterbi } }; -} // mobilinkd +} // modemm17 diff --git a/modems/m17/ax25_frame.h b/modems/m17/ax25_frame.h index 1bc5a9a46..7bf764252 100644 --- a/modems/m17/ax25_frame.h +++ b/modems/m17/ax25_frame.h @@ -1,4 +1,4 @@ -// Copyright 2012-2021 Rob Riggs +// Copyright 2012-2021 Rob Riggs // All rights reserved. #pragma once @@ -17,7 +17,7 @@ #include -namespace mobilinkd { +namespace modemm17 { struct ax25_frame { @@ -262,4 +262,4 @@ void write(std::ostream& os, const ax25_frame& frame) os << "Info: " << std::endl << frame.info() << std::endl; } -} // mobilinkd +} // modemm17 diff --git a/modems/m17/queue.h b/modems/m17/queue.h index a83c83e16..65502b601 100644 --- a/modems/m17/queue.h +++ b/modems/m17/queue.h @@ -8,7 +8,7 @@ #include #include -namespace mobilinkd +namespace modemm17 { /** @@ -31,7 +31,7 @@ private: mutable mutex_type mutex_; std::condition_variable full_; std::condition_variable empty_; - + queue(queue&) = delete; queue& operator=(const queue&) = delete; @@ -53,7 +53,7 @@ public: /// A pointer to an element stored in a Queue. using const_pointer = const value_type*; - + queue() {} @@ -66,11 +66,11 @@ public: * in the queue (default is forever, duration::max()). * * @return true if a value was returned, otherwise false. - * + * * @note The return value me be false if either the timeout expires * or the queue is closed. */ - template + template bool get_until(reference val, std::chrono::time_point when) { lock_type lock(mutex_); @@ -96,7 +96,7 @@ public: { state_ == State::CLOSED; } - + full_.notify_one(); return true; @@ -111,11 +111,11 @@ public: * in the queue (default is forever, duration::max()). * * @return true if a value was returned, otherwise false. - * + * * @note The return value me be false if either the timeout expires * or the queue is closed. */ - template> + template> bool get(reference val, std::chrono::duration timeout = std::chrono::duration::max()) { lock_type lock(mutex_); @@ -141,12 +141,12 @@ public: { state_ == State::CLOSED; } - + full_.notify_one(); return true; }; - + /** * Put an item on the queue. * @@ -155,11 +155,11 @@ public: * for more items on the queue (default is forever -- duration::max()). * * @return true if a value was put on the queue, otherwise false. - * + * * @note The return value me be false if either the timeout expires * or the queue is closed. */ - template> + template> bool put(U&& val, std::chrono::duration timeout = std::chrono::duration::max()) { // Get the queue mutex. @@ -169,11 +169,11 @@ public: { if (timeout.count() == 0) { - return false; + return false; } auto expiration = std::chrono::system_clock::now() + timeout; - + while (SIZE == size_) { if (State::OPEN != state_) @@ -187,7 +187,7 @@ public: } } } - + if (State::OPEN != state_) { return false; @@ -197,7 +197,7 @@ public: size_ += 1; empty_.notify_one(); - + return true; }; @@ -206,16 +206,16 @@ public: guard_type lock(mutex_); state_ = (queue_.empty() ? State::CLOSED : State::CLOSING); - + full_.notify_all(); empty_.notify_all(); } - + bool is_open() const { return State::OPEN == state_; } - + bool is_closed() const { return State::CLOSED == state_; @@ -229,7 +229,7 @@ public: guard_type lock(mutex_); return size_; } - + /** * @return the number of items in the queue. */ @@ -248,4 +248,4 @@ public: } }; -} // mobilinkd +} // modemm17 diff --git a/plugins/channelrx/demodm17/m17demodprocessor.cpp b/plugins/channelrx/demodm17/m17demodprocessor.cpp index aecc8f7c4..2711c59ac 100644 --- a/plugins/channelrx/demodm17/m17demodprocessor.cpp +++ b/plugins/channelrx/demodm17/m17demodprocessor.cpp @@ -65,9 +65,9 @@ void M17DemodProcessor::pushSample(qint16 sample) 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; @@ -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. fragment_number = (fragment_number >> 5) & 7; @@ -159,17 +159,17 @@ bool M17DemodProcessor::decode_lich(mobilinkd::M17FrameDecoder::lich_buffer_t co 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::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()); 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()); uint16_t type = (lsf[12] << 8) | lsf[13]; @@ -280,7 +280,7 @@ void M17DemodProcessor::setDCDOff() m_demod.dcd_off(); } -void M17DemodProcessor::append_packet(std::vector& result, mobilinkd::M17FrameDecoder::lsf_buffer_t in) +void M17DemodProcessor::append_packet(std::vector& result, modemm17::M17FrameDecoder::lsf_buffer_t in) { uint8_t out = 0; size_t b = 0; @@ -297,7 +297,7 @@ void M17DemodProcessor::append_packet(std::vector& 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')); 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(); } - mobilinkd::CRC16<0x5935, 0xFFFF> crc16; + modemm17::CRC16<0x5935, 0xFFFF> crc16; crc16.reset(); for (std::vector::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)); } - mobilinkd::ax25_frame frame(ax25); + modemm17::ax25_frame frame(ax25); 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(); } else if (m_stdPacketProtocol == StdPacketSMS) @@ -439,7 +439,7 @@ bool M17DemodProcessor::decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_ 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) { @@ -463,7 +463,7 @@ bool M17DemodProcessor::decode_bert(mobilinkd::M17FrameDecoder::bert_buffer_t co 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; std::array buf; // 8k audio diff --git a/plugins/channelrx/demodm17/m17demodprocessor.h b/plugins/channelrx/demodm17/m17demodprocessor.h index de0051e18..834e3d66c 100644 --- a/plugins/channelrx/demodm17/m17demodprocessor.h +++ b/plugins/channelrx/demodm17/m17demodprocessor.h @@ -93,12 +93,12 @@ public: private: std::vector m_currentPacket; size_t m_packetFrameCounter; - mobilinkd::PRBS9 m_prbs; + modemm17::PRBS9 m_prbs; bool m_displayLSF; bool m_noiseBlanker; struct CODEC2 *m_codec2; static M17DemodProcessor *m_this; - mobilinkd::M17Demodulator m_demod; + modemm17::M17Demodulator m_demod; AudioFifo *m_audioFifo; bool m_audioMute; AudioVector m_audioBuffer; @@ -134,7 +134,7 @@ private: 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( bool dcd, float evm, @@ -147,13 +147,13 @@ private: int clock_index, int viterbi_cost ); - bool decode_lsf(mobilinkd::M17FrameDecoder::lsf_buffer_t const& lsf); - bool decode_lich(mobilinkd::M17FrameDecoder::lich_buffer_t const& lich); - bool decode_packet(mobilinkd::M17FrameDecoder::packet_buffer_t const& packet_segment); - bool decode_bert(mobilinkd::M17FrameDecoder::bert_buffer_t const& bert); - bool demodulate_audio(mobilinkd::M17FrameDecoder::audio_buffer_t const& audio, int viterbi_cost); + bool decode_lsf(modemm17::M17FrameDecoder::lsf_buffer_t const& lsf); + bool decode_lich(modemm17::M17FrameDecoder::lich_buffer_t const& lich); + bool decode_packet(modemm17::M17FrameDecoder::packet_buffer_t const& packet_segment); + bool decode_bert(modemm17::M17FrameDecoder::bert_buffer_t const& bert); + bool demodulate_audio(modemm17::M17FrameDecoder::audio_buffer_t const& audio, int viterbi_cost); void decode_type(uint16_t type); - void append_packet(std::vector& result, mobilinkd::M17FrameDecoder::lsf_buffer_t in); + void append_packet(std::vector& result, modemm17::M17FrameDecoder::lsf_buffer_t in); void processAudio(const std::array& in); void upsample(int upsampling, const int16_t *in, int nbSamplesIn); diff --git a/plugins/channeltx/modm17/m17modprocessor.cpp b/plugins/channeltx/modm17/m17modprocessor.cpp index 8f3f9110b..8d9b6c248 100644 --- a/plugins/channeltx/modm17/m17modprocessor.cpp +++ b/plugins/channeltx/modm17/m17modprocessor.cpp @@ -166,28 +166,28 @@ void M17ModProcessor::processPacket(const QString& sourceCall, const QString& de // LSF std::array lsf; - std::array lsf_frame = mobilinkd::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can); - output_baseband(mobilinkd::M17Modulator::LSF_SYNC_WORD, lsf_frame); + std::array lsf_frame = modemm17::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can); + output_baseband(modemm17::M17Modulator::LSF_SYNC_WORD, lsf_frame); // Packets int remainderCount = packetBytes.size(); int packetCount = 0; std::array packet_frame; - // std::copy(mobilinkd::M17Modulator::DATA_SYNC_WORD.begin(), mobilinkd::M17Modulator::DATA_SYNC_WORD.end(), fullframe_symbols.begin()); - mobilinkd::M17Modulator::packet_t packet; + // std::copy(modemm17::M17Modulator::DATA_SYNC_WORD.begin(), modemm17::M17Modulator::DATA_SYNC_WORD.end(), fullframe_symbols.begin()); + modemm17::M17Modulator::packet_t packet; while (remainderCount > 25) { std::copy(packetBytes.begin() + (packetCount*25), packetBytes.begin() + ((packetCount+1)*25), packet.begin()); 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; packetCount++; } std::copy(packetBytes.begin() + (packetCount*25), packetBytes.begin() + (packetCount*25) + remainderCount, packet.begin()); 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); send_eot(); // EOT @@ -205,15 +205,15 @@ void M17ModProcessor::audioStart(const QString& sourceCall, const QString& destC // LSF std::array lsf; - std::array lsf_frame = mobilinkd::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can, true); - output_baseband(mobilinkd::M17Modulator::LSF_SYNC_WORD, lsf_frame); + std::array lsf_frame = modemm17::M17Modulator::make_lsf(lsf, sourceCall.toStdString(), destCall.toStdString(), can, true); + output_baseband(modemm17::M17Modulator::LSF_SYNC_WORD, lsf_frame); // Prepare LICH for (size_t i = 0; i < m_lich.size(); ++i) { std::array segment; 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()); } } @@ -236,7 +236,7 @@ void M17ModProcessor::send_preamble() // Preamble is simple... bytes -> symbols -> baseband. std::array preamble_bytes; preamble_bytes.fill(0x77); - std::array preamble_symbols = mobilinkd::M17Modulator::bytes_to_symbols(preamble_bytes); + std::array preamble_symbols = modemm17::M17Modulator::bytes_to_symbols(preamble_bytes); std::array preamble_baseband = m_m17Modulator.symbols_to_baseband(preamble_symbols); m_basebandFifo.write(preamble_baseband.data(), 1920); } @@ -244,7 +244,7 @@ void M17ModProcessor::send_preamble() void M17ModProcessor::processAudioFrame() { std::array audioPayload = encodeAudio(m_audioFrame); - std::array audioDataBits = mobilinkd::M17Modulator::make_stream_data_frame(m_audioFrameNumber++, audioPayload); + std::array audioDataBits = modemm17::M17Modulator::make_stream_data_frame(m_audioFrameNumber++, audioPayload); if (m_audioFrameNumber == 0x8000) { m_audioFrameNumber = 0; @@ -259,16 +259,16 @@ void M17ModProcessor::processAudioFrame() std::array temp; auto it = std::copy(lich.begin(), lich.end(), temp.begin()); 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() { - std::array temp = mobilinkd::M17Modulator::make_bert_frame(m_prbs); - mobilinkd::M17Modulator::interleave_and_randomize(temp); - output_baseband(mobilinkd::M17Modulator::BERT_SYNC_WORD, temp); + std::array temp = modemm17::M17Modulator::make_bert_frame(m_prbs); + modemm17::M17Modulator::interleave_and_randomize(temp); + output_baseband(modemm17::M17Modulator::BERT_SYNC_WORD, temp); } std::array M17ModProcessor::encodeAudio(std::array& audioFrame) @@ -290,15 +290,15 @@ void M17ModProcessor::send_eot() std::copy(EOT_SYNC.begin(), EOT_SYNC.end(), eot_bytes.begin() + i); } - std::array eot_symbols = mobilinkd::M17Modulator::bytes_to_symbols(eot_bytes); + std::array eot_symbols = modemm17::M17Modulator::bytes_to_symbols(eot_bytes); std::array eot_baseband = m_m17Modulator.symbols_to_baseband(eot_symbols); m_basebandFifo.write(eot_baseband.data(), 1920); } void M17ModProcessor::output_baseband(std::array sync_word, const std::array& frame) { - std::array symbols = mobilinkd::M17Modulator::bits_to_symbols(frame); // 368 bits -> 184 dibit symbols - std::array sw = mobilinkd::M17Modulator::bytes_to_symbols(sync_word); // 16 bits -> 8 dibit symbols + std::array symbols = modemm17::M17Modulator::bits_to_symbols(frame); // 368 bits -> 184 dibit symbols + std::array sw = modemm17::M17Modulator::bytes_to_symbols(sync_word); // 16 bits -> 8 dibit symbols std::array temp; // 384 = 368 + 16 bits -> 192 dibit symbols auto fit = std::copy(sw.begin(), sw.end(), temp.begin()); // start with sync word dibits diff --git a/plugins/channeltx/modm17/m17modprocessor.h b/plugins/channeltx/modm17/m17modprocessor.h index e0e153366..130887bfd 100644 --- a/plugins/channeltx/modm17/m17modprocessor.h +++ b/plugins/channeltx/modm17/m17modprocessor.h @@ -241,14 +241,14 @@ private: int m_basebandFifoHigh; int m_basebandFifoLow; M17ModDecimator m_decimator; //!< 48k -> 8k decimator - mobilinkd::M17Modulator m_m17Modulator; - std::array m_lich; //!< LICH bits + modemm17::M17Modulator m_m17Modulator; + std::array m_lich; //!< LICH bits int m_lichSegmentIndex; std::array m_audioFrame; int m_audioFrameIndex; uint16_t m_audioFrameNumber; struct CODEC2 *m_codec2; - mobilinkd::PRBS9 m_prbs; + modemm17::PRBS9 m_prbs; bool m_insertPositionToggle; bool handleMessage(const Message& cmd);