-
Notifications
You must be signed in to change notification settings - Fork 7
/
DMRTrellis.h
33 lines (29 loc) · 1.32 KB
/
DMRTrellis.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
/*
* Copyright (C) 2016 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; version 2 of the License.
*
* 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.
*/
#pragma once
class CDMRTrellis {
public:
CDMRTrellis();
~CDMRTrellis();
bool decode(const unsigned char* data, unsigned char* payload);
void encode(const unsigned char* payload, unsigned char* data);
private:
void deinterleave(const unsigned char* in, signed char* dibits) const;
void interleave(const signed char* dibits, unsigned char* out) const;
void dibitsToPoints(const signed char* dibits, unsigned char* points) const;
void pointsToDibits(const unsigned char* points, signed char* dibits) const;
void bitsToTribits(const unsigned char* payload, unsigned char* tribits) const;
void tribitsToBits(const unsigned char* tribits, unsigned char* payload) const;
bool fixCode(unsigned char* points, unsigned int failPos, unsigned char* payload) const;
unsigned int checkCode(const unsigned char* points, unsigned char* tribits) const;
};