/////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2024 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation as version 3 of the License, or // // (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License V3 for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// #include "chirpchatmodencoderft.h" #ifndef HAS_FT8 void ChirpChatModEncoderFT::encodeMsg( const QString& myCall, const QString& urCall, const QString& myLocator, const QString& myReport, const QString& textMessage, ChirpChatModSettings::MessageType messageType, unsigned int nbSymbolBits, std::vector& symbols ) { qDebug("ChirpChatModEncoderFT::encodeMsg: not implemented"); } #else #include "ft8.h" #include "packing.h" void ChirpChatModEncoderFT::encodeMsg( const QString& myCall, const QString& urCall, const QString& myLocator, const QString& myReport, const QString& textMessage, ChirpChatModSettings::MessageType messageType, unsigned int nbSymbolBits, std::vector& symbols ) { int a174[174]; // FT payload is 174 bits if (messageType == ChirpChatModSettings::MessageNone) { return; // do nothing } else if (messageType == ChirpChatModSettings::MessageBeacon) { encodeMsgBeaconOrCQ(myCall, myLocator, "DE", a174); } else if (messageType == ChirpChatModSettings::MessageCQ) { encodeMsgBeaconOrCQ(myCall, myLocator, "CQ", a174); } else if (messageType == ChirpChatModSettings::MessageReply) { encodeMsgReply(myCall, urCall, myLocator, a174); } else if (messageType == ChirpChatModSettings::MessageReport) { encodeMsgReport(myCall, urCall, myReport, 0, a174); } else if (messageType == ChirpChatModSettings::MessageReplyReport) { encodeMsgReport(myCall, urCall, myReport, 1, a174); } else if (messageType == ChirpChatModSettings::MessageRRR) { encodeMsgReport(myCall, urCall, "RRR", 1, a174); } else if (messageType == ChirpChatModSettings::Message73) { encodeMsgReport(myCall, urCall, "73", 1, a174); } else { encodeTextMsg(textMessage, a174); } int allBits = ((174 / nbSymbolBits) + (174 % nbSymbolBits == 0 ? 0 : 1))*nbSymbolBits; // ensures zero bits padding int iBit; int symbol = 0; for (int i = 0; i < allBits; i++) { iBit = nbSymbolBits - (i % nbSymbolBits) - 1; // MSB first if (i < 174) { symbol += a174[i] * (1<