-
Notifications
You must be signed in to change notification settings - Fork 4
/
IL2PTX.h
63 lines (51 loc) · 1.76 KB
/
IL2PTX.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright (C) 2023 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(IL2PTX_H)
#define IL2PTX_H
#include "IL2PRS.h"
#include "AX25CRC.h"
#include "Hamming.h"
#include <cstdint>
class CIL2PTX {
public:
CIL2PTX();
uint16_t process(const uint8_t* in, uint16_t inLength, uint8_t* out);
private:
CIL2PRS m_rs2;
CIL2PRS m_rs4;
CIL2PRS m_rs6;
CIL2PRS m_rs8;
CIL2PRS m_rs16;
CAX25CRC m_crc;
CHamming m_hamming;
uint16_t m_payloadByteCount;
uint16_t m_payloadOffset;
uint8_t m_payloadBlockCount;
uint8_t m_smallBlockSize;
uint8_t m_largeBlockSize;
uint8_t m_largeBlockCount;
uint8_t m_smallBlockCount;
uint8_t m_paritySymbolsPerBlock;
bool isIL2PType1(const uint8_t* frame, uint16_t length) const;
void processType0Header(const uint8_t* in, uint16_t length, uint8_t* out);
void processType1Header(const uint8_t* in, uint16_t length, uint8_t* out);
void calculatePayloadBlockSize();
void scramble(uint8_t* buffer, uint16_t length) const;
uint8_t encode(uint8_t* buffer, uint16_t length, uint8_t numSymbols) const;
};
#endif