CARMA C++
DPS.h
1 #ifndef CARMA_ENVIRONMENT_DPS_H
2 #define CARMA_ENVIRONMENT_DPS_H
3 
4 /*
5  * Dew Point Sensor class
6  *
7  * @author: Ira W. Snyder
8  * @version: $Id: DPS.h,v 1.14 2011/05/04 20:31:42 iws Exp $
9  *
10  * $CarmaCopyright$
11  */
12 
13 #include <string>
14 
15 #include <carma/util/types.h>
16 #include <carma/util/PthreadMutex.h>
17 #include <carma/util/AutoPthreadQuitAndJoinGroup.h>
19 
20 namespace carma {
21 namespace environment {
22 
23 /*----------------------------------------------------------------------------*/
24 /* Dew Point Sensor Data Container */
25 /*----------------------------------------------------------------------------*/
26 
27 struct DPSData
28 {
29  DPSData();
30 
31  carma::util::frameType timestamp;
32  float ambientTemperature;
33  float dewpointTemperature;
34  float humidity;
35  bool valid;
36 };
37 
38 /*----------------------------------------------------------------------------*/
39 /* Dew Point Sensor Reader */
40 /*----------------------------------------------------------------------------*/
41 
42 class DPS
43 {
44 public:
45  DPS(const std::string &device, bool reopen = false, bool emulate = false);
46 
47  void getLatestData(struct DPSData &data);
48  void startReaderThread();
49 
50  static void readerThreadEP(DPS &This);
51 
52 private:
53  bool parseData(const char *buf, ssize_t bytes);
54  void readerNormalMode();
55  void readerEmulateMode();
56 
57  const std::string device_;
58  const bool reopen_;
59  const bool emulate_;
60  carma::util::AutoPthreadQuitAndJoinGroup group_;
62 
64  DPSData data_;
65 };
66 
67 } // namespace environment
68 } // namespace carma
69 
70 /* vim: set ts=4 sts=4 sw=4 et: */
71 #endif // CARMA_ENVIRONMENT_DPS_H
This class is used to calculate a variety of quantities related to the earth&#39;s atmosphere, such as refractivity, saturated pressure, and pathlength (refractivity integrated through the atmosphere).
Definition: Atmosphere.h:46
unsigned int frameType
Half second frames since Jan 1, 2000.
Definition: types.h:29
Constants and methods having to do with the earth&#39;s atmosphere (e.g.
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41
Various type definitions for util classes.