-
Notifications
You must be signed in to change notification settings - Fork 62
/
dsd_sync.h
74 lines (66 loc) · 2.67 KB
/
dsd_sync.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
65
66
67
68
69
70
71
72
73
74
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2020 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 //
// //
// 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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef DSD_SYNC_H_
#define DSD_SYNC_H_
#include "export.h"
namespace DSDcc
{
class DSDCC_API DSDSync
{
public:
enum SyncPattern
{
SyncDMRDataBS,
SyncDMRVoiceBS,
SyncDMRDataMS,
SyncDMRVoiceMS,
SyncDPMRFS1,
SyncDPMRFS4,
SyncDPMRFS2,
SyncDPMRFS3,
SyncNXDNRDCHFull,
SyncNXDNRDCHFullInv,
SyncNXDNRDCHFSW,
SyncNXDNRDCHFSWInv,
SyncDStarHeader,
SyncDStarHeaderInv,
SyncDStar,
SyncDStarInv,
SyncYSF,
SyncP25P1,
SyncP25P1Inv,
SyncX2TDMADataBS,
SyncX2TDMAVoiceBS,
SyncX2TDMADataMS,
SyncX2TDMAVoiceMS,
SyncProVoice,
SyncProVoiceInv,
SyncProVoiceEA,
SyncProVoiceEAInv
};
static const int m_history = 32;
static const int m_patterns = 27;
static const unsigned char m_syncPatterns[m_patterns][m_history]; //!< Patterns
static const unsigned int m_syncLenTol[m_patterns][2]; //!< Length (0) and tolerance (1)
unsigned int m_syncErrors[m_patterns];
static const unsigned char *getPattern(SyncPattern pattern, int& length);
void matchAll(const unsigned char *start);
void matchSome(const unsigned char *start, int maxHistory, const SyncPattern *patterns, int nbPatterns);
bool isMatching(SyncPattern pattern);
unsigned int getErrors(SyncPattern pattern);
};
} // namespace DSDcc
#endif // DSD_SYNC_H_