nidas  v1.2-1520
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
nidas::dynld::raf::TwoD32_USB Class Referenceabstract

Sensor class for the standard PMS2D probes where the data signals are converted to USB by a converter box. More...

#include <TwoD32_USB.h>

Inheritance diagram for nidas::dynld::raf::TwoD32_USB:
Inheritance graph
[legend]

Public Member Functions

 TwoD32_USB ()
 
 ~TwoD32_USB ()
 
bool process (const Sample *samp, std::list< const Sample * > &results) throw ()
 Apply further necessary processing to a raw sample from this DSMSensor. More...
 
virtual int NumberOfDiodes () const
 Number of diodes in the probe array. More...
 
IODevicebuildIODevice () throw (nidas::util::IOException)
 Factory method for an IODevice for this DSMSensor. More...
 
SampleScannerbuildSampleScanner () throw (nidas::util::InvalidParameterException)
 Factory method for a SampleScanner for this DSMSensor. More...
 
void open (int flags) throw (nidas::util::IOException,nidas::util::InvalidParameterException)
 open the sensor and perform any intialization to the driver. More...
 
void close () throw (nidas::util::IOException)
 close my associated device. More...
 
int getTASRate () const
 
void setTASRate (int val)
 
float getResolution () const
 The probe resolution in meters. More...
 
unsigned int getResolutionMicron () const
 The probe resolution in micrometers. More...
 
void init () throw (nidas::util::InvalidParameterException)
 Called by post-processing code. More...
 
virtual void throw ()
 
void printStatus (std::ostream &ostr) throw ()
 
virtual int TASToTap2D (void *t2d, float tas)
 Build the struct above from the true airspeed (in m/s). More...
 
virtual float Tap2DToTAS (const Tap2D *t2d) const
 Reverse the true airspeed encoding. More...
 
virtual float Tap2DToTAS (const Tap2Dv1 *t2d) const
 The first generation used the Maxim 5418 chip. More...
 
void setDSMConfig (const DSMConfig *val)
 Set the DSMConfig for this sensor. More...
 
const DSMConfiggetDSMConfig () const
 What DSMConfig am I associated with? More...
 
const SitegetSite () const
 What Site am I associated with? More...
 
virtual void setDeviceName (const std::string &val)
 Set the name of the system device that the sensor is connected to. More...
 
virtual const std::string & getDeviceName () const
 Fetch the name of the system device that the sensor is connected to. More...
 
virtual void setClassName (const std::string &val)
 Set the class name. More...
 
virtual const std::string & getClassName () const
 Fetch the class name. More...
 
virtual void setCatalogName (const std::string &val)
 Set the name of the catalog entry for this sensor. More...
 
virtual const std::string & getCatalogName () const
 Fetch the name of the catalog entry for this sensor. More...
 
const std::string & getDSMName () const
 Fetch the DSM name. More...
 
virtual std::string getName () const
 Return a name that should fully identify this sensor. More...
 
const std::string & getLocation () const
 Location string. More...
 
void setLocation (const std::string &val)
 
const std::string & getSuffix () const
 Sensor suffix, which is added to variable names. More...
 
void setSuffix (const std::string &val)
 
int getStation () const
 
void setStation (int val)
 
void setHeight (const std::string &val)
 Set sensor height above ground via a string which is added to variable names. More...
 
void setHeight (float val)
 Set sensor height above ground. More...
 
const std::string & getHeightString () const
 Get sensor height above ground in a string. More...
 
float getHeight () const
 Get sensor height above ground. More...
 
void setDepth (const std::string &val)
 Set sensor depth below ground via a string which is added to variable names. More...
 
void setDepth (float val)
 Set sensor depth below ground. More...
 
const std::string & getDepthString () const
 Get sensor depth below ground in a string. More...
 
float getDepth () const
 Get sensor depth below ground. More...
 
const std::string & getFullSuffix () const
 Full sensor suffix, the concatenation of the sensor suffix, if any, and the height or depth string, if any. More...
 
std::string expandString (const std::string &input) const
 Utility function to expand ${TOKEN} or $TOKEN fields in a string with their value from getTokenValue(). More...
 
bool getTokenValue (const std::string &token, std::string &value) const
 Implement a lookup for tokens that I know about, like $HEIGHT. More...
 
const DictionarygetDictionary () const
 
SampleSourcegetRawSampleSource ()
 Implementation of SampleSource::getRawSampleSource(). More...
 
SampleSourcegetProcessedSampleSource ()
 Implementation of SampleSource::getProcessedSampleSource(). More...
 
const SampleTaggetRawSampleTag () const
 Convenience function to get my one-and-only raw SampleTag(). More...
 
virtual void addSampleTag (SampleTag *val) throw (nidas::util::InvalidParameterException)
 Add a SampleTag to this sensor. More...
 
virtual void removeSampleTag (SampleTag *val) throw ()
 Remove val from the list of SampleTags, and delete it. More...
 
std::list< const SampleTag * > getSampleTags () const
 Implementation of SampleSource::getSampleTags(). More...
 
std::list< SampleTag * > & getSampleTags ()
 Non-const method to get a list of non-const pointers to SampleTags. More...
 
SampleTagIterator getSampleTagIterator () const
 
void addSampleClient (SampleClient *c) throw ()
 Add a SampleClient to this SampleSource. More...
 
void removeSampleClient (SampleClient *c) throw ()
 Remove a SampleClient from this SampleSource This will also remove a SampleClient if it has been added with addSampleClientForTag(). More...
 
void addSampleClientForTag (SampleClient *client, const SampleTag *tag) throw ()
 Add a SampleClient to this SampleSource. More...
 
void removeSampleClientForTag (SampleClient *client, const SampleTag *tag) throw ()
 Remove a SampleClient for a given SampleTag from this SampleSource. More...
 
int getClientCount () const throw ()
 How many SampleClients are currently in my list. More...
 
void flush () throw ()
 Implementation of SampleClient::flush(). More...
 
void distributeRaw (const Sample *s) throw ()
 Distribute a raw sample which has been read from my file descriptor in real time. More...
 
const SampleStatsgetSampleStats () const
 
virtual int getReadFd () const
 
virtual int getWriteFd () const
 
virtual bool reopenOnIOException () const
 Whether to reopen this sensor on an IOException. More...
 
void setId (dsm_sample_id_t val)
 Set the various levels of the sensor identification. More...
 
void setSensorId (unsigned int val)
 
void setDSMId (unsigned int val)
 
dsm_sample_id_t getId () const
 Get the various levels of the samples identification. More...
 
unsigned int getDSMId () const
 
unsigned int getSensorId () const
 
virtual void setLatency (float val) throw (nidas::util::InvalidParameterException)
 Set desired latency, providing some control over the response time vs buffer efficiency tradeoff. More...
 
virtual float getLatency () const
 
virtual void setTimeoutMsecs (int val)
 Set the sensor timeout value in milliseconds. More...
 
virtual int getTimeoutMsecs () const
 
int getTimeoutCount () const
 
void incrementTimeoutCount ()
 
void addParameter (Parameter *val)
 Add a parameter to this DSMSensor. More...
 
const std::list< const
Parameter * > & 
getParameters () const
 Get list of parameters. More...
 
const ParametergetParameter (const std::string &name) const
 Fetch a parameter by name. More...
 
void setIODevice (IODevice *val)
 Set the IODevice for this sensor. More...
 
void setSampleScanner (SampleScanner *val)
 Set the SampleScanner for this sensor. More...
 
virtual void validate () throw (nidas::util::InvalidParameterException)
 validate() is called once on a DSMSensor after it has been configured, but before open() or init() are called. More...
 
virtual int getDefaultMode () const
 How do I want to be opened. More...
 
virtual void setDefaultMode (int val)
 
virtual size_t getBytesAvailable () const throw (nidas::util::IOException)
 How many bytes are available to read on this sensor. More...
 
virtual size_t read (void *buf, size_t len) throw (nidas::util::IOException)
 Read from the device (duh). More...
 
virtual size_t read (void *buf, size_t len, int msecTimeout) throw (nidas::util::IOException)
 Read from the device with a timeout. More...
 
virtual size_t write (const void *buf, size_t len) throw (nidas::util::IOException)
 Write to the device (duh). More...
 
virtual void ioctl (int request, void *buf, size_t len) throw (nidas::util::IOException)
 Perform an ioctl on the device. More...
 
virtual bool readSamples () throw (nidas::util::IOException)
 Read samples from my associated file descriptor, and distribute() them to my RawSampleClient's. More...
 
virtual SamplenextSample ()
 Extract the next sample from the buffer. More...
 
virtual SamplereadSample () throw (nidas::util::IOException)
 Return the next sample. More...
 
bool receive (const Sample *s) throw ()
 A DSMSensor can be used as a SampleClient, meaning it receives its own raw samples. More...
 
void printStatusHeader (std::ostream &ostr) throw ()
 
void printStatusTrailer (std::ostream &ostr) throw ()
 
void calcStatistics (unsigned int periodUsec)
 Update the sensor sampling statistics. More...
 
unsigned int getMaxSampleLength () const
 
unsigned int getMinSampleLength () const
 
float getObservedSamplingRate () const
 
float getObservedDataRate () const
 
size_t getBadTimeTagCount () const
 
VariableIterator getVariableIterator () const
 
void fromDOMElement (const xercesc::DOMElement *) throw (nidas::util::InvalidParameterException)
 Initialize myself from a xercesc::DOMElement. More...
 
xercesc::DOMElement * toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException)
 Create a DOMElement and append it to the parent. More...
 
xercesc::DOMElement * toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException)
 Add my content into a DOMElement. More...
 
virtual void setTypeName (const std::string &val)
 Set the type name of this sensor, e.g. More...
 
virtual const std::string & getTypeName (void) const
 Get the type name of this sensor. More...
 
bool getDuplicateIdOK () const
 getDuplicateIdOK will be true if it is OK for samples from this sensor to have identical IDs to samples from another sensor. More...
 
void setDuplicateIdOK (bool val)
 Set the duplicate ID attribute of this DSMSensor. More...
 
virtual bool getApplyVariableConversions () const
 
virtual void setApplyVariableConversions (bool val)
 
virtual int getDriverTimeTagUsecs () const
 
virtual void setDriverTimeTagUsecs (int val)
 
void addCalFile (CalFile *val)
 Add a calibration file for this DSMSensor. More...
 
const std::map< std::string,
CalFile * > & 
getCalFiles ()
 Return the collection of CalFiles, mapped by name. More...
 
CalFilegetCalFile (const std::string &name)
 Return a CalFile by its getName(). More...
 
void removeCalFiles ()
 Remove all CalFiles. More...
 
virtual void executeXmlRpc (XmlRpc::XmlRpcValue &, XmlRpc::XmlRpcValue &) throw ()
 Method invoked when the DSMEngineIntf XmlRpcServer receives a "SensorAction" request, with a "device" string matching the string that this DSMSensor registers via DSMEngine::registerSensorWithXmlRpc(string,DSMServer*). More...
 
virtual const std::list
< SampleTag * > & 
getNonConstSampleTags ()
 We'll allow derived classes and calibration applications to change the SampleTags, so this method returns a list of non-constant SampleTags. More...
 
bool allowOpen ()
 
bool readBuffer () throw (nidas::util::IOException)
 Read into my SampleScanner's buffer. More...
 
bool readBuffer (int msecTimeout) throw (nidas::util::IOException)
 Read into my SampleScanner's buffer. More...
 
virtual void derivedDataNotify (const DerivedDataReader *s)=0 throw ()
 Method called on a DerivedDataClient by the DerivedDataReader thread when a new packet of derived data has been received. More...
 

Static Public Member Functions

static const std::string getClassName (const xercesc::DOMElement *node, const Project *project) throw (nidas::util::InvalidParameterException)
 Crawl through the DOM tree for a DSMSensor to find the class name - scanning the catalog entry if necessary. More...
 
static void deleteLooper ()
 
static const XMLCh * getNamespaceURI ()
 

Protected Member Functions

bool processImage (const Sample *samp, std::list< const Sample * > &results, int stype) throw ()
 
virtual void init_parameters () throw (nidas::util::InvalidParameterException)
 Initialize parameters for real-time and post-processing. More...
 
virtual void sendTrueAirspeed (float tas) throw (nidas::util::IOException)
 Encode and send the true airspeed to the USB driver, which will in turn send it to the probe. More...
 
virtual void processParticleSlice (Particle &p, const unsigned char *slice)
 Process a slice and update the Particle struct area, edgeTouch, width and height. More...
 
virtual void countParticle (const Particle &p, float resolutionUsec)
 Look at particle stats/info and decide whether to accept or reject. More...
 
void saveBuffer (const unsigned char *cp, const unsigned char *eod)
 In case of mis-aligned data, we may need to save some bytes at the end of an image block to pre-pend to the next block. More...
 
void setupBuffer (const unsigned char **cp, const unsigned char **eod)
 Derived Classes should call this at the beginning of processing an image block. More...
 
void clearBuffer ()
 Clear the internal buffer. More...
 
IODevicegetIODevice () const
 
SampleScannergetSampleScanner () const
 
void setFullSuffix (const std::string &val)
 
virtual int getLagUsecs () const
 Return the sampling lag for this sensor in microseconds. More...
 
virtual double getLagSecs () const
 Return the sampling lag for this sensor in seconds. More...
 
virtual void setLagSecs (double val)
 Set the sampling lag for this sensor in seconds. More...
 
void applyConversions (SampleTag *stag, SampleT< float > *outs, float *results=0)
 Perform variable conversions for the variables in stag whose values and sample time have been set in outs. More...
 
void trimUnparsed (SampleTag *stag, SampleT< float > *outs, int nparsed)
 Fill with floatNAN all the values past nparsed values in output sample outs, and trim the length of the sample to match the length of the variables in SampleTag stag. More...
 
VariableIndex findVariableIndex (const std::string &vprefix)
 Search all the sample tags for a variable whose name starts with the given prefix, and return it's index in the list of variables in the sample tag. More...
 
virtual bool acceptThisParticle1D (const Particle &p) const
 Accept/reject criteria are in these functions. More...
 
virtual bool acceptThisParticle2D (const Particle &p) const
 
virtual void createSamples (dsm_time_t nextTimeTag, std::list< const Sample * > &results) throw ()
 Send derived data and reset. More...
 
virtual void clearData ()
 Clear size_dist arrays. More...
 

Static Protected Member Functions

static LoopergetLooper ()
 Fetch a pointer to a static instance of a Looper thread. More...
 

Protected Attributes

int _tasRate
 How often to send the true air speed. More...
 
unsigned int _numImages
 Number of image blocks processed by driver at time of last printStatus. More...
 
long long _lastStatusTime
 Time of last printStatus. More...
 
unsigned int _totalPixelsShadowed
 total # of pixels shadoweded in the time period. per second... More...
 
dsm_time_t _prevTime
 Time from previous record. More...
 
long long _histoEndTime
 The end time of the current histogram. More...
 
float _twoDAreaRejectRatio
 Area of particle rejection ratio. More...
 
Particle _particle
 Current particle information. More...
 
float _trueAirSpeed
 True air speed, received from IWGADTS feed. More...
 
int _nextraValues
 If XML file has a variable RPS (records per second) defined, then _nextravalues will be 2, otherwise 1. More...
 
unsigned char * _saveBuffer
 The saved buffer. More...
 
int _savedBytes
 How many bytes were last saved. More...
 
int _savedAlloc
 Size of the saved buffer. More...
 
bool _openable
 Whether this sensor is allowed to be opened. More...
 
float _resolutionMeters
 Probe resolution in meters. More...
 
unsigned int _resolutionMicron
 Probe resolution in micrometers. More...
 
dsm_sample_id_t _sorID
 Shadow OR sample ID. More...
 
dsm_sample_id_t _1dcID
 
dsm_sample_id_t _2dcID
 
unsigned int * _size_dist_1D
 Arrays for size-distribution histograms. More...
 
unsigned int * _size_dist_2D
 
float _dead_time
 Amount of time probe was inactive or amount of time consumed by rejected particles. More...
 
unsigned int _totalRecords
 Statistics variables for processRecord(). More...
 
unsigned int _totalParticles
 
unsigned int _rejected1D_Cntr
 
unsigned int _rejected2D_Cntr
 
unsigned int _overLoadSliceCount
 
unsigned int _overSizeCount_2D
 
unsigned int _tasOutOfRange
 
unsigned int _misAligned
 
unsigned int _suspectSlices
 
unsigned int _recordsPerSecond
 

Static Protected Attributes

static const unsigned char _overldString [] = {0x55, 0xaa}
 
static const unsigned char _blankString [] = {0xff, 0xff, 0xff, 0xff}
 
static const
nidas::util::EndianConverter
bigEndian
 
static const
nidas::util::EndianConverter
littleEndian
 
static const float DefaultTrueAirspeed = 23.0
 

Detailed Description

Sensor class for the standard PMS2D probes where the data signals are converted to USB by a converter box.

These probes have the standard 32 diodes.

Constructor & Destructor Documentation

TwoD32_USB::TwoD32_USB ( )
TwoD32_USB::~TwoD32_USB ( )

Member Function Documentation

bool TwoD_USB::acceptThisParticle1D ( const Particle p) const
protectedvirtualinherited
bool TwoD_USB::acceptThisParticle2D ( const Particle p) const
protectedvirtualinherited
void DSMSensor::addCalFile ( CalFile val)
inherited

Add a calibration file for this DSMSensor.

After this method is finished, DSMSensor will own the pointer, and will delete it in the DSMSensor destructor.

References nidas::core::DSMSensor::_calFiles, and nidas::core::CalFile::getName().

Referenced by nidas::core::DSMSensor::fromDOMElement().

void DSMSensor::addParameter ( Parameter val)
inherited

Add a parameter to this DSMSensor.

DSMSensor will then own the pointer and will delete it in its destructor. If a Parameter exists with the same name, it will be replaced with the new Parameter.

References nidas::core::DSMSensor::_constParameters, nidas::core::DSMSensor::_parameters, and nidas::core::Parameter::getName().

Referenced by nidas::core::DSMSensor::fromDOMElement().

void nidas::core::DSMSensor::addSampleClient ( SampleClient c)
throw (
)
inlinevirtualinherited
void nidas::core::DSMSensor::addSampleClientForTag ( SampleClient client,
const SampleTag tag 
)
throw (
)
inlinevirtualinherited
void DSMSensor::addSampleTag ( SampleTag val)
throw (nidas::util::InvalidParameterException
)
virtualinherited

Add a SampleTag to this sensor.

DSMSensor will own the SampleTag. Throw an exception the DSMSensor cannot support the sample (bad rate, wrong number of variables, etc). Note that a SampleTag may be changed after it has been added. addSampleTag() is called when a sensor is initialized from the sensor catalog. The SampleTag may be modified later if it is overridden in the actual sensor entry. For this reason, it is wise to wait to scan the SampleTags of a DSMSensor in the validate(), init() or open() methods, which are invoked after fromDOMElement.

Reimplemented in nidas::dynld::isff::DAUSensor.

References GET_DSM_ID, GET_SHORT_ID, nidas::util::Logger::getInstance(), nidas::util::Logger::log(), and LOG_WARNING.

Referenced by nidas::dynld::isff::DAUSensor::addSampleTag(), nidas::dynld::RawSampleService::connect(), nidas::core::DSMSensor::fromDOMElement(), and main().

bool nidas::core::DSMSensor::allowOpen ( )
inlineinherited
void DSMSensor::applyConversions ( SampleTag stag,
SampleT< float > *  outs,
float *  results = 0 
)
protectedinherited

Perform variable conversions for the variables in stag whose values and sample time have been set in outs.

This method can be used by subclasses to apply any variable conversions associated with the variables in the given SampleTag, using a general algorithm which loops over each value in each variable. The min/max value limits of a variable are applied also, so if a variable value is converted but lies outside the min/max range, the value is set to floatNAN. Typically this can be the last step applied to the output sample of a sensor's process() method, and note that the sample time must already be set in the output sample outs, since that time will be used to look up conversions in calibration files.

If results is non-null, then the converted values are written into results instead of overwriting the values in outs. This is used when one variable's results may be used to filter other variables without replacing the one variable's results. An example is the Ifan variable in the TRH WisardMote. results must point to enough memory to hold all of the values in outs, including for any Variables with multiple values (getLength() > 1).

See Variable::convert().

References nidas::core::Variable::convert(), fp, nidas::core::SampleT< DataT >::getDataPtr(), nidas::core::Sample::getTimeTag(), and nidas::core::SampleTag::getVariables().

IODevice * TwoD_USB::buildIODevice ( )
throw (nidas::util::IOException
)
virtualinherited

Factory method for an IODevice for this DSMSensor.

Must be implemented by derived classes.

Implements nidas::core::DSMSensor.

SampleScanner * TwoD_USB::buildSampleScanner ( )
throw (nidas::util::InvalidParameterException
)
virtualinherited

Factory method for a SampleScanner for this DSMSensor.

Must be implemented by derived classes.

Implements nidas::core::DSMSensor.

void nidas::core::DSMSensor::calcStatistics ( unsigned int  periodUsec)
inlineinherited

Update the sensor sampling statistics.

Should be called every periodUsec by a user of this sensor.

Parameters
periodUsecStatistics period.

References nidas::core::DSMSensor::_scanner, and nidas::core::SampleScanner::calcStatistics().

Referenced by nidas::core::SensorHandler::calcStatistics().

void nidas::core::DSMSensor::clearBuffer ( )
inlineprotectedinherited
void TwoD_USB::clearData ( )
protectedvirtualinherited
void TwoD_USB::close ( )
throw (nidas::util::IOException
)
virtualinherited
void TwoD_USB::countParticle ( const Particle p,
float  resolutionUsec 
)
protectedvirtualinherited
void TwoD_USB::createSamples ( dsm_time_t  nextTimeTag,
std::list< const Sample * > &  results 
)
throw (
)
protectedvirtualinherited

Send derived data and reset.

The process() method for image data is to build size-distribution histograms for 1 second of data and then send that.

Parameters
resultsis the output results.
nextTimeTagis the timetag of a sample that is past the end of the current histogram period. The end

References nidas::core::SampleT< DataT >::getDataPtr(), nidas::core::Sample::setId(), nidas::core::Sample::setTimeTag(), and USECS_PER_SEC.

void DSMSensor::deleteLooper ( )
staticinherited
virtual void nidas::core::DerivedDataClient::derivedDataNotify ( const DerivedDataReader s)
throw (
)
pure virtualinherited

Method called on a DerivedDataClient by the DerivedDataReader thread when a new packet of derived data has been received.

This method is called on the DerivedDataClients in the sequence that they registered with the DerivedDataReader. The implementation of this method in a client should run quickly, to reduce the delay in calling successive clients in the list.

Implemented in nidas::dynld::raf::CVIOutput, and nidas::dynld::raf::AlicatSDI.

Referenced by nidas::core::DerivedDataReader::notifyClients().

void nidas::core::DSMSensor::distributeRaw ( const Sample s)
throw (
)
inlineinherited

Distribute a raw sample which has been read from my file descriptor in real time.

References nidas::core::DSMSensor::_rawSource, and nidas::core::SampleSourceSupport::distribute().

virtual void nidas::core::DSMSensor::executeXmlRpc ( XmlRpc::XmlRpcValue &  ,
XmlRpc::XmlRpcValue &   
)
throw (
)
inlinevirtualinherited

Method invoked when the DSMEngineIntf XmlRpcServer receives a "SensorAction" request, with a "device" string matching the string that this DSMSensor registers via DSMEngine::registerSensorWithXmlRpc(string,DSMServer*).

The default base class method does nothing.

Reimplemented in nidas::dynld::raf::DSMAnalogSensor, and nidas::dynld::raf::PSI9116_Sensor.

Referenced by nidas::core::DSMEngineIntf::SensorAction::execute().

std::string nidas::core::DSMSensor::expandString ( const std::string &  input) const
inlineinherited

Utility function to expand ${TOKEN} or $TOKEN fields in a string with their value from getTokenValue().

If curly brackets are not used, then the TOKEN should be delimited by a '/', a '.' or the end of string, e.g.: xxx/yyy/$ZZZ.dat

References nidas::core::DSMSensor::_dictionary, and nidas::core::Dictionary::expandString().

Referenced by nidas::core::DSMSensor::fromDOMElement(), and nidas::core::CalFile::open().

VariableIndex DSMSensor::findVariableIndex ( const std::string &  vprefix)
protectedinherited

Search all the sample tags for a variable whose name starts with the given prefix, and return it's index in the list of variables in the sample tag.

If no such variable is found, return -1.

References nidas::core::Variable::getName(), nidas::core::DSMSensor::getSampleTags(), and nidas::core::SampleTag::getVariables().

void nidas::core::DSMSensor::flush ( )
throw (
)
inlinevirtualinherited

Implementation of SampleClient::flush().

This is where a DSMSensor's process() method could send out any buffered results that might be ready.

Implements nidas::core::SampleClient.

Referenced by nidas::dynld::psql::PSQLProcessor::disconnect().

void DSMSensor::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtualinherited

Initialize myself from a xercesc::DOMElement.

Implements nidas::core::DOMable.

Reimplemented in nidas::core::SerialSensor, nidas::dynld::raf::DSMArincSensor, nidas::dynld::raf::IRIGSensor, nidas::dynld::isff::Wind2D, nidas::dynld::raf::LamsSensor, and nidas::dynld::raf::Arinc_IRS.

References nidas::core::DSMSensor::_dictionary, nidas::core::DSMSensor::_rawSampleTag, nidas::core::DSMSensor::_rawSource, nidas::core::DSMSensor::_sampleTags, nidas::core::DSMSensor::addCalFile(), nidas::core::DSMSensor::addParameter(), nidas::core::SampleSourceSupport::addSampleTag(), nidas::core::DSMSensor::addSampleTag(), nidas::core::Parameter::createParameter(), nidas::core::DSMSensor::expandString(), nidas::core::SensorCatalog::find(), nidas::core::Parameter::FLOAT_PARAM, nidas::core::SampleTag::fromDOMElement(), nidas::core::CalFile::fromDOMElement(), nidas::core::DSMSensor::getApplyVariableConversions(), nidas::core::XDOMElement::getAttributeValue(), nidas::core::DSMSensor::getClassName(), nidas::core::DSMSensor::getDefaultMode(), nidas::core::DSMSensor::getDSMConfig(), nidas::core::SampleTag::getDSMId(), nidas::core::DSMSensor::getFullSuffix(), nidas::core::SampleTag::getId(), nidas::core::DSMSensor::getId(), nidas::util::Logger::getInstance(), nidas::core::Parameter::getLength(), nidas::core::Parameter::getName(), nidas::core::DSMConfig::getName(), nidas::core::XDOMAttr::getName(), nidas::core::DSMSensor::getName(), nidas::core::Variable::getName(), nidas::core::XDOMElement::getNodeName(), nidas::core::Parameter::getNumericValue(), nidas::core::DSMConfig::getProject(), nidas::core::SampleTag::getRate(), nidas::core::SampleTag::getSampleId(), nidas::core::DSMSensor::getSampleTags(), nidas::core::Project::getSensorCatalog(), nidas::core::DSMSensor::getSensorId(), nidas::core::DSMSensor::getSite(), nidas::core::SampleTag::getSpSId(), nidas::core::DSMSensor::getStation(), nidas::core::DSMSensor::getSuffix(), nidas::core::Parameter::getType(), nidas::core::DSMSensor::getVariableIterator(), nidas::core::VariableIterator::hasNext(), nidas::core::Parameter::INT_PARAM, nidas::util::Logger::log(), LOG_WARNING, MSECS_PER_SEC, nidas::core::VariableIterator::next(), nidas::core::DSMSensor::setApplyVariableConversions(), nidas::core::DSMSensor::setCatalogName(), nidas::core::DSMSensor::setClassName(), nidas::core::DSMSensor::setDefaultMode(), nidas::core::DSMSensor::setDepth(), nidas::core::DSMSensor::setDeviceName(), nidas::core::SampleTag::setDSMConfig(), nidas::core::SampleTag::setDSMId(), nidas::core::SampleTag::setDSMSensor(), nidas::core::CalFile::setDSMSensor(), nidas::core::DSMSensor::setDuplicateIdOK(), nidas::core::DSMSensor::setHeight(), nidas::core::DSMSensor::setLagSecs(), nidas::core::DSMSensor::setLatency(), nidas::core::DSMSensor::setLocation(), nidas::core::SampleTag::setRate(), nidas::core::SampleTag::setSampleId(), nidas::core::SampleTag::setSensorId(), nidas::core::DSMSensor::setSensorId(), nidas::core::SampleTag::setStation(), nidas::core::DSMSensor::setStation(), nidas::core::SampleTag::setSuffix(), nidas::core::DSMSensor::setSuffix(), nidas::core::DSMSensor::setTimeoutMsecs(), nidas::core::DSMSensor::setTypeName(), and nidas::util::Exception::what().

Referenced by nidas::dynld::raf::DSMArincSensor::fromDOMElement(), nidas::core::CharacterSensor::fromDOMElement(), and nidas::core::DSMConfig::sensorFromDOMElement().

virtual bool nidas::core::DSMSensor::getApplyVariableConversions ( ) const
inlinevirtualinherited
size_t nidas::core::DSMSensor::getBadTimeTagCount ( ) const
inlineinherited
virtual size_t nidas::core::DSMSensor::getBytesAvailable ( ) const
throw (nidas::util::IOException
)
inlinevirtualinherited

How many bytes are available to read on this sensor.

See Also
IODevice::getBytesAvailable().

References nidas::core::DSMSensor::_iodev, and nidas::core::IODevice::getBytesAvailable().

CalFile * DSMSensor::getCalFile ( const std::string &  name)
inherited

Return a CalFile by its getName().

Will return NULL if not found.

References nidas::core::DSMSensor::_calFiles.

const std::map<std::string,CalFile*>& nidas::core::DSMSensor::getCalFiles ( )
inlineinherited

Return the collection of CalFiles, mapped by name.

References nidas::core::DSMSensor::_calFiles.

Referenced by sensorTitle(), and PConfig::showCalFiles().

virtual const std::string& nidas::core::DSMSensor::getCatalogName ( ) const
inlinevirtualinherited
virtual const std::string& nidas::core::DSMSensor::getClassName ( ) const
inlinevirtualinherited
const string DSMSensor::getClassName ( const xercesc::DOMElement *  node,
const Project project 
)
throw (nidas::util::InvalidParameterException
)
staticinherited

Crawl through the DOM tree for a DSMSensor to find the class name - scanning the catalog entry if necessary.

References nidas::core::XDOMElement::getAttributeValue(), and nidas::core::DSMSensor::getClassName().

int nidas::core::DSMSensor::getClientCount ( ) const
throw (
)
inlinevirtualinherited

How many SampleClients are currently in my list.

Implements nidas::core::SampleSource.

References nidas::core::DSMSensor::_source, and nidas::core::SampleSourceSupport::getClientCount().

virtual int nidas::core::DSMSensor::getDefaultMode ( ) const
inlinevirtualinherited

How do I want to be opened.

The user can ignore it if they want to.

Returns
one of O_RDONLY, O_WRONLY or O_RDWR.

References nidas::core::DSMSensor::_defaultMode.

Referenced by nidas::core::DSMSensor::fromDOMElement(), and nidas::core::SensorOpener::run().

float nidas::core::DSMSensor::getDepth ( ) const
inlineinherited

Get sensor depth below ground.

Returns
Depth of sensor below ground, in meters.

References nidas::core::DSMSensor::_height.

const std::string& nidas::core::DSMSensor::getDepthString ( ) const
inlineinherited

Get sensor depth below ground in a string.

Returns
Depth of sensor below ground, e.g. "5cm".

References nidas::core::DSMSensor::_depthString.

Referenced by SampleCounter::collectMetadata().

virtual const std::string& nidas::core::DSMSensor::getDeviceName ( ) const
inlinevirtualinherited
const Dictionary& nidas::core::DSMSensor::getDictionary ( ) const
inlineinherited
virtual int nidas::core::DSMSensor::getDriverTimeTagUsecs ( ) const
inlinevirtualinherited
const DSMConfig* nidas::core::DSMSensor::getDSMConfig ( ) const
inlineinherited
unsigned int nidas::core::DSMSensor::getDSMId ( ) const
inlineinherited
const std::string & DSMSensor::getDSMName ( ) const
inherited
bool nidas::core::DSMSensor::getDuplicateIdOK ( ) const
inlineinherited

getDuplicateIdOK will be true if it is OK for samples from this sensor to have identical IDs to samples from another sensor.

That other sensor must also agree that dupicateIdOK are OK. This can be useful if one may not be certain of the device name, e.g. /dev/ttyUSB*, that the system will assign to a sensor may use, but there are identifiers in the data returned that allow one to sort things out. In general, getDuplicateID is false.

References nidas::core::DSMSensor::_duplicateIdOK.

Referenced by nidas::core::Site::validate(), and nidas::core::DSMConfig::validateSensorAndSampleIds().

const std::string& nidas::core::DSMSensor::getFullSuffix ( ) const
inlineinherited

Full sensor suffix, the concatenation of the sensor suffix, if any, and the height or depth string, if any.

The full sensor suffix are words 2 and 3 in the dot-separated name: variable[.sensor][.height][.site]

References nidas::core::DSMSensor::_fullSuffix.

Referenced by nidas::core::DSMSensor::fromDOMElement().

float nidas::core::DSMSensor::getHeight ( ) const
inlineinherited

Get sensor height above ground.

Returns
Height of sensor above ground, in meters. Nan if unknown.

References nidas::core::DSMSensor::_height.

const std::string& nidas::core::DSMSensor::getHeightString ( ) const
inlineinherited
dsm_sample_id_t nidas::core::DSMSensor::getId ( ) const
inlineinherited
IODevice* nidas::core::DSMSensor::getIODevice ( ) const
inlineprotectedinherited
virtual double nidas::core::DSMSensor::getLagSecs ( ) const
inlineprotectedvirtualinherited

Return the sampling lag for this sensor in seconds.

See getLagUsecs().

References nidas::core::DSMSensor::_lag, and USECS_PER_SEC.

virtual int nidas::core::DSMSensor::getLagUsecs ( ) const
inlineprotectedvirtualinherited

Return the sampling lag for this sensor in microseconds.

A positive lag means one should adjust the sample time tags for this sensor earlier in time to achieve a better estimate of the actual time to be associated for each sample. Derived classes can use this method in their process method to correct for inherent, constant, sampling lags of a sensor. A fixed sample lag, in fractional seconds, can be set for a sensor in the XML:

<sensor>
<parameter name="lag" type = "float" value="0.186"/>
</sensor>

The DSMSensor::fromDOM() method parses this parameter and sets the value of the lag.

References nidas::core::DSMSensor::_lag.

Referenced by nidas::core::CharacterSensor::adjustTimeTag().

virtual float nidas::core::DSMSensor::getLatency ( ) const
inlinevirtualinherited
const std::string & DSMSensor::getLocation ( ) const
inherited

Location string.

A DSMConfig also has a Location. If the location has not been set for this DSMSensor, then the location of the DSMConfig will be returned.

References nidas::core::DSMSensor::_dsm, nidas::core::DSMSensor::_location, and nidas::core::DSMConfig::getLocation().

Referenced by SampleCounter::collectMetadata(), and nidas::core::DSMSensor::printStatusHeader().

Looper * DSMSensor::getLooper ( )
staticprotectedinherited
unsigned int nidas::core::DSMSensor::getMaxSampleLength ( ) const
inlineinherited
unsigned int nidas::core::DSMSensor::getMinSampleLength ( ) const
inlineinherited
virtual std::string nidas::core::DSMSensor::getName ( ) const
inlinevirtualinherited

Return a name that should fully identify this sensor.

This name could be used in informative messages. The returned name has this format: dsmName:deviceName.

References nidas::core::DSMSensor::getDeviceName(), and nidas::core::DSMSensor::getDSMName().

Referenced by nidas::core::SensorHandler::add(), nidas::core::SamplePipeline::addSampleClient(), nidas::core::SerialSensor::buildSampleScanner(), nidas::dynld::psql::PSQLProcessor::connect(), nidas::core::SamplePipeline::connect(), nidas::dynld::raf::CVIProcessor::connectSource(), nidas::dynld::raf::DSMArincSensor::fromDOMElement(), nidas::core::DSMSensor::fromDOMElement(), nidas::core::SensorHandler::PolledDSMSensor::getName(), nidas::core::SensorHandler::incrementFullBufferReads(), nidas::dynld::raf::UHSAS_Serial::init(), nidas::dynld::WxtSensor::init(), nidas::core::CharacterSensor::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::raf::TwoD64_USB::init_parameters(), nidas::dynld::raf::TwoD_USB::init_parameters(), nidas::core::TimetagAdjuster::log(), nidas::core::DSMSensor::printStatusHeader(), nidas::core::DSMSensor::readSamples(), nidas::core::SensorOpener::run(), nidas::dynld::WxtSensor::scanSample(), nidas::dynld::raf::UHSAS_Serial::sendInitString(), nidas::core::DSMConfig::sensorFromDOMElement(), PConfig::showAll(), nidas::core::CharacterSensor::startPrompting(), nidas::core::CharacterSensor::stopPrompting(), nidas::dynld::raf::UDPArincSensor::validate(), nidas::dynld::A2DSensor::validate(), nidas::core::CharacterSensor::validate(), nidas::dynld::raf::SppSerial::validate(), nidas::core::Site::validate(), nidas::core::DSMSensor::validate(), nidas::core::DSMConfig::validateSensorAndSampleIds(), nidas::core::CharacterSensor::validateSscanfs(), nidas::core::MessageStreamScanner::warnBackwardsStepTimeTag(), nidas::core::MessageStreamScanner::warnNonIncrTimeTag(), nidas::dynld::WxtSensor::wxtValidateSscanfs(), and nidas::dynld::raf::UHSAS_Serial::~UHSAS_Serial().

static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
virtual const std::list<SampleTag*>& nidas::core::DSMSensor::getNonConstSampleTags ( )
inlinevirtualinherited

We'll allow derived classes and calibration applications to change the SampleTags, so this method returns a list of non-constant SampleTags.

References nidas::core::DSMSensor::_sampleTags.

float nidas::core::DSMSensor::getObservedDataRate ( ) const
inlineinherited
float nidas::core::DSMSensor::getObservedSamplingRate ( ) const
inlineinherited
const Parameter * DSMSensor::getParameter ( const std::string &  name) const
inherited
const std::list<const Parameter*>& nidas::core::DSMSensor::getParameters ( ) const
inlineinherited

Get list of parameters.

References nidas::core::DSMSensor::_constParameters.

Referenced by nidas::dynld::A2DSensor::validate().

SampleSource* nidas::core::DSMSensor::getProcessedSampleSource ( )
inlinevirtualinherited

Implementation of SampleSource::getProcessedSampleSource().

Return the SampleSource for processed samples from this DSMSensor.

Implements nidas::core::SampleSource.

Referenced by nidas::dynld::RawSampleService::schedule().

SampleSource* nidas::core::DSMSensor::getRawSampleSource ( )
inlinevirtualinherited

Implementation of SampleSource::getRawSampleSource().

Return the SampleSource for raw samples from this DSMSensor. A DSMSensor is only a SampleSource of raw samples when running in real-time, not during post-processing.

Implements nidas::core::SampleSource.

References nidas::core::DSMSensor::_rawSource.

Referenced by nidas::core::RemoteSerialConnection::close(), and nidas::dynld::RawSampleService::schedule().

const SampleTag* nidas::core::DSMSensor::getRawSampleTag ( ) const
inlineinherited
virtual int nidas::core::DSMSensor::getReadFd ( ) const
inlinevirtualinherited
float nidas::dynld::raf::TwoD_USB::getResolution ( ) const
inlineinherited

The probe resolution in meters.

Probe resolution is also the diameter of the each diode. Typical values are 25 for the 2DC and 200 micrometers for the 2DP.

Returns
The probe resolution in meters.

Referenced by nidas::dynld::raf::TwoD_USB::Tap2DToTAS(), and nidas::dynld::raf::TwoD_USB::TASToTap2D().

unsigned int nidas::dynld::raf::TwoD_USB::getResolutionMicron ( ) const
inlineinherited

The probe resolution in micrometers.

Probe resolution is also the diameter of the each diode. Typical values are 25 for the 2DC and 200 micrometers for the 2DP.

Returns
The probe resolution in micrometers.
SampleScanner* nidas::core::DSMSensor::getSampleScanner ( ) const
inlineprotectedinherited
const SampleStats& nidas::core::DSMSensor::getSampleStats ( ) const
inlinevirtualinherited
SampleTagIterator nidas::core::DSMSensor::getSampleTagIterator ( ) const
inlinevirtualinherited
std::list<const SampleTag*> nidas::core::DSMSensor::getSampleTags ( ) const
inlinevirtualinherited
std::list<SampleTag*>& nidas::core::DSMSensor::getSampleTags ( )
inlineinherited

Non-const method to get a list of non-const pointers to SampleTags.

References nidas::core::DSMSensor::_sampleTags.

unsigned int nidas::core::DSMSensor::getSensorId ( ) const
inlineinherited
const Site * DSMSensor::getSite ( ) const
inherited
int nidas::core::DSMSensor::getStation ( ) const
inlineinherited
const std::string& nidas::core::DSMSensor::getSuffix ( ) const
inlineinherited

Sensor suffix, which is added to variable names.

It is only necessary to have a sensor suffix to make variable names unique. For example, if there are multiple sensors at the same height, with common variable names, then one can use a sensor suffix to make unique names. The sensor suffix is the second dot-separated word in a variable name, where only the first word is required: variable[.sensor][.height][.site]

References nidas::core::DSMSensor::_suffix.

Referenced by ExtractFast2D::countParticles(), nidas::core::DSMSensor::fromDOMElement(), nidas::core::DSMSensor::MyDictionary::getTokenValue(), ExtractFast2D::run(), ExtractDMT::run(), sensorTitle(), nidas::core::DSMSensor::setDepth(), and nidas::core::DSMSensor::setHeight().

int nidas::dynld::raf::TwoD_USB::getTASRate ( ) const
inlineinherited
int nidas::core::DSMSensor::getTimeoutCount ( ) const
inlineinherited
virtual int nidas::core::DSMSensor::getTimeoutMsecs ( ) const
inlinevirtualinherited
bool nidas::core::DSMSensor::getTokenValue ( const std::string &  token,
std::string &  value 
) const
inlineinherited

Implement a lookup for tokens that I know about, like $HEIGHT.

For other tokens, call getDSMConfig()->getTokenValue(token,value);

References nidas::core::DSMSensor::_dictionary, and nidas::core::DSMSensor::MyDictionary::getTokenValue().

virtual const std::string& nidas::core::DSMSensor::getTypeName ( void  ) const
inlinevirtualinherited

Get the type name of this sensor.

References nidas::core::DSMSensor::_typeName.

VariableIterator DSMSensor::getVariableIterator ( ) const
inherited
virtual int nidas::core::DSMSensor::getWriteFd ( ) const
inlinevirtualinherited
void nidas::core::DSMSensor::incrementTimeoutCount ( )
inlineinherited
void TwoD_USB::init ( )
throw (nidas::util::InvalidParameterException
)
virtualinherited
void TwoD_USB::init_parameters ( )
throw (nidas::util::InvalidParameterException
)
protectedvirtualinherited
virtual void nidas::core::DSMSensor::ioctl ( int  request,
void *  buf,
size_t  len 
)
throw (nidas::util::IOException
)
inlinevirtualinherited

Perform an ioctl on the device.

request is an integer value which must be supported by the device. Normally this is a value from a header file for the device.

References nidas::core::DSMSensor::_iodev, nidas::core::IODevice::ioctl(), and len.

virtual Sample* nidas::core::DSMSensor::nextSample ( )
inlinevirtualinherited
virtual int nidas::dynld::raf::TwoD32_USB::NumberOfDiodes ( ) const
inlinevirtual

Number of diodes in the probe array.

This is also the bits-per-slice value. Traditional 2D probes have 32 diodes, the HVPS has 128 and the Fast2DC has 64.

Returns
the number of bits per data slice.

Implements nidas::dynld::raf::TwoD_USB.

void TwoD_USB::open ( int  flags)
throw (nidas::util::IOException,
nidas::util::InvalidParameterException
)
virtualinherited
void TwoD_USB::printStatus ( std::ostream &  ostr)
throw (
)
virtualinherited
void DSMSensor::printStatusHeader ( std::ostream &  ostr)
throw (
)
inherited
void DSMSensor::printStatusTrailer ( std::ostream &  ostr)
throw (
)
inherited
bool TwoD32_USB::process ( const Sample ,
std::list< const Sample * > &  result 
)
throw (
)
virtual

Apply further necessary processing to a raw sample from this DSMSensor.

Return the resultant sample(s) in result. The default implementation of process() simply puts the input Sample into result.

Implements nidas::core::DSMSensor.

References bigEndian, nidas::util::EndianConverter::int32Value(), and TWOD_SOR_TYPE.

bool TwoD32_USB::processImage ( const Sample samp,
std::list< const Sample * > &  results,
int  stype 
)
throw (
)
protected
void TwoD_USB::processParticleSlice ( Particle p,
const unsigned char *  slice 
)
protectedvirtualinherited

Process a slice and update the Particle struct area, edgeTouch, width and height.

Parameters
pis particle info class.
sliceis a pointer to the start of the slice, in big-endian and uncomplemented.

References nidas::dynld::raf::TwoD_USB::Particle::area, nidas::dynld::raf::TwoD_USB::Particle::edgeTouch, nidas::dynld::raf::TwoD_USB::Particle::height, nidas::dynld::raf::TwoD_USB::NumberOfDiodes(), and nidas::dynld::raf::TwoD_USB::Particle::width.

virtual size_t nidas::core::DSMSensor::read ( void *  buf,
size_t  len 
)
throw (nidas::util::IOException
)
inlinevirtualinherited

Read from the device (duh).

Behaves like the read(2) system call, without a file descriptor argument, and with an IOException.

References nidas::core::DSMSensor::_iodev, len, and nidas::core::IODevice::read().

Referenced by main().

virtual size_t nidas::core::DSMSensor::read ( void *  buf,
size_t  len,
int  msecTimeout 
)
throw (nidas::util::IOException
)
inlinevirtualinherited

Read from the device with a timeout.

References nidas::core::DSMSensor::_iodev, len, and nidas::core::IODevice::read().

bool nidas::core::DSMSensor::readBuffer ( )
throw (nidas::util::IOException
)
inlineinherited
bool nidas::core::DSMSensor::readBuffer ( int  msecTimeout)
throw (nidas::util::IOException
)
inlineinherited
Sample * DSMSensor::readSample ( )
throw (nidas::util::IOException
)
virtualinherited

Return the next sample.

Buffer(s) will be read if necessary.

References nidas::core::DSMSensor::nextSample(), and nidas::core::DSMSensor::readBuffer().

Referenced by DmdA2dCk::run().

bool DSMSensor::readSamples ( )
throw (nidas::util::IOException
)
virtualinherited

Read samples from my associated file descriptor, and distribute() them to my RawSampleClient's.

This method is called by SensorHander, when select/poll indicates that data is available on the file descriptor returned by getReadFd(). This is a convienence method which does a readBuffer() to read available data from the DSMSensor into a buffer, and then repeatedly calls nextSample() to extract all samples out of that buffer.

References nidas::core::DSMSensor::_rawSource, nidas::core::SampleSourceSupport::distribute(), DLOG, nidas::core::DSMSensor::getDSMConfig(), nidas::core::DSMSensor::getDSMId(), nidas::core::Project::getName(), nidas::core::DSMSensor::getName(), nidas::core::DSMConfig::getProject(), nidas::core::DSMSensor::getSensorId(), nidas::core::DSMSensor::nextSample(), and nidas::core::DSMSensor::readBuffer().

Referenced by DmdA2dCk::run().

bool DSMSensor::receive ( const Sample s)
throw (
)
virtualinherited

A DSMSensor can be used as a SampleClient, meaning it receives its own raw samples.

In real-time operations, a DSMSensor can be added as a raw SampleClient of itself, using addRawSampleClient(). In post-processing, a DSMSensor typically receives samples with its own sample id from a SampleSorter. receive() then applies further processing via the process() method.

Implements nidas::core::SampleClient.

void DSMSensor::removeCalFiles ( )
inherited

Remove all CalFiles.

References nidas::core::DSMSensor::_calFiles.

Referenced by nidas::core::DSMSensor::~DSMSensor().

void nidas::core::DSMSensor::removeSampleClient ( SampleClient c)
throw (
)
inlinevirtualinherited
void nidas::core::DSMSensor::removeSampleClientForTag ( SampleClient client,
const SampleTag tag 
)
throw (
)
inlinevirtualinherited

Remove a SampleClient for a given SampleTag from this SampleSource.

The pointer to the SampleClient must remain valid, until after it is removed.

Implements nidas::core::SampleSource.

References nidas::core::DSMSensor::_source, and nidas::core::SampleSourceSupport::removeSampleClientForTag().

Referenced by nidas::core::SamplePipeline::removeSampleClientForTag().

void DSMSensor::removeSampleTag ( SampleTag val)
throw (
)
virtualinherited

Remove val from the list of SampleTags, and delete it.

virtual bool nidas::core::DSMSensor::reopenOnIOException ( ) const
inlinevirtualinherited

Whether to reopen this sensor on an IOException.

The base method returns true. Over-ride if a reopen should not be attempted.

void TwoD_USB::saveBuffer ( const unsigned char *  cp,
const unsigned char *  eod 
)
protectedinherited

In case of mis-aligned data, we may need to save some bytes at the end of an image block to pre-pend to the next block.

Parameters
cp,:Pointer to next byte in the image block to be saved.
eod,:Pointer to one-past-the-end of the image block. If cp is equal to eod, then nothing is saved, and this function does not need to be called.

References nidas::dynld::raf::TwoD_USB::_saveBuffer, nidas::dynld::raf::TwoD_USB::_savedAlloc, and nidas::dynld::raf::TwoD_USB::_savedBytes.

void TwoD_USB::sendTrueAirspeed ( float  tas)
throw (nidas::util::IOException
)
protectedvirtualinherited

Encode and send the true airspeed to the USB driver, which will in turn send it to the probe.

References nidas::util::Logger::getInstance(), nidas::util::Logger::log(), LOG_WARNING, and USB2D_SET_TAS.

virtual void nidas::core::DSMSensor::setApplyVariableConversions ( bool  val)
inlinevirtualinherited
virtual void nidas::core::DSMSensor::setCatalogName ( const std::string &  val)
inlinevirtualinherited

Set the name of the catalog entry for this sensor.

References nidas::core::DSMSensor::_catalogName.

Referenced by nidas::core::DSMSensor::fromDOMElement().

virtual void nidas::core::DSMSensor::setClassName ( const std::string &  val)
inlinevirtualinherited

Set the class name.

In the usual usage this method is not used, and getClassName() is over-ridden in a derived class to return a constant string.

References nidas::core::DSMSensor::_className.

Referenced by nidas::core::DSMSensor::fromDOMElement().

virtual void nidas::core::DSMSensor::setDefaultMode ( int  val)
inlinevirtualinherited
void DSMSensor::setDepth ( const std::string &  val)
inherited

Set sensor depth below ground via a string which is added to variable names.

Parameters
valString containing sensor below and units in meters (m) or centimeters(cm), e.g. "5cm". This depth string is added to all the variable names, with a "." separator, so that a variable "Tsoil" for this sensor becomes "Tsoil.5cm".

References nidas::core::DSMSensor::_depthString, nidas::core::DSMSensor::_height, nidas::core::DSMSensor::_heightString, nidas::core::floatNAN, nidas::core::DSMSensor::getSuffix(), and nidas::core::DSMSensor::setFullSuffix().

Referenced by nidas::core::DSMSensor::fromDOMElement().

void DSMSensor::setDepth ( float  val)
inherited

Set sensor depth below ground.

Parameters
valdepth below ground, in meters. The depth is converted to centimeters and is added to all the variable names, with a "." separator, so that a variable "Tsoil" for this sensor becomes "Tsoil.5cm".

References nidas::core::DSMSensor::_depthString, nidas::core::DSMSensor::_height, nidas::core::DSMSensor::_heightString, nidas::core::DSMSensor::getSuffix(), and nidas::core::DSMSensor::setFullSuffix().

virtual void nidas::core::DSMSensor::setDeviceName ( const std::string &  val)
inlinevirtualinherited

Set the name of the system device that the sensor is connected to.

Parameters
valName of device, e.g. "/dev/xxx0".

References nidas::core::DSMSensor::_devname.

Referenced by nidas::core::DSMSensor::fromDOMElement(), and main().

virtual void nidas::core::DSMSensor::setDriverTimeTagUsecs ( int  val)
inlinevirtualinherited
void DSMSensor::setDSMConfig ( const DSMConfig val)
inherited
void nidas::core::DSMSensor::setDSMId ( unsigned int  val)
inlineinherited
void nidas::core::DSMSensor::setDuplicateIdOK ( bool  val)
inlineinherited

Set the duplicate ID attribute of this DSMSensor.

References nidas::core::DSMSensor::_duplicateIdOK.

Referenced by nidas::core::DSMSensor::fromDOMElement().

void nidas::core::DSMSensor::setFullSuffix ( const std::string &  val)
inlineprotectedinherited
void DSMSensor::setHeight ( const std::string &  val)
inherited

Set sensor height above ground via a string which is added to variable names.

Parameters
valString containing sensor height and units in meters (m) or centimeters(cm), e.g. "15m". This height string is added to all the variable names, with a "." separator, so that a variable "u" for this sensor becomes "u.15m".

References nidas::core::DSMSensor::_depthString, nidas::core::DSMSensor::_height, nidas::core::DSMSensor::_heightString, nidas::core::floatNAN, nidas::core::DSMSensor::getSuffix(), and nidas::core::DSMSensor::setFullSuffix().

Referenced by nidas::core::DSMSensor::fromDOMElement().

void DSMSensor::setHeight ( float  val)
inherited

Set sensor height above ground.

Parameters
valheight above ground, in meters. The height is added to all the variable names, with a "." separator, so that a variable "u" for this sensor becomes "u.15m".

References nidas::core::DSMSensor::_depthString, nidas::core::DSMSensor::_height, nidas::core::DSMSensor::_heightString, nidas::core::DSMSensor::getSuffix(), and nidas::core::DSMSensor::setFullSuffix().

void nidas::core::DSMSensor::setId ( dsm_sample_id_t  val)
inlineinherited

Set the various levels of the sensor identification.

A sensor ID is a 32-bit value comprised of four parts: 6-bit sample type id (not used by DSMSensor), 10-bit DSM id, and 16-bit sensor+sample ids.

References nidas::core::DSMSensor::_id, and SET_FULL_ID.

void nidas::core::DSMSensor::setIODevice ( IODevice val)
inlineinherited

Set the IODevice for this sensor.

DSMSensor then owns the pointer and will delete it in its destructor.

References nidas::core::DSMSensor::_iodev.

virtual void nidas::core::DSMSensor::setLagSecs ( double  val)
inlineprotectedvirtualinherited

Set the sampling lag for this sensor in seconds.

This lag should then used to correct the timetags of the processed samples in the process() method of derived classes. Note that this lag is not used to alter the timetags of the raw samples. Raw samples are saved with the un-altered timetag that was determined at the moment they were sampled.

The lag is stored as a signed integer of microseconds, so lags should be between += 2147 seconds. No warning or exception is given if the value exceeds that limit. If your lag is greater than that I suggest you junk your sensor! A positive lag means one should adjust the sample time tags for this sensor earlier in time to achieve a better estimate of the actual time to be associated for each sample. A fixed sample lag, in fractional seconds, can be set for a sensor in the XML:

<parameter name="lag" type = "float" value="0.186"/>

The DSMSensor::fromDOM() method parses this parameter and calls this method to set the lag. process() methods in derived classes must apply this lag value. The DSMSensor base class does not adjust time tags of processed samples.

References nidas::core::DSMSensor::_lag, and USECS_PER_SEC.

Referenced by nidas::core::DSMSensor::fromDOMElement().

virtual void nidas::core::DSMSensor::setLatency ( float  val)
throw (nidas::util::InvalidParameterException
)
inlinevirtualinherited

Set desired latency, providing some control over the response time vs buffer efficiency tradeoff.

Setting a latency of 1/10 sec means buffer data in the driver for a 1/10 sec, then send the data to user space. Generally it should be set before doing a sensor open().

Parameters
valLatency, in seconds.

References nidas::core::DSMSensor::_latency.

Referenced by nidas::dynld::A2DSensor::A2DSensor(), nidas::core::DSMSensor::fromDOMElement(), and nidas::dynld::A2DSensor::validate().

void nidas::core::DSMSensor::setLocation ( const std::string &  val)
inlineinherited
void nidas::core::DSMSensor::setSampleScanner ( SampleScanner val)
inlineinherited

Set the SampleScanner for this sensor.

DSMSensor then owns the pointer and will delete it in its destructor.

References nidas::core::DSMSensor::_scanner.

void nidas::core::DSMSensor::setSensorId ( unsigned int  val)
inlineinherited
void DSMSensor::setStation ( int  val)
inherited
void DSMSensor::setSuffix ( const std::string &  val)
inherited
void nidas::dynld::raf::TwoD_USB::setTASRate ( int  val)
inlineinherited
virtual void nidas::core::DSMSensor::setTimeoutMsecs ( int  val)
inlinevirtualinherited

Set the sensor timeout value in milliseconds.

A value of 0 means no timeout (e.g. infinite). If no data is received for this period, then the sensor is closed, and re-opened. For efficiency reasons, the system may not actually detect a sensor timeout of less than 1 second, so setting it to less than 1000 milliseconds will likely not reduce the time before a sensor timeout is detected.

References nidas::core::DSMSensor::_timeoutMsecs.

Referenced by nidas::core::RemoteSerialConnection::close(), and nidas::core::DSMSensor::fromDOMElement().

virtual void nidas::core::DSMSensor::setTypeName ( const std::string &  val)
inlinevirtualinherited

Set the type name of this sensor, e.g.

: "ACME Model 99 Mach7 Particle Disambiguator". This is meant for descriptive purposes only, and is not meant to change the behavior of a sensor object.

References nidas::core::DSMSensor::_typeName.

Referenced by nidas::core::DSMSensor::fromDOMElement().

void TwoD_USB::setupBuffer ( const unsigned char **  cp,
const unsigned char **  eod 
)
protectedinherited

Derived Classes should call this at the beginning of processing an image block.

If bytes were saved from the end of the last image block, then the pointers are adjusted to point to a new buffer that contains the saved and the new data.

Parameters
cp,:Pointer to pointer of first slice in the new image block to be processed, after the TAS word.
eod,:Pointer to pointer to one-past-the-end of the image block.

References nidas::dynld::raf::TwoD_USB::_saveBuffer, nidas::dynld::raf::TwoD_USB::_savedAlloc, and nidas::dynld::raf::TwoD_USB::_savedBytes.

float TwoD_USB::Tap2DToTAS ( const Tap2D t2d) const
virtualinherited

Reverse the true airspeed encoding.

Used to extract TAS from recorded records. The *v1 method is for the first generation TAS clock, the second generation gives finer resolution (07/01/2009). Second generation chip is an Analog Devices AD5255.

Parameters
t2dthe Tap2D to extract from.
theprobe frequency.
Returns
true airspeed in m/s.
Todo:
2DP is going to need an extra divide by 10 at the end.

Reimplemented in nidas::dynld::raf::TwoD64_USB_v3.

References _Tap2D_v2::div10, nidas::dynld::raf::TwoD_USB::getResolution(), and _Tap2D_v2::ntap.

float TwoD_USB::Tap2DToTAS ( const Tap2Dv1 t2d) const
virtualinherited

The first generation used the Maxim 5418 chip.

This is for legacy data (PACDEX through VOCALS).

References _Tap2D_v1::div10, nidas::dynld::raf::TwoD_USB::getResolution(), and _Tap2D_v1::ntap.

int TwoD_USB::TASToTap2D ( void *  t2d,
float  tas 
)
virtualinherited

Build the struct above from the true airspeed (in m/s).

Encodes for Analog Devices AD5255.

Parameters
t2dthe Tap2D to be filled
tasthe true airspeed in m/s

Reimplemented in nidas::dynld::raf::TwoD64_USB_v3.

References nidas::dynld::raf::TwoD_USB::DefaultTrueAirspeed, _Tap2D_v2::div10, nidas::dynld::raf::TwoD_USB::getResolution(), and _Tap2D_v2::ntap.

virtual void nidas::dynld::raf::TwoD_USB::throw ( )
virtualinherited
xercesc::DOMElement * DSMSensor::toDOMElement ( xercesc::DOMElement *  node,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited

Add my content into a DOMElement.

Reimplemented from nidas::core::DOMable.

Referenced by nidas::core::DSMSensor::toDOMParent().

xercesc::DOMElement * DSMSensor::toDOMParent ( xercesc::DOMElement *  parent,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited
void DSMSensor::trimUnparsed ( SampleTag stag,
SampleT< float > *  outs,
int  nparsed 
)
protectedinherited

Fill with floatNAN all the values past nparsed values in output sample outs, and trim the length of the sample to match the length of the variables in SampleTag stag.

process() methods which support partial scans of messages can use this to finalize an output sample according to the SampleTag that was matched with it and the number of values parsed.

References nidas::core::floatNAN, fp, nidas::core::SampleT< DataT >::getDataPtr(), nidas::core::Variable::getLength(), nidas::core::SampleTag::getVariables(), and nidas::core::SampleT< DataT >::setDataLength().

void DSMSensor::validate ( )
throw (nidas::util::InvalidParameterException
)
virtualinherited
virtual size_t nidas::core::DSMSensor::write ( const void *  buf,
size_t  len 
)
throw (nidas::util::IOException
)
inlinevirtualinherited

Write to the device (duh).

Behaves like write(2) system call, without a file descriptor argument, and with an IOException.

References nidas::core::DSMSensor::_iodev, len, and nidas::core::IODevice::write().

Referenced by nidas::dynld::raf::UHSAS_Serial::sendInitString(), and nidas::core::CharacterSensor::sendInitString().

Member Data Documentation

dsm_sample_id_t nidas::dynld::raf::TwoD_USB::_1dcID
protectedinherited
dsm_sample_id_t nidas::dynld::raf::TwoD_USB::_2dcID
protectedinherited
const unsigned char TwoD32_USB::_blankString = {0xff, 0xff, 0xff, 0xff}
staticprotected
float nidas::dynld::raf::TwoD_USB::_dead_time
protectedinherited

Amount of time probe was inactive or amount of time consumed by rejected particles.

nimbus will then subtract this deadtime out of the sample volume.

Referenced by nidas::dynld::raf::TwoD_USB::clearData().

long long nidas::dynld::raf::TwoD_USB::_histoEndTime
protectedinherited

The end time of the current histogram.

long long nidas::dynld::raf::TwoD_USB::_lastStatusTime
protectedinherited

Time of last printStatus.

unsigned int nidas::dynld::raf::TwoD_USB::_misAligned
protectedinherited
int nidas::dynld::raf::TwoD_USB::_nextraValues
protectedinherited

If XML file has a variable RPS (records per second) defined, then _nextravalues will be 2, otherwise 1.

This keeps us from having to retrofit old XML files.

See Also
init()
process()

Referenced by nidas::dynld::raf::TwoD_USB::init().

unsigned int nidas::dynld::raf::TwoD_USB::_numImages
protectedinherited

Number of image blocks processed by driver at time of last printStatus.

bool nidas::core::DSMSensor::_openable
protectedinherited

Whether this sensor is allowed to be opened.

Most cases the answer is yes/true. But certain sensors should not be opened due to implementation. e.g. DSMArincSensor when used in conjunction with the UDPArincSensor for then Alta ENET appliance.

The fallout from setting this to false is that the sensor will not be added to SensorHandler.

Referenced by nidas::core::DSMSensor::allowOpen().

const unsigned char TwoD32_USB::_overldString = {0x55, 0xaa}
staticprotected
unsigned int nidas::dynld::raf::TwoD_USB::_overLoadSliceCount
protectedinherited
unsigned int nidas::dynld::raf::TwoD_USB::_overSizeCount_2D
protectedinherited
Particle nidas::dynld::raf::TwoD_USB::_particle
protectedinherited

Current particle information.

This is in here, since a particle can cross samples/records.

dsm_time_t nidas::dynld::raf::TwoD_USB::_prevTime
protectedinherited

Time from previous record.

Time belongs to end of record it came with, or start of the next record. Save it so we can use it as a start.

Referenced by nidas::dynld::raf::TwoD_USB::init().

unsigned int nidas::dynld::raf::TwoD_USB::_recordsPerSecond
protectedinherited
unsigned int nidas::dynld::raf::TwoD_USB::_rejected1D_Cntr
protectedinherited
unsigned int nidas::dynld::raf::TwoD_USB::_rejected2D_Cntr
protectedinherited
float nidas::dynld::raf::TwoD_USB::_resolutionMeters
protectedinherited

Probe resolution in meters.

Acquired from XML config file.

Referenced by nidas::dynld::raf::TwoD_USB::init_parameters().

unsigned int nidas::dynld::raf::TwoD_USB::_resolutionMicron
protectedinherited

Probe resolution in micrometers.

Acquired from XML config file.

Referenced by nidas::dynld::raf::TwoD_USB::init_parameters().

unsigned char* nidas::dynld::raf::TwoD_USB::_saveBuffer
protectedinherited
int nidas::dynld::raf::TwoD_USB::_savedAlloc
protectedinherited
int nidas::dynld::raf::TwoD_USB::_savedBytes
protectedinherited
unsigned int* nidas::dynld::raf::TwoD_USB::_size_dist_1D
protectedinherited
unsigned int* nidas::dynld::raf::TwoD_USB::_size_dist_2D
protectedinherited
dsm_sample_id_t nidas::dynld::raf::TwoD_USB::_sorID
protectedinherited

Shadow OR sample ID.

Shadow-OR is the total number of particle triggers the probes saw, regardless of how many images were downloaded. The 32 bit 2D probes which use the white USB box, don't send shadow-OR via USB. So this sample ID is only used by the Fast2DC. We need to stash sample ID's since the XML will not quite look the same between Fast2DC and 2Ds using the white USB box. The sample IDs will be acquired in the formDOM looking for specific (read hard-coded) string names. Not sure what the best approach is....

Referenced by nidas::dynld::raf::TwoD64_USB::init_parameters().

unsigned int nidas::dynld::raf::TwoD_USB::_suspectSlices
protectedinherited
unsigned int nidas::dynld::raf::TwoD_USB::_tasOutOfRange
protectedinherited
int nidas::dynld::raf::TwoD_USB::_tasRate
protectedinherited

How often to send the true air speed.

Probes also send back the shadowOR when they receive the true airspeed, so in general this is also the receive rate of the shadowOR.

unsigned int nidas::dynld::raf::TwoD_USB::_totalParticles
protectedinherited
unsigned int nidas::dynld::raf::TwoD_USB::_totalPixelsShadowed
protectedinherited

total # of pixels shadoweded in the time period. per second...

Referenced by nidas::dynld::raf::TwoD_USB::clearData(), and nidas::dynld::raf::TwoD_USB::countParticle().

unsigned int nidas::dynld::raf::TwoD_USB::_totalRecords
protectedinherited

Statistics variables for processRecord().

Referenced by nidas::dynld::raf::TwoD_USB::~TwoD_USB().

float nidas::dynld::raf::TwoD_USB::_trueAirSpeed
protectedinherited

True air speed, received from IWGADTS feed.

float nidas::dynld::raf::TwoD_USB::_twoDAreaRejectRatio
protectedinherited

Area of particle rejection ratio.

Actual area of particle divided area of bounding box must be greater than this.

See Also
acceptThisParticle1D()

Referenced by nidas::dynld::raf::TwoD_USB::acceptThisParticle1D(), nidas::dynld::raf::TwoD_USB::acceptThisParticle2D(), and nidas::dynld::raf::TwoD_USB::init().

const n_u::EndianConverter * TwoD_USB::bigEndian
staticprotectedinherited
Initial value:
const float TwoD_USB::DefaultTrueAirspeed = 23.0
staticprotectedinherited
const n_u::EndianConverter * TwoD_USB::littleEndian
staticprotectedinherited
Initial value:

The documentation for this class was generated from the following files: