nidas  v1.2-1520
IRIGSensor.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  ** 2005, 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_IRIGSENSOR_H
27 #define NIDAS_DYNLD_RAF_IRIGSENSOR_H
28 
29 #include <nidas/linux/irigclock.h>
30 #include <nidas/core/DSMSensor.h>
33 
34 namespace nidas { namespace dynld { namespace raf {
35 
36 using namespace nidas::core;
37 
41 class IRIGSensor : public DSMSensor
42 {
43 
44 public:
45 
50  IRIGSensor();
51 
52  ~IRIGSensor();
53 
54  IODevice* buildIODevice() throw(nidas::util::IOException);
55 
56  SampleScanner* buildSampleScanner()
58 
62  void open(int flags) throw(nidas::util::IOException,
64 
68  void close() throw(nidas::util::IOException);
69 
74  dsm_time_t getIRIGTime() throw(nidas::util::IOException);
75 
79  void setIRIGTime(dsm_time_t val) throw(nidas::util::IOException);
80 
81  static std::string statusString(unsigned char status,bool xml=false);
82 
83  static std::string shortStatusString(unsigned char status,bool xml=false);
84 
85  void printStatus(std::ostream& ostr) throw();
86 
90  bool process(const Sample* samp,std::list<const Sample*>& result)
91  throw();
92 
93  void fromDOMElement(const xercesc::DOMElement*)
95 
99  static dsm_time_t getIRIGTime(const Sample* samp);
100 
106  static dsm_time_t getUnixTime(const Sample* samp);
107 
111  static const unsigned char* getStatusPtr(const Sample* samp);
112 
113  static float get100HzBacklog(const Sample* samp);
114 
116 private:
117 
118  void checkClock() throw(nidas::util::IOException);
119 
120  dsm_sample_id_t _sampleId;
121 
122  int _nvars;
123 
124  int _nStatusPrints;
125 
127 
128 };
129 
130 }}} // namespace nidas namespace dynld namespace raf
131 
132 #endif
Sensor class for controlling and recieving data from an IRIG clock.
Definition: IRIGSensor.h:41
#define IRIG_MAX_DT_DIFF
Limits for how many ticks the 100Hz software clock can disagree with the hardware clock before a rese...
Definition: irigclock.h:168
static const nidas::util::EndianConverter * lecvtr
Definition: IRIGSensor.h:115
unsigned int dsm_sample_id_t
Definition: Sample.h:63
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:61
Virtual base class declaring methods for converting numeric values between little-endian and big-endi...
Definition: EndianConverter.h:304
An interface to an IO device.
Definition: IODevice.h:41
Interface to a data sample.
Definition: Sample.h:189
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition: DSMSensor.h:87
Definition: IOException.h:37
A scanner of sample data.
Definition: SampleScanner.h:73
#define IRIG_MIN_DT_DIFF
Definition: irigclock.h:169
Definition: InvalidParameterException.h:35