CARMA C++
LLWorkerBoard1Thread.h
1 #ifndef LLWORKERBOARD1THREAD_H
2 #define LLWORKERBOARD1THREAD_H
3 
4 #include <carma/util/PthreadMutex.h>
5 #include <carma/util/types.h>
6 
7 #include <carma/linelength/ComediDevice.h>
8 
9 #include <boost/shared_ptr.hpp>
10 
11 #include <vector>
12 
13 namespace carma {
14 namespace linelength {
15 
16 // Simple structure to hold a sample of LineLength Board1 Data
17 struct LLBoard1Data
18 {
19  // timestamp of when this data was captured
20  carma::util::frameType timestamp;
21  ComediSamplePtr rawData;
22 
23  // 24 channels of AGC and Optical Power data
24  std::vector<double> antagc;
25  std::vector<double> antopt;
26 
27  // 3 channels of reference AGC and RF Power data
28  std::vector<double> refagc;
29  std::vector<double> refpower;
30 };
31 
32 typedef boost::shared_ptr<struct LLBoard1Data> LLBoard1DataPtr;
33 
34 class LLWorkerBoard1Thread
35 {
36  public:
37  LLWorkerBoard1Thread(const std::string &device);
38  ~LLWorkerBoard1Thread();
39 
40  // Thread
41  static void thread(LLWorkerBoard1Thread &This) { This.run(); };
42  void run();
43 
44  // Data Interface
45  LLBoard1DataPtr getNewestData() const;
46 
47  private:
48  // device file to use
49  const std::string device_;
50 
51  // data buffer
52  mutable carma::util::PthreadMutex mutex_;
53  LLBoard1DataPtr buffer_;
54 };
55 
56 } // namespace carma::linelength
57 } // namespace carma
58 
59 #endif // LLWORKERBOARD1THREAD_H
60 // vim: set expandtab ts=4 sts=4 sw=4:
unsigned int frameType
Half second frames since Jan 1, 2000.
Definition: types.h:29
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.