~ubuntu-branches/ubuntu/quantal/linpsk/quantal

« back to all changes in this revision

Viewing changes to linpsk/cpskdemodulator.h

  • Committer: Bazaar Package Importer
  • Author(s): Bruce Walker
  • Date: 2002-02-06 11:43:38 UTC
  • Revision ID: james.westby@ubuntu.com-20020206114338-xqmjmhh01lpjm0g4
Tags: upstream-0.6.2
ImportĀ upstreamĀ versionĀ 0.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          cpskdemodulator.h  -  description
 
3
                             -------------------
 
4
    begin                : Sat Jun 2 2001
 
5
    copyright            : (C) 2001 by Volker Schroer
 
6
    email                : dl1ksv@gmx.de
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *   based on the work of Moe Wheatley, AE4JY                              *
 
16
 ***************************************************************************/
 
17
 
 
18
 
 
19
#ifndef CPSKDEMODULATOR_H
 
20
#define CPSKDEMODULATOR_H
 
21
 
 
22
#include "constants.h"
 
23
#include <math.h>
 
24
#include <complex.h>
 
25
#include <stdlib.h>
 
26
 
 
27
 
 
28
#include "crxdisplay.h"
 
29
#include "cdemodulator.h"
 
30
 
 
31
 
 
32
class CPskDemodulator  : public CDemodulator
 
33
{
 
34
 Q_OBJECT
 
35
public:
 
36
        CPskDemodulator();
 
37
        virtual ~CPskDemodulator();
 
38
        bool Init(double Fs ,int BlockSize);
 
39
 
 
40
        void ProcessInput( double *pIn);
 
41
// Variables
 
42
#ifdef AFC_DEBUG        
 
43
        double m_FreqError;
 
44
        double m_QFreqError;
 
45
#endif
 
46
 
 
47
        
 
48
protected:
 
49
 
 
50
// Methods
 
51
/** Decodes the symbol depending on the PskModes */     
 
52
        virtual void DecodeSymbol( double_complex newsamp) = 0;
 
53
/** Calculates the Cuality of the signal -- depends on the mode */      
 
54
        virtual void CalcQuality( double angle ) = 0;   
 
55
        
 
56
// Variables            
 
57
        double m_I0;            // 2 stage I/Q delay line variables
 
58
        double m_I1;
 
59
        double m_Q0;
 
60
        double m_Q1;
 
61
        int m_BitAcc;
 
62
        bool m_LastBitZero;
 
63
        unsigned char* m_VaricodeDecTbl;
 
64
        int m_OnCount;
 
65
        int m_OffCount; 
 
66
#ifndef AFC_DEBUG
 
67
        double m_FreqError;
 
68
        double m_QFreqError;
 
69
#endif  
 
70
        double m_DevAve;
 
71
        double ferror,dp;       
 
72
private:
 
73
        int m_ClkErrTimer;
 
74
        int m_ClkErrCounter;
 
75
        int m_ClkError;
 
76
 
 
77
//methods
 
78
 
 
79
 
 
80
        bool SymbSync(double_complex sample);
 
81
        void CalcBitFilter(  double_complex Samp);
 
82
        double CalcAGC( double_complex Samp );
 
83
        double CalcFreqError( double_complex IQ );
 
84
//variables
 
85
        double m_QPSKprob[4];
 
86
        int m_LastPkPos;
 
87
 
 
88
///     int m_TrigInhib;
 
89
        int m_SampCnt;
 
90
        bool m_DispTrig;
 
91
 
 
92
        int m_BlockSize;
 
93
        double m_BitPhaseInc;
 
94
        double m_BitPhasePos;
 
95
        double m_SyncAve[21];
 
96
 
 
97
        double m_SignalLevel;
 
98
        double m_Fs;
 
99
 
 
100
        double_complex* m_pQue1;
 
101
        double_complex* m_pQue2;
 
102
        double_complex* m_pQue3;
 
103
        double_complex* m_pInPtr1;
 
104
        double_complex* m_pInPtr2;
 
105
        double_complex* m_pInPtr3;
 
106
 
 
107
        double_complex m_FreqSignal;
 
108
        double_complex m_BitSignal;
 
109
        double m_phzinc;
 
110
 
 
111
// Local variables for various functions that need to be saved between calls
 
112
        double m_AGCave;
 
113
        double_complex m_z1; //Old Version of Freqerror
 
114
        double_complex m_z2; // dito
 
115
        double m_FerAve;
 
116
        double m_LastFreq;
 
117
        double m_VcoPhz;
 
118
        int     m_PkPos;
 
119
        int     m_NewPkPos;
 
120
        int m_BitPos;
 
121
  double max;   
 
122
/** Some Variable for CalcQuality */
 
123
double fe1,fe2,ferror1,ferror2;
 
124
double dp1,dp2;
 
125
 
 
126
 
 
127
public slots:
 
128
signals: // Signals
 
129
  /** emits this signal if the user changed the cursor
 
130
and with it the desired RX- Frequency */
 
131
//  void rxFrequencyChanged(double);
 
132
//      void newSymbol(char );
 
133
//      void newPhaseValue(int,float_complex);
 
134
//      void setFastSquelch(bool);
 
135
//      void setSquelchValue(int);
 
136
};
 
137
 
 
138
#endif