nidas v1.2.3
DSMArincSensor.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 ** 2004, 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#ifndef NIDAS_DYNLD_RAF_DSMARINCSENSOR_H
27#define NIDAS_DYNLD_RAF_DSMARINCSENSOR_H
28
34
35// Significant bits masks
36//
37// 32|31 30|29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11|10 9| 8 7 6 5 4 3 2 1
38// --+-----+--------------------------------------------------------+-----+-----------------------
39// P | SSM | | SDI | 8-bit label
40
41// bitmask for the Sign Status Matrix
42#define SSM 0x60000000
43#define NCD 0x20000000
44#define TST 0x40000000
45
46#define NLABELS 256
47
48namespace nidas { namespace dynld { namespace raf {
49
50using namespace nidas::core;
51
52// inHg to mBar
53const float INHG_MBAR = 33.8639;
54
55// NM to meter.
56const float NM_MTR = 1.0 / 1852.0;
57
58// ft to meter.
59const float FT_MTR = 0.3048;
60
61// G to m/s2 (ACINS).
62const float G_MPS2 = 9.7959;
63
64// knot to m/s
65const float KTS_MS = 0.514791;
66
67// ft/min to m/s (VSPD)
68const float FPM_MPS = 0.00508;
69
70// radian to degree.
71const float RAD_DEG = 180.0 / 3.14159265358979;
72
73
79public:
80 bool operator() (const SampleTag* x, const SampleTag* y) const {
81 if ( x->getRate() > y->getRate() ) return true;
82 if ( x->getRate() < y->getRate() ) return false;
83 if ( x->getId() < y->getId() ) return true;
84 return false;
85 }
86};
87
92{
93
94public:
95
102
107
112
119 void open(int flags);
120
126 void close();
127
133 void init();
134
139 bool process(const Sample*, std::list<const Sample*>& result);
140
141 virtual bool processAlta(const dsm_time_t, unsigned char *, int, std::list<const Sample*> &result);
142
144 void printStatus(std::ostream& ostr);
145
149 virtual double processLabel(const int data, sampleType* stype) = 0;
150
161 void fromDOMElement(const xercesc::DOMElement*);
162
164 {
165 return USECS_PER_MSEC;
166 }
167
168 unsigned int Speed() { return _speed; }
169
170
171protected:
176
180
182
183private:
184
186 unsigned int _speed;
187 unsigned int _parity;
188
189 std::map<dsm_sample_id_t,VariableConverter*> _converters;
190
191 std::map<dsm_sample_id_t, TimetagAdjuster*> _ttadjusters;
192
193};
194
195// typedef SampleT<unsigned int> ArincSample;
196
197}}} // namespace nidas namespace dynld namespace raf
198
199#endif
#define NLABELS
Definition DSMArincSensor.h:46
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition DSMSensor.h:88
An interface to an IO device.
Definition IODevice.h:42
A scanner of sample data.
Definition SampleScanner.h:74
Class describing a group of variables that are sampled and handled together.
Definition SampleTag.h:88
Interface to a data sample.
Definition Sample.h:190
A sensor connected to an ARINC port.
Definition DSMArincSensor.h:92
void printStatus(std::ostream &ostr)
Display some status information gathered by the driver.
Definition DSMArincSensor.cc:466
bool process(const Sample *, std::list< const Sample * > &result)
Process a raw sample, which in this case means create a list of samples with each sample containing a...
Definition DSMArincSensor.cc:251
unsigned int Speed()
Definition DSMArincSensor.h:168
IODevice * buildIODevice()
Definition DSMArincSensor.cc:107
int _processed[NLABELS]
A list of which samples are processed.
Definition DSMArincSensor.h:178
void close()
This closes the associated device.
Definition DSMArincSensor.cc:165
void init()
Perform any initialization necessary for process method.
Definition DSMArincSensor.cc:173
virtual bool processAlta(const dsm_time_t, unsigned char *, int, std::list< const Sample * > &result)
Definition DSMArincSensor.cc:357
void registerWithUDPArincSensor()
If this is the Alta UDP setup, then register with that sensor.
Definition DSMArincSensor.cc:222
std::map< dsm_sample_id_t, TimetagAdjuster * > _ttadjusters
Definition DSMArincSensor.h:191
std::map< dsm_sample_id_t, VariableConverter * > _converters
Definition DSMArincSensor.h:189
void fromDOMElement(const xercesc::DOMElement *)
Extract the ARINC configuration elements from the XML header.
Definition DSMArincSensor.cc:495
unsigned int _speed
channel configuration
Definition DSMArincSensor.h:186
void open(int flags)
This opens the associated device.
Definition DSMArincSensor.cc:118
int getInt32TimeTagUsecs() const
Definition DSMArincSensor.h:163
bool _altaEnetDevice
Definition DSMArincSensor.h:181
virtual double processLabel(const int data, sampleType *stype)=0
This contains a switch case for processing all labels.
unsigned int _parity
Definition DSMArincSensor.h:187
SampleScanner * buildSampleScanner()
Definition DSMArincSensor.cc:113
DSMArincSensor()
No arg constructor.
Definition DSMArincSensor.cc:74
int _observedLabelCnt[NLABELS]
Definition DSMArincSensor.h:179
~DSMArincSensor()
Definition DSMArincSensor.cc:85
This is sorts a list of Sample tags by rate (highest first) then by label.
Definition DSMArincSensor.h:78
bool operator()(const SampleTag *x, const SampleTag *y) const
Definition DSMArincSensor.h:80
The essential core classes of nidas.
Definition A2DConverter.h:31
sampleType
Definition sample_type_traits.h:30
long long dsm_time_t
Posix time in microseconds, the number of non-leap microseconds since 1970 Jan 1 00:00 UTC.
Definition Sample.h:62
const float INHG_MBAR
Definition DSMArincSensor.h:53
const float FT_MTR
Definition DSMArincSensor.h:59
const float RAD_DEG
Definition DSMArincSensor.h:71
const float NM_MTR
Definition DSMArincSensor.h:56
const float G_MPS2
Definition DSMArincSensor.h:62
const float KTS_MS
Definition DSMArincSensor.h:65
const float FPM_MPS
Definition DSMArincSensor.h:68
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
#define USECS_PER_MSEC
Definition types.h:115