diff --git a/paker.hpp b/paker.hpp index 1c91d53..df7f98d 100644 --- a/paker.hpp +++ b/paker.hpp @@ -236,59 +236,25 @@ namespace Protocol {'l', 18, "ABCDEFGHIJKLMNOPQR"}, {'U', 10, "0123456789"}, {'P', 28, "ABCDEFGHIJKLMNOPQRSTUVWXYZab"}, - {'s', 3, "01Q"}, // seq for wspr + }; + + static constexpr auto WsprElmCnt = 8; + static constexpr TFormatElement WsprFormatElements[WsprElmCnt] = + { + {'0', 1, " "}, // nothing + {'S', 1, "01Q"}, // sequence number + {'x', 26, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}, + {'X', 36, "ABCDEFGHIJKLMNOPRSTQUWXYVZ0123456789"}, + {'l', 18, "ABCDEFGHIJKLMNOPQR"}, + {'U', 10, "0123456789"}, + {'P', 28, "ABCDEFGHIJKLMNOPQRSTUVWXYZab"}, }; }; template - using CFormatWithDefaultElements = CFormat; - - // class CFT4PacketFactory - // { - // static constexpr char FT4FormatStr[] = "CQ 4NSxxxxxxx"; - - // public: - // static constexpr auto MaxFt4Subframes = 8; - // using TFT4Format = CFormatWithDefaultElements; - // using CFT4Encoder = TEncoder; - // char C8Frames[MaxFt4Subframes][TFT4Format::GetLen() + 1]; - // CFT4Encoder FT4Encoder; - - // unsigned char u8EncodedFrames = 0; - // CFT4PacketFactory() : FT4Encoder(C8Frames){}; - - // const char *GetPacket(unsigned int u32Idx) - // { - // if (u32Idx >= MaxFt4Subframes) - // return "NOT VALID"; - - // return C8Frames[u32Idx]; - // } - - // bool AppendWsFrame(const char *p8WsFrame) - // { - // auto const SeqIdx = TFT4Format::GetSeqNrIdx(); - // if (strlen(p8WsFrame) != TFT4Format::GetLen() || - // p8WsFrame[SeqIdx] < '0' || p8WsFrame[SeqIdx] > '9') - // return false; - - // auto const FrameNr = p8WsFrame[SeqIdx] - '0'; - - // memcpy(C8Frames[FrameNr], p8WsFrame, TFT4Format::GetLen()); - // return true; - // } - - // unsigned int EncodeRaw(unsigned char *p8Data, unsigned int u32BitLen) - // { - // u8EncodedFrames = FT4Encoder.EncodeBigEndian(p8Data, u32BitLen); - // return u8EncodedFrames; - // } - - // unsigned int DecodeFrames(unsigned char u8FramesToDecode, unsigned char *pOutData, unsigned int u32OutBuffLen) - // { - // return FT4Encoder.DecodeBigEndian(u8FramesToDecode, pOutData, u32OutBuffLen); - // } - // }; + using CFormatWithDefaultElementsT = CFormat; + template + using CWsprFormatT = CFormat; template class CPacketFactoryT @@ -333,14 +299,14 @@ namespace Protocol return Encoder.DecodeBigEndian(u8FramesToDecode, pOutData, u32OutBuffLen); } }; - - template - using CPacketFactory = CPacketFactoryT, MaxElements>>; + + template class CFromatT, unsigned int MaxElements> + using CPacketFactory = CPacketFactoryT, MaxElements>>; static constexpr char Ft4FromatString[] = "CQ 4NSxxxxxxx"; - using CFT4PacketFactory = CPacketFactory; + using CFT4PacketFactory = CPacketFactory; static constexpr char WsprFormatString[] = "CQ SUUxxx llUU P"; - using CWsprPacketFactory = CPacketFactory; + using CWsprPacketFactory = CPacketFactory; } } diff --git a/utils/build/CMakeFiles/paker_test.dir/paker_test.cpp.o b/utils/build/CMakeFiles/paker_test.dir/paker_test.cpp.o index f5d9cba..c9c2b35 100644 Binary files a/utils/build/CMakeFiles/paker_test.dir/paker_test.cpp.o and b/utils/build/CMakeFiles/paker_test.dir/paker_test.cpp.o differ diff --git a/utils/build/paker_test b/utils/build/paker_test index 72a1976..720a425 100755 Binary files a/utils/build/paker_test and b/utils/build/paker_test differ