nidas v1.2.3
DerivedDataReader.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2007, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#ifndef _nidas_core_DerivedDataReader_h_
28#define _nidas_core_DerivedDataReader_h_
29
32#include <nidas/util/Thread.h>
33
34#include <vector>
35
36namespace nidas { namespace core {
37
38class DerivedDataClient;
39
45{
46public:
47
48 float getTrueAirspeed() const { return _tas; }
49 float getAmbientTemperature() const { return _at; }
50 float getStaticPressure() const { return _ps; }
51 float getLatitude() const { return _lat; }
52 float getLongitude() const { return _lon; }
53 float getAltitude() const { return _alt; }
54 float getRadarAltitude() const { return _radarAlt; }
55 float getTrueHeading() const { return _thdg; }
56 float getGroundSpeed() const { return _grndSpd; }
57
58 int run();
59
64 void addClient(DerivedDataClient * ddc);
65
67
72
77 static void deleteInstance();
78
83
84 void interrupt();
85
86private:
87
96
98
99 void notifyClients();
100
102
104
106
107 std::list<DerivedDataClient*> _clients;
108
110
117 int parseIWGADTS(const char *);
118
119 float _tas; // True Airspeed. Meters per second
120 float _at; // Ambient Temperature. deg_C
121 float _ps; // Static Pressure. hPa
122 float _lat; // Latitude, deg north
123 float _lon; // Longitude, deg east
124 float _alt; // Altitude (probably GPS). Meters
125 float _radarAlt; // Distance above surface/ground. Meters
126 float _thdg; // True Heading. degrees_true
127 float _grndSpd; // Ground Speed. meters per second.
128
131
132 struct IWG1_Field {
133 IWG1_Field(int n,float* p): nf(n),fp(p) {}
134 int nf; // which field in the IWG1 string, after the "IWG1,timetag,"
135 float *fp; // pointer to the data
136 };
137
138 std::vector<IWG1_Field> _fields;
139
142
145
146};
147
148}} // namespace nidas namespace core
149
150#endif
151
Interface of a DerivedDataClient of the DerivedDataReader.
Definition DerivedDataClient.h:37
This class will read, parse and make available the parameters in the onboard real-time broadcast of d...
Definition DerivedDataReader.h:45
float _radarAlt
Definition DerivedDataReader.h:125
float getStaticPressure() const
Definition DerivedDataReader.h:50
DerivedDataReader(const DerivedDataReader &)
No copying.
float _lat
Definition DerivedDataReader.h:122
void interrupt()
Interrupt this thread.
Definition DerivedDataReader.cc:86
static DerivedDataReader * getInstance()
Fetch the pointer to the instance of DerivedDataReader.
Definition DerivedDataReader.cc:266
std::list< DerivedDataClient * > _clients
Definition DerivedDataReader.h:107
void addClient(DerivedDataClient *ddc)
Add a client to DerivedDataReader.
Definition DerivedDataReader.cc:271
float getGroundSpeed() const
Definition DerivedDataReader.h:56
float _ps
Definition DerivedDataReader.h:121
static nidas::util::Mutex _instanceMutex
Definition DerivedDataReader.h:103
static DerivedDataReader * _instance
Definition DerivedDataReader.h:101
float getLatitude() const
Definition DerivedDataReader.h:51
float getLongitude() const
Definition DerivedDataReader.h:52
float getTrueHeading() const
Definition DerivedDataReader.h:55
float getRadarAltitude() const
Definition DerivedDataReader.h:54
float getTrueAirspeed() const
Definition DerivedDataReader.h:48
~DerivedDataReader()
Definition DerivedDataReader.cc:81
nidas::util::Mutex _clientMutex
Definition DerivedDataReader.h:105
float _thdg
Definition DerivedDataReader.h:126
void removeClient(DerivedDataClient *ddc)
Definition DerivedDataReader.cc:280
float _alt
Definition DerivedDataReader.h:124
void notifyClients()
Definition DerivedDataReader.cc:290
float getAltitude() const
Definition DerivedDataReader.h:53
std::vector< IWG1_Field > _fields
Definition DerivedDataReader.h:138
int parseIWGADTS(const char *)
Parse the IWGADTS trivial broadcast.
Definition DerivedDataReader.cc:194
float _grndSpd
Definition DerivedDataReader.h:127
int run()
The method which will run in its own thread.
Definition DerivedDataReader.cc:96
float _lon
Definition DerivedDataReader.h:123
float _at
Definition DerivedDataReader.h:120
float getAmbientTemperature() const
Definition DerivedDataReader.h:49
int _parseErrors
Definition DerivedDataReader.h:129
float _tas
Definition DerivedDataReader.h:119
int _errorLogs
Definition DerivedDataReader.h:130
static void deleteInstance()
Delete the singleton instance of DerivedDataReader, shutting down the thread if is is running.
Definition DerivedDataReader.cc:246
DerivedDataReader & operator=(const DerivedDataReader &)
No assignment.
nidas::util::SocketAddress * _saddr
Definition DerivedDataReader.h:109
static DerivedDataReader * createInstance(const nidas::util::SocketAddress &)
Create the instance of DerivedDataReader.
Definition DerivedDataReader.cc:235
DerivedDataReader(const nidas::util::SocketAddress &)
Constructor.
Definition DerivedDataReader.cc:57
A C++ wrapper for a POSIX mutex.
Definition ThreadSupport.h:161
An interface for a socket address.
Definition SocketAddress.h:36
Definition Thread.h:83
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
Definition DerivedDataReader.h:132
int nf
Definition DerivedDataReader.h:134
IWG1_Field(int n, float *p)
Definition DerivedDataReader.h:133
float * fp
Definition DerivedDataReader.h:135