Updated FSF address in all files. Fixes ticket:51
[debian/gnuradio] / ezdop / src / host / hunter / src / sample.h
1 /*
2  Copyright 2006 Johnathan Corgan.
3  
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License version 2
6  as published by the Free Software Foundation.
7  
8  This software is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  GNU General Public License for more details.
12  
13  You should have received a copy of the GNU General Public License
14  along with GNU Radio; see the file COPYING.  If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street,
16  Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef __SAMPLE_H__
20 #define __SAMPLE_H__
21
22 // Application level includes
23 #include "spherical.h"
24
25 // wxWidgets includes
26 #include <wx/string.h>
27
28 // System level includes
29 #include <ctime>
30
31 class Sample
32 {
33 public:
34     Sample();
35     Sample(const Sample &sample);
36     Sample(wxString &line);
37
38     void Time(time_t time)             { m_time = time; }
39     void Valid(bool valid)             { m_valid = valid; }
40     void Location(Spherical &location) { m_location = location; }
41     void Heading(float heading)        { m_heading = heading; }
42     void Speed(float speed)            { m_speed = speed; }
43     void InPhase(float in_phase)       { m_in_phase = in_phase; }
44     void Quadrature(float quadrature)  { m_quadrature = quadrature; }
45     void Phase(float phase)            { m_phase = phase; }
46     void Strength(float strength)      { m_strength = strength; }
47     void Volume(float volume)          { m_volume = volume; }
48     void Rate(int rate)                { m_rate = rate; }
49     void Filtering(int filtering)      { m_filtering = filtering; }
50     void Error(float error)            { m_error = error; }
51     void IError(float error)           { m_ierror = error; }
52     void QError(float error)           { m_qerror = error; }
53                 
54     const Spherical &Location() const { return m_location; }
55     float Latitude() const { return m_location.Latitude(); }
56     float Longitude() const { return m_location.Longitude(); }
57     float Heading() const { return m_heading; } 
58     float Speed() const { return m_speed; }
59     float InPhase() const { return m_in_phase; }
60     float Quadrature() const { return m_quadrature; }
61     float Phase() const { return m_phase; }
62     float Strength() const { return m_strength; }
63     float Volume() const { return m_volume; }
64     int   Filtering() const { return m_filtering; }
65     float Error() const { return m_error; }
66     float IError() const { return m_ierror; }
67     float QError() const { return m_qerror; }
68     bool  Valid() const { return m_valid; }
69     
70     void CalcError(const Spherical &location, float &error, float &ierror, float &qerror) const;
71     
72     void Dump(char *str, int len); // TEMPORARY
73     
74     operator const std::string();    // Conversion operator to std::string
75             
76 private:
77     // Data supplied by measuring system
78     time_t    m_time;           // Unix time of observation
79     bool      m_valid;          // GPS validity indication (NMEA "I" or "V")
80     Spherical m_location;       // GPS latitude and longitude
81     float     m_heading;        // GPS heading in degrees 0.0 - 360.0
82     float     m_speed;          // GPS speed in mph
83     float     m_in_phase;       // Doppler I channel -1.0 to 1.0
84     float     m_quadrature;     // Doppler Q channel -1.0 to 1.0
85     float     m_phase;          // Doppler phase -M_PI to M_PI (derived)
86     float     m_strength;       // Doppler strength 0.0 - 1.0 (derived)
87     float     m_volume;         // Doppler volume 0.0 - 1.0
88     int       m_rate;           // Doppler rotation rate 0 - 5
89     int       m_filtering;      // Doppler filtering 1 - 100
90
91     // Container configured
92     float     m_error;          // Known transmitter bearing error
93     float     m_ierror;         // Known transmitter in phase error
94     float     m_qerror;         // Known transmitter quadrature error
95 };
96
97 #endif