root/experimental/components/Demodulator/src/DemodulatorDSP.h @ 3997

Revision 3997, 2.9 KB (checked in by jgaeddert, 6 years ago)

adding signal amplitude correction method to Demodulator component; needs testing

  • Property svn:eol-style set to native
Line 
1/****************************************************************************
2
3Copyright 2007 Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE Demodulator.
6
7OSSIE Demodulator is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12OSSIE Demodulator is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OSSIE Demodulator; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23
24#ifndef __DEMODULATORDSP_IMPL_H__
25#define __DEMODULATORDSP_IMPL_H__
26
27#include <stdlib.h>
28#include "sigproc/SigProc.h"
29
30#define BIT0 0
31#define BIT1 1
32
33#define TARGET_SIGNAL_ENERGY 10000
34
35/// Modulation scheme
36enum ModulationScheme {
37    MOD_BPSK,
38    MOD_QPSK,
39    MOD_8PSK,
40    MOD_16QAM,
41    MOD_4PAM,
42    MOD_DBPSK,
43    MOD_DQPSK,
44    MOD_D8PSK
45};
46
47/** \brief
48 *
49 *
50 */
51class DemodulatorDSP
52{
53  public:
54    /// Initializing constructor
55    DemodulatorDSP();
56
57    /// Destructor
58    ~DemodulatorDSP();
59
60    /// Set modulation scheme
61    void SetModulationScheme(ModulationScheme _ms);
62
63    /// Demodulates sequence of symbols
64    void DemodulateSequence(
65        short * I_in,
66        short * Q_in,
67        unsigned int N_in,
68        char * bits_out);
69
70  protected:
71    /// Demodulation function pointer
72    void (*Demodulate) (
73        short & I_in,
74        short & Q_in,
75        char * bits_out);
76
77    ///
78    ///\todo check amplitude correction method
79    void ScaleSignalAmplitude(
80        short * I_in,
81        short * Q_in,
82        unsigned int N_in,
83        unsigned int targetEnergy);
84
85    unsigned int bitsPerSymbol;     ///< Number of bits represented by each symbol
86    short state_i;                  ///< In-phase state for differential mode
87    short state_q;                  ///< Quadrature state for differential mode
88    ModulationScheme mod_scheme;    ///< Current (de)modulation scheme
89    bool differentialMode;          ///< Differential PSK mode flag
90
91  private:
92    /// Disallow copy constructor
93    DemodulatorDSP(DemodulatorDSP&);
94
95};
96
97#endif
98
99///
100void DemodulateBPSK(
101    short & I_in,
102    short & Q_in,
103    char * bits_out);
104
105///
106void DemodulateQPSK(
107    short & I_in,
108    short & Q_in,
109    char * bits_out);
110
111///
112void Demodulate8PSK(
113    short & I_in,
114    short & Q_in,
115    char * bits_out);
116
117///
118void Demodulate16QAM(
119    short & I_in,
120    short & Q_in,
121    char * bits_out);
122
123///
124void Demodulate4PAM(
125    short & I_in,
126    short & Q_in,
127    char * bits_out);
128
Note: See TracBrowser for help on using the browser.