nidas  v1.2-1520
SPP200_Serial.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  ** 2006, 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_DYNLD_RAF_SPP200_SERIAL_H
28 #define NIDAS_DYNLD_RAF_SPP200_SERIAL_H
29 
30 #include "SppSerial.h"
32 
33 namespace nidas { namespace dynld { namespace raf {
34 
39 class SPP200_Serial : public SppSerial
40 {
41 public:
42 
43  SPP200_Serial();
44 
46 
48 
49  bool process(const Sample* samp,std::list<const Sample*>& results)
50  throw();
51 
52 
53  // Packet to initialize probe with.
54  struct Init200_blk
55  {
56  char esc; // ESC 0x1b
57  char id; // cmd id
58  DMT_UShort trig_thresh; // trigger threshold
59  DMT_UShort chanCnt; // chanCnt
60  DMT_UShort range; // range
61  DMT_UShort avTranWe; // avgTransWeight
62  DMT_UShort divFlag; // divisorflag 0=/2, 1=/4
63  DMT_UShort OPCthreshold[MAX_CHANNELS]; // OPCthreshold[MAX_CHANNELS]
64  DMT_UShort chksum; // cksum
65  };
66 
67  static const int _InitPacketSize = 94;
68 
74  struct DMT200_blk
75  {
84  DMT_ULong OPCchan[MAX_CHANNELS]; // 40 channels max
86  };
87 
88 protected:
89 
90  int packetLen() const {
91  return (34 + 4 * _nChannels);
92  }
93 
94  static const size_t PHGB_INDX, PMGB_INDX, PLGB_INDX, PFLW_INDX, PREF_INDX,
96 
99 
100  unsigned short _divFlag;
101 
102  unsigned short _avgTransitWeight;
103 };
104 
105 }}} // namespace nidas namespace dynld raf
106 
107 #endif
void validate()
Implementation of DSMSensor::validate for a Character Sensor.
Definition: SPP200_Serial.cc:80
unsigned short _avgTransitWeight
Definition: SPP200_Serial.h:102
DMT_UShort trig_thresh
Definition: SPP200_Serial.h:58
DMT_UShort SyncErrC
Definition: SPP200_Serial.h:82
DMT_ULong OPCchan[MAX_CHANNELS]
Definition: SPP200_Serial.h:84
DMT_UShort chksum
Definition: SPP200_Serial.h:64
DMT_UShort avTranWe
Definition: SPP200_Serial.h:61
DMT_UShort cabinChan[8]
Definition: SPP200_Serial.h:76
char id
Definition: SPP200_Serial.h:57
static const size_t PMGB_INDX
Definition: SPP200_Serial.h:94
static const size_t PLGB_INDX
Definition: SPP200_Serial.h:94
DMT_UShort chksum
Definition: SPP200_Serial.h:85
nidas::util::RunningAverage< unsigned short, 44 > _flowAverager
Definition: SPP200_Serial.h:97
int packetLen() const
Return the expected data packet length in bytes based on the number of channels being used...
Definition: SPP200_Serial.h:90
static const int _InitPacketSize
Definition: SPP200_Serial.h:67
DMT_UShort SyncErrB
Definition: SPP200_Serial.h:81
static const size_t PHGB_INDX
Definition: SPP200_Serial.h:94
static const size_t PTMP_INDX
Definition: SPP200_Serial.h:94
Data packet back from probe.
Definition: SPP200_Serial.h:74
SPP200_Serial()
Definition: SPP200_Serial.cc:48
bool process(const Sample *samp, std::list< const Sample * > &results)
Process a raw sample, which in this case means do a sscanf on the character string contents...
Definition: SPP200_Serial.cc:128
char esc
Definition: SPP200_Serial.h:56
DMT_UShort OPCthreshold[MAX_CHANNELS]
Definition: SPP200_Serial.h:63
static const size_t PFLW_INDX
Definition: SPP200_Serial.h:94
static const int MAX_CHANNELS
Max # for array sizing.
Definition: SppSerial.h:119
nidas::util::RunningAverage< unsigned short, 44 > _flowsAverager
Definition: SPP200_Serial.h:98
Interface to a data sample.
Definition: Sample.h:189
A class for reading PMS1D probes with the DMT interface conversion.
Definition: SPP200_Serial.h:39
static const size_t PREF_INDX
Definition: SPP200_Serial.h:94
DMT_UShort chanCnt
Definition: SPP200_Serial.h:59
DMT_UShort range
Definition: SPP200_Serial.h:60
Base class for many DMT Probes, including SPP100, SPP200, SPP300 and the CDP.
Definition: SppSerial.h:99
Definition: IOException.h:37
DMT_UShort SyncErrA
Definition: SPP200_Serial.h:80
int _nChannels
Number of channels requested to be recorded.
Definition: SppSerial.h:173
DMT_UShort AvgTransit
Definition: SPP200_Serial.h:77
unsigned char DMT_UShort[2]
DMT 2-byte ints are packed with byte order 01, where byte 0 is the low-order byte.
Definition: SppSerial.h:52
DMT_UShort FIFOfull
Definition: SPP200_Serial.h:78
static const size_t PFLWS_INDX
Definition: SPP200_Serial.h:94
Definition: SPP200_Serial.h:54
unsigned char DMT_ULong[4]
DMT 4-byte ints are packed with byte order 2301, where byte 0 is the low-order byte.
Definition: SppSerial.h:78
DMT_UShort resetFlag
Definition: SPP200_Serial.h:79
unsigned short _divFlag
Definition: SPP200_Serial.h:100
DMT_ULong ADCoverflow
Definition: SPP200_Serial.h:83
Definition: InvalidParameterException.h:35
DMT_UShort divFlag
Definition: SPP200_Serial.h:62
void sendInitString()
Definition: SPP200_Serial.cc:98