-
Notifications
You must be signed in to change notification settings - Fork 70
/
nxdnencoder.h
64 lines (57 loc) · 1.81 KB
/
nxdnencoder.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
63
64
/*
Copyright (C) 2019 Doug McLain
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 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 for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef NXDNENCODER_H
#define NXDNENCODER_H
#include <inttypes.h>
class NXDNEncoder
{
public:
NXDNEncoder();
unsigned char * get_frame(unsigned char *ambe);
unsigned char * get_eot(){m_eot = true; return get_frame(nullptr);}
void set_hwtx(bool hw){m_hwtx = hw;}
void set_srcid(uint16_t src){m_srcid = src;}
void set_dstid(uint16_t dst){m_dstid = dst;}
private:
bool m_hwtx;
bool m_eot;
uint8_t m_nxdnframe[55];
uint32_t m_nxdncnt;
uint16_t m_srcid;
uint16_t m_dstid;
uint8_t m_lich;
uint8_t m_sacch[5];
uint8_t m_layer3[22];
uint8_t *m_ambe;
void encode_header();
void encode_data();
void set_lich_rfct(uint8_t);
void set_lich_fct(uint8_t);
void set_lich_option(uint8_t);
void set_lich_dir(uint8_t);
void set_sacch_ran(uint8_t);
void set_sacch_struct(uint8_t);
void set_sacch_data(const uint8_t *);
void set_layer3_msgtype(uint8_t);
void set_layer3_srcid(uint16_t);
void set_layer3_dstid(uint16_t);
void set_layer3_grp(bool);
void set_layer3_blks(uint8_t);
void layer3_encode(uint8_t*, uint8_t, uint8_t);
uint8_t get_lich();
void get_sacch(uint8_t *);
void encode_crc6(uint8_t *, uint8_t);
void deinterleave_ambe(uint8_t *);
};
#endif // NXDNENCODER_H