nidas
v1.2-1520
|
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor attached to a DSM. More...
#include <DSMSensor.h>
Classes | |
class | MyDictionary |
Public Member Functions | |
DSMSensor () | |
Constructor. More... | |
virtual | ~DSMSensor () |
void | setDSMConfig (const DSMConfig *val) |
Set the DSMConfig for this sensor. More... | |
const DSMConfig * | getDSMConfig () const |
What DSMConfig am I associated with? More... | |
const Site * | getSite () 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 Dictionary & | getDictionary () const |
SampleSource * | getRawSampleSource () |
Implementation of SampleSource::getRawSampleSource(). More... | |
SampleSource * | getProcessedSampleSource () |
Implementation of SampleSource::getProcessedSampleSource(). More... | |
const SampleTag * | getRawSampleTag () 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 SampleStats & | getSampleStats () 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 Parameter * | getParameter (const std::string &name) const |
Fetch a parameter by name. More... | |
virtual IODevice * | buildIODevice ()=0 throw (nidas::util::IOException) |
Factory method for an IODevice for this DSMSensor. More... | |
void | setIODevice (IODevice *val) |
Set the IODevice for this sensor. More... | |
virtual SampleScanner * | buildSampleScanner ()=0 throw (nidas::util::InvalidParameterException) |
Factory method for a SampleScanner for this DSMSensor. 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 void | open (int flags) throw (nidas::util::IOException,nidas::util::InvalidParameterException) |
Open the device. More... | |
virtual void | init () throw (nidas::util::InvalidParameterException) |
Initialize the DSMSensor. 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 void | close () throw (nidas::util::IOException) |
close my associated 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 Sample * | nextSample () |
Extract the next sample from the buffer. More... | |
virtual Sample * | readSample () 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... | |
virtual bool | process (const Sample *, std::list< const Sample * > &result)=0 throw () |
Apply further necessary processing to a raw sample from this DSMSensor. More... | |
void | printStatusHeader (std::ostream &ostr) throw () |
virtual void | printStatus (std::ostream &) 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... | |
CalFile * | getCalFile (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... | |
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 | |
void | clearBuffer () |
Clear the internal buffer. More... | |
IODevice * | getIODevice () const |
SampleScanner * | getSampleScanner () 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... | |
Static Protected Member Functions | |
static Looper * | getLooper () |
Fetch a pointer to a static instance of a Looper thread. More... | |
Protected Attributes | |
bool | _openable |
Whether this sensor is allowed to be opened. More... | |
Private Member Functions | |
void | addSampleTag (const SampleTag *val) throw (nidas::util::InvalidParameterException) |
DSMSensor does provide public support for SampleSource::addSampleTag(const SampleTag* val). More... | |
void | removeSampleTag (const SampleTag *val) throw () |
DSMSensor does not provide public support for SampleSource::removeSampleTag(const SampleTag* val) More... | |
DSMSensor (const DSMSensor &x) | |
DSMSensor & | operator= (const DSMSensor &x) |
Private Attributes | |
std::string | _devname |
nidas::core::DSMSensor::MyDictionary | _dictionary |
IODevice * | _iodev |
int | _defaultMode |
std::string | _className |
Class name attribute of this sensor. More... | |
std::string | _catalogName |
std::string | _suffix |
Sensor suffix, which is added to variable names. More... | |
std::string | _heightString |
std::string | _depthString |
float | _height |
std::string | _fullSuffix |
Concatenation of sensor suffix, and the height or depth string. More... | |
std::string | _location |
SampleScanner * | _scanner |
const DSMConfig * | _dsm |
dsm_sample_id_t | _id |
Id of this sensor. More... | |
SampleTag | _rawSampleTag |
std::list< SampleTag * > | _sampleTags |
SampleSourceSupport | _rawSource |
SampleSourceSupport | _source |
float | _latency |
std::map< std::string, Parameter * > | _parameters |
Map of parameters by name. More... | |
std::list< const Parameter * > | _constParameters |
List of const pointers to Parameters for providing via getParameters(). More... | |
std::map< std::string, CalFile * > | _calFiles |
std::string | _typeName |
int | _timeoutMsecs |
bool | _duplicateIdOK |
bool | _applyVariableConversions |
int | _driverTimeTagUsecs |
int | _nTimeouts |
int | _lag |
int | _station |
Static Private Attributes | |
static bool | zebra = false |
static Looper * | _looper = 0 |
static nidas::util::Mutex | _looperMutex |
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor attached to a DSM.
Much of the implementation of a DSMSensor is delegated to an IODevice and a SampleScanner, which are built with virtual methods. DSMSensor can fill in its attributes from an XML DOM element with fromDOMElement(). One attribute of a DSMSensor is the system device name associated with this sensor, e.g. "/dev/xxx0". Once a device name has been set, then a user of this sensor can call open(), and then ioctl(), read() and write(), which are carried out by the IODevice.
SampleClient's can call addRawSampleClient()/removeRawSampleClient() if they want to receive raw Samples from this sensor during real-time operations.
SampleClient's can also call addSampleClient()/removeSampleClient() if they want to receive processed Samples from this sensor.
A common usage of a DSMSensor is to add it to a SensorHandler object with SensorHandler::addSensorPort(). When the SensorHandler::run method has determined that there is data available on a DSMSensor's file descriptor, it will then call the readSamples() method which reads the samples from the IODevice, and forwards the raw and processed samples to all associated SampleClient's of this DSMSensor.
DSMSensor::DSMSensor | ( | ) |
Constructor.
|
virtual |
References _iodev, _parameters, _sampleTags, _scanner, and removeCalFiles().
|
private |
void DSMSensor::addCalFile | ( | CalFile * | val | ) |
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 _calFiles, and nidas::core::CalFile::getName().
Referenced by fromDOMElement().
void DSMSensor::addParameter | ( | Parameter * | val | ) |
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 _constParameters, _parameters, and nidas::core::Parameter::getName().
Referenced by fromDOMElement().
|
inlinevirtual |
Add a SampleClient to this SampleSource.
The pointer to the SampleClient must remain valid, until after it is removed.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::addSampleClient().
Referenced by nidas::core::SamplePipeline::addSampleClient(), and nidas::core::SamplePipeline::addSampleClientForTag().
|
inlinevirtual |
Add a SampleClient to this SampleSource.
The pointer to the SampleClient must remain valid, until after it is removed.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::addSampleClientForTag().
Referenced by nidas::core::SamplePipeline::addSampleClientForTag().
|
virtual |
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(), fromDOMElement(), and main().
|
privatevirtual |
DSMSensor does provide public support for SampleSource::addSampleTag(const SampleTag* val).
Implements nidas::core::SampleSource.
|
inline |
References _openable.
Referenced by nidas::core::DSMConfig::addSensor().
|
protected |
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().
|
pure virtual |
Factory method for an IODevice for this DSMSensor.
Must be implemented by derived classes.
Implemented in nidas::core::SerialSensor, nidas::dynld::raf::DSMArincSensor, TestMesa, nidas::dynld::UDPSocketSensor, nidas::dynld::raf::LamsSensor, nidas::core::CharacterSensor, nidas::dynld::DSC_Event, nidas::dynld::DSC_FreqCounter, nidas::dynld::raf::IRIGSensor, nidas::dynld::DSC_PulseCounter, nidas::dynld::IR104_Relays, nidas::dynld::raf::TwoD_USB, nidas::dynld::DSC_A2DSensor, nidas::dynld::raf::CVI_LV_Input, nidas::dynld::raf::PSI9116_Sensor, nidas::dynld::raf::DSMMesaSensor, nidas::dynld::raf::DSMAnalogSensor, and nidas::dynld::raf::A2DBoardTempSensor.
|
pure virtual |
Factory method for a SampleScanner for this DSMSensor.
Must be implemented by derived classes.
Implemented in nidas::dynld::raf::DSMArincSensor, nidas::dynld::GPS_NMEA_Serial, nidas::core::SerialSensor, TestMesa, nidas::core::CharacterSensor, nidas::dynld::UDPSocketSensor, nidas::dynld::raf::LamsSensor, nidas::dynld::DSC_Event, nidas::dynld::DSC_FreqCounter, nidas::dynld::raf::IRIGSensor, nidas::dynld::DSC_PulseCounter, nidas::dynld::IR104_Relays, nidas::dynld::raf::TwoD_USB, nidas::dynld::DSC_A2DSensor, nidas::dynld::raf::DSMMesaSensor, nidas::dynld::raf::DSMAnalogSensor, nidas::dynld::raf::A2DBoardTempSensor, and nidas::dynld::raf::PHIPS_UDP.
|
inline |
Update the sensor sampling statistics.
Should be called every periodUsec by a user of this sensor.
periodUsec | Statistics period. |
References _scanner, and nidas::core::SampleScanner::calcStatistics().
Referenced by nidas::core::SensorHandler::calcStatistics().
|
inlineprotected |
Clear the internal buffer.
References _scanner, and nidas::core::SampleScanner::clearBuffer().
Referenced by nidas::dynld::raf::UHSAS_Serial::sendInitString().
|
virtual |
close my associated device.
Reimplemented in nidas::dynld::raf::PIP_Serial, nidas::core::SerialSensor, nidas::dynld::raf::DSMArincSensor, nidas::dynld::raf::LamsSensor, nidas::dynld::DSC_Event, nidas::dynld::DSC_PulseCounter, nidas::dynld::raf::IRIGSensor, nidas::dynld::DSC_A2DSensor, nidas::dynld::raf::TwoD_USB, nidas::dynld::A2DSensor, nidas::dynld::raf::A2DBoardTempSensor, nidas::dynld::raf::DSMAnalogSensor, nidas::dynld::raf::PPT_Serial, nidas::dynld::raf::UDPArincSensor, nidas::dynld::raf::AlicatSDI, nidas::dynld::raf::VCSEL_Serial, nidas::dynld::raf::VCSEL2_Serial, and nidas::dynld::isff::MOSMote.
References _iodev, nidas::core::IODevice::close(), getDeviceName(), getTimeoutCount(), and NLOG.
Referenced by nidas::dynld::raf::UDPArincSensor::close(), nidas::dynld::raf::DSMAnalogSensor::close(), nidas::dynld::A2DSensor::close(), nidas::dynld::raf::TwoD_USB::close(), nidas::dynld::DSC_Event::close(), nidas::dynld::DSC_PulseCounter::close(), nidas::dynld::raf::DSMArincSensor::close(), nidas::core::SerialSensor::close(), nidas::dynld::raf::PIP_Serial::close(), nidas::core::SensorHandler::PolledDSMSensor::close(), nidas::core::SensorOpener::run(), and nidas::core::SensorHandler::run().
|
static |
References _looper, and _looperMutex.
Referenced by nidas::core::DSMEngine::main().
|
inline |
Distribute a raw sample which has been read from my file descriptor in real time.
References _rawSource, and nidas::core::SampleSourceSupport::distribute().
|
inlinevirtual |
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().
|
inline |
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 _dictionary, and nidas::core::Dictionary::expandString().
Referenced by fromDOMElement(), and nidas::core::CalFile::open().
|
protected |
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(), getSampleTags(), and nidas::core::SampleTag::getVariables().
|
inlinevirtual |
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().
|
virtual |
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 _dictionary, _rawSampleTag, _rawSource, _sampleTags, addCalFile(), addParameter(), nidas::core::SampleSourceSupport::addSampleTag(), addSampleTag(), nidas::core::Parameter::createParameter(), expandString(), nidas::core::SensorCatalog::find(), nidas::core::Parameter::FLOAT_PARAM, nidas::core::SampleTag::fromDOMElement(), nidas::core::CalFile::fromDOMElement(), getApplyVariableConversions(), nidas::core::XDOMElement::getAttributeValue(), getClassName(), getDefaultMode(), getDSMConfig(), nidas::core::SampleTag::getDSMId(), getFullSuffix(), nidas::core::SampleTag::getId(), getId(), nidas::util::Logger::getInstance(), nidas::core::Parameter::getLength(), nidas::core::Parameter::getName(), nidas::core::DSMConfig::getName(), nidas::core::XDOMAttr::getName(), 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(), getSampleTags(), nidas::core::Project::getSensorCatalog(), getSensorId(), getSite(), nidas::core::SampleTag::getSpSId(), getStation(), getSuffix(), nidas::core::Parameter::getType(), getVariableIterator(), nidas::core::VariableIterator::hasNext(), nidas::core::Parameter::INT_PARAM, nidas::util::Logger::log(), LOG_WARNING, MSECS_PER_SEC, nidas::core::VariableIterator::next(), setApplyVariableConversions(), setCatalogName(), setClassName(), setDefaultMode(), setDepth(), setDeviceName(), nidas::core::SampleTag::setDSMConfig(), nidas::core::SampleTag::setDSMId(), nidas::core::SampleTag::setDSMSensor(), nidas::core::CalFile::setDSMSensor(), setDuplicateIdOK(), setHeight(), setLagSecs(), setLatency(), setLocation(), nidas::core::SampleTag::setRate(), nidas::core::SampleTag::setSampleId(), nidas::core::SampleTag::setSensorId(), setSensorId(), nidas::core::SampleTag::setStation(), setStation(), nidas::core::SampleTag::setSuffix(), setSuffix(), setTimeoutMsecs(), setTypeName(), and nidas::util::Exception::what().
Referenced by nidas::dynld::raf::DSMArincSensor::fromDOMElement(), nidas::core::CharacterSensor::fromDOMElement(), and nidas::core::DSMConfig::sensorFromDOMElement().
|
inlinevirtual |
|
inline |
References _scanner, and nidas::core::SampleScanner::getBadTimeTagCount().
Referenced by printStatus().
|
inlinevirtual |
How many bytes are available to read on this sensor.
References _iodev, and nidas::core::IODevice::getBytesAvailable().
CalFile * DSMSensor::getCalFile | ( | const std::string & | name | ) |
|
inline |
Return the collection of CalFiles, mapped by name.
References _calFiles.
Referenced by sensorTitle(), and PConfig::showCalFiles().
|
inlinevirtual |
Fetch the name of the catalog entry for this sensor.
References _catalogName.
Referenced by SampleCounter::collectMetadata(), ExtractFast2D::countParticles(), SampleToDatabase::defaultMeasurementName(), parseOther(), printStatus(), ExtractDMT::run(), ExtractFast2D::run(), sensorTitle(), and PConfig::showCalFiles().
|
inlinevirtual |
Fetch the class name.
References _className.
Referenced by SampleCounter::collectMetadata(), fromDOMElement(), getClassName(), parseAnalog(), parseOther(), printStatus(), nidas::dynld::raf::DSMArincSensor::registerWithUDPArincSensor(), nidas::core::DSMConfig::sensorFromDOMElement(), sensorTitle(), PConfig::showAll(), PConfig::showCalFiles(), PConfig::showSensorClasses(), and nidas::dynld::raf::UDPArincSensor::~UDPArincSensor().
|
static |
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 getClassName().
|
inlinevirtual |
How many SampleClients are currently in my list.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getClientCount().
|
inlinevirtual |
How do I want to be opened.
The user can ignore it if they want to.
References _defaultMode.
Referenced by fromDOMElement(), and nidas::core::SensorOpener::run().
|
inline |
|
inline |
Get sensor depth below ground in a string.
References _depthString.
Referenced by SampleCounter::collectMetadata().
|
inlinevirtual |
Fetch the name of the system device that the sensor is connected to.
References _devname.
Referenced by nidas::core::SensorHandler::add(), nidas::core::CharacterSensor::buildIODevice(), nidas::core::SerialSensor::buildIODevice(), nidas::core::CharacterSensor::buildSampleScanner(), close(), SampleCounter::collectMetadata(), DataStats::createCounters(), getName(), parseOther(), printStatus(), nidas::dynld::raf::DSMArincSensor::registerWithUDPArincSensor(), DmdA2dCk::run(), nidas::core::CharacterSensor::sendInitString(), nidas::core::DSMConfig::sensorFromDOMElement(), sensorTitle(), PConfig::showCalFiles(), and validate().
|
inline |
References _dictionary.
|
inlinevirtual |
References _driverTimeTagUsecs.
Referenced by nidas::core::DriverSampleScanner::nextSample().
|
inline |
What DSMConfig am I associated with?
References _dsm.
Referenced by SampleCounter::collectMetadata(), DataStats::createCounters(), fromDOMElement(), SampleCounter::generateStreamId(), nidas::core::VariableConverter::getDSMConfig(), nidas::core::DSMSensor::MyDictionary::getTokenValue(), printStatusHeader(), readSamples(), nidas::dynld::raf::DSMArincSensor::registerWithUDPArincSensor(), nidas::core::SampleTag::setDSMSensor(), and validate().
|
inline |
References _id, and GET_DSM_ID.
Referenced by nidas::core::Site::findSensor(), readSamples(), sensorTitle(), PConfig::showAll(), PConfig::showSensorClasses(), nidas::core::Site::validate(), nidas::core::DSMConfig::validateSensorAndSampleIds(), nidas::core::MessageStreamScanner::warnBackwardsStepTimeTag(), and nidas::core::MessageStreamScanner::warnNonIncrTimeTag().
const std::string & DSMSensor::getDSMName | ( | ) | const |
Fetch the DSM name.
References _dsm, and nidas::core::DSMConfig::getName().
Referenced by getName().
|
inline |
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 _duplicateIdOK.
Referenced by nidas::core::Site::validate(), and nidas::core::DSMConfig::validateSensorAndSampleIds().
|
inline |
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 _fullSuffix.
Referenced by fromDOMElement().
|
inline |
Get sensor height above ground.
References _height.
|
inline |
Get sensor height above ground in a string.
References _heightString.
Referenced by SampleCounter::collectMetadata(), nidas::core::DSMSensor::MyDictionary::getTokenValue(), ARLIngest::prepareHeaderIds(), SampleToDatabase::SampleToDatabase(), and PConfig::showCalFiles().
|
inline |
Get the various levels of the samples identification.
A sample tag ID is a 32-bit value comprised of four parts: 6-bit sample type id(not used by DSMSensor), a 10-bit DSM id, 16-bit sensor+sample ids.
References _id, and GET_FULL_ID.
Referenced by DataStats::createCounters(), nidas::core::Site::findSensor(), fromDOMElement(), nidas::core::TimetagAdjuster::log(), nidas::core::DriverSampleScanner::nextSample(), nidas::core::DatagramSampleScanner::nextSample(), nidas::core::MessageStreamScanner::nextSampleByLength(), nidas::core::MessageStreamScanner::nextSampleSepBOM(), nidas::core::MessageStreamScanner::nextSampleSepEOM(), nidas::core::SampleTag::SampleTag(), and nidas::core::DSMConfig::validateSensorAndSampleIds().
|
inlineprotectedvirtual |
Return the sampling lag for this sensor in seconds.
See getLagUsecs().
References _lag, and USECS_PER_SEC.
|
inlineprotectedvirtual |
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:
The DSMSensor::fromDOM() method parses this parameter and sets the value of the lag.
References _lag.
Referenced by nidas::core::CharacterSensor::adjustTimeTag().
|
inlinevirtual |
References _latency.
const std::string & DSMSensor::getLocation | ( | ) | const |
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 _dsm, _location, and nidas::core::DSMConfig::getLocation().
Referenced by SampleCounter::collectMetadata(), and printStatusHeader().
|
staticprotected |
Fetch a pointer to a static instance of a Looper thread.
Use this Looper for periodic callbacks, as for prompting, in support of a DSMSensor.
References _looper, _looperMutex, nidas::util::Logger::getInstance(), nidas::util::Thread::getPolicyString(), nidas::util::Logger::log(), LOG_WARNING, nidas::util::Thread::NU_THREAD_RR, nidas::util::Thread::setThreadScheduler(), and nidas::util::Exception::what().
Referenced by nidas::core::SerialSensor::startPrompting(), and nidas::core::SerialSensor::stopPrompting().
|
inline |
References _scanner, and nidas::core::SampleScanner::getMaxSampleLength().
Referenced by printStatus().
|
inline |
References _scanner, and nidas::core::SampleScanner::getMinSampleLength().
Referenced by printStatus().
|
inlinevirtual |
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 getDeviceName(), and 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(), 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(), printStatusHeader(), 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(), 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().
|
inlinestaticinherited |
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inlinevirtual |
We'll allow derived classes and calibration applications to change the SampleTags, so this method returns a list of non-constant SampleTags.
References _sampleTags.
|
inline |
References _scanner, and nidas::core::SampleScanner::getObservedDataRate().
Referenced by printStatus().
|
inline |
References _scanner, and nidas::core::SampleScanner::getObservedSamplingRate().
Referenced by printStatus().
const Parameter * DSMSensor::getParameter | ( | const std::string & | name | ) | const |
Fetch a parameter by name.
Returns a NULL pointer if no such parameter exists.
References _parameters.
Referenced by nidas::dynld::raf::UHSAS_Serial::init(), nidas::dynld::WxtSensor::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::raf::TwoD_USB::init_parameters(), ExtractFast2D::run(), ExtractDMT::run(), sensorTitle(), nidas::dynld::raf::UDPArincSensor::validate(), and nidas::dynld::raf::SppSerial::validate().
|
inline |
Get list of parameters.
References _constParameters.
Referenced by nidas::dynld::A2DSensor::validate().
|
inlinevirtual |
Implementation of SampleSource::getProcessedSampleSource().
Return the SampleSource for processed samples from this DSMSensor.
Implements nidas::core::SampleSource.
Referenced by nidas::dynld::RawSampleService::schedule().
|
inlinevirtual |
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 _rawSource.
Referenced by nidas::core::RemoteSerialConnection::close(), and nidas::dynld::RawSampleService::schedule().
|
inline |
Convenience function to get my one-and-only raw SampleTag().
Equivalent to: getRawSampleSource()->getSampleTags()->front()
References _rawSampleTag.
Referenced by nidas::core::SamplePipeline::addSampleClient(), nidas::core::SamplePipeline::addSampleClientForTag(), nidas::dynld::RawSampleService::connect(), nidas::dynld::RawSampleService::fromDOMElement(), nidas::dynld::raf::SyncServer::initSensors(), nidas::core::SamplePipeline::removeSampleClient(), nidas::core::SamplePipeline::removeSampleClientForTag(), StatsProcess::run(), DataPrep::run(), DataDump::run(), and DataStats::run().
|
inlinevirtual |
References _iodev, and nidas::core::IODevice::getReadFd().
Referenced by nidas::core::SensorHandler::PolledDSMSensor::getFd().
|
inlineprotected |
References _scanner.
Referenced by nidas::core::CharacterSensor::getNullTerminated().
|
inlinevirtual |
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getSampleStats().
|
inlinevirtual |
Implements nidas::core::SampleSource.
Referenced by nidas::core::SamplePipeline::connect(), DataStats::createCounters(), nidas::core::SamplePipeline::disconnect(), nidas::core::CharacterSensor::doesAsciiSscanfs(), nidas::core::Site::findSensor(), nidas::dynld::WxtSensor::init(), PConfig::loadVariables(), parseAnalog(), parseOther(), StatsProcess::run(), DataPrep::run(), SampleDispatcher::SampleDispatcher(), DumpClient::setSensors(), PConfig::showAll(), and toDOMParent().
|
inlinevirtual |
Implementation of SampleSource::getSampleTags().
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getSampleTags().
Referenced by nidas::dynld::psql::PSQLProcessor::connect(), findVariableIndex(), fromDOMElement(), nidas::core::SampleTagIterator::hasNext(), nidas::dynld::raf::UHSAS_Serial::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::core::CharacterSensor::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::dynld::raf::TwoD64_USB::init_parameters(), nidas::dynld::raf::SyncRecordSource::selectVariablesFromSensor(), PConfig::showCalFiles(), nidas::dynld::A2DSensor::validate(), nidas::core::CharacterSensor::validate(), nidas::dynld::raf::SppSerial::validate(), and nidas::core::DSMConfig::validateSensorAndSampleIds().
|
inline |
Non-const method to get a list of non-const pointers to SampleTags.
References _sampleTags.
|
inline |
References _id, and GET_SPS_ID.
Referenced by SampleToDatabase::defaultMeasurementName(), nidas::core::Site::findSensor(), fromDOMElement(), ARLIngest::prepareHeaderIds(), readSamples(), nidas::dynld::raf::DSMArincSensor::registerWithUDPArincSensor(), sensorTitle(), PConfig::showAll(), PConfig::showSensorClasses(), nidas::core::Site::validate(), validate(), nidas::core::DSMConfig::validateSensorAndSampleIds(), nidas::core::MessageStreamScanner::warnBackwardsStepTimeTag(), and nidas::core::MessageStreamScanner::warnNonIncrTimeTag().
const Site * DSMSensor::getSite | ( | ) | const |
What Site am I associated with?
References _dsm, and nidas::core::DSMConfig::getSite().
Referenced by SampleCounter::collectMetadata(), and fromDOMElement().
|
inline |
References _station.
Referenced by fromDOMElement().
|
inline |
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 _suffix.
Referenced by ExtractFast2D::countParticles(), fromDOMElement(), nidas::core::DSMSensor::MyDictionary::getTokenValue(), ExtractFast2D::run(), ExtractDMT::run(), sensorTitle(), setDepth(), and setHeight().
|
inline |
References _nTimeouts.
Referenced by close().
|
inlinevirtual |
|
inline |
Implement a lookup for tokens that I know about, like $HEIGHT.
For other tokens, call getDSMConfig()->getTokenValue(token,value);
References _dictionary, and nidas::core::DSMSensor::MyDictionary::getTokenValue().
|
inlinevirtual |
Get the type name of this sensor.
References _typeName.
VariableIterator DSMSensor::getVariableIterator | ( | ) | const |
Referenced by fromDOMElement(), DataPrep::matchVariables(), and nidas::core::Site::validate().
|
inlinevirtual |
References _iodev, and nidas::core::IODevice::getWriteFd().
Referenced by main().
|
inline |
References _nTimeouts.
Referenced by nidas::core::SensorOpener::run().
|
virtual |
Initialize the DSMSensor.
This method is called on a DSMSensor after it is fully configured, and before the process method is called. This is where a DSMSensor should do any required initialization of anything that is used by the process() method. If processed samples are not requested from this DSMSensor, then NIDAS apps typically do not call init().
Reimplemented in nidas::dynld::raf::DSMArincSensor, nidas::core::CharacterSensor, nidas::dynld::raf::TwoD_USB, nidas::dynld::WxtSensor, nidas::dynld::raf::SidsNetSensor, nidas::dynld::DSC_FreqCounter, nidas::dynld::raf::DSMAnalogSensor, nidas::dynld::raf::A2D_Serial, nidas::dynld::DSC_Event, nidas::dynld::DSC_PulseCounter, nidas::dynld::A2DSensor, nidas::dynld::raf::A2DBoardTempSensor, nidas::dynld::raf::UHSAS_Serial, nidas::dynld::IEEE_Float, nidas::dynld::ParoSci_202BG_P, nidas::dynld::ParoSci_202BG_T, and nidas::dynld::isff::DAUSensor.
Referenced by nidas::core::DSMEngine::connectProcessors(), nidas::dynld::raf::A2DBoardTempSensor::init(), nidas::dynld::A2DSensor::init(), nidas::dynld::DSC_Event::init(), nidas::dynld::DSC_PulseCounter::init(), nidas::dynld::DSC_FreqCounter::init(), nidas::dynld::raf::TwoD_USB::init(), nidas::core::CharacterSensor::init(), nidas::dynld::raf::DSMArincSensor::init(), nidas::core::DSMConfig::initSensors(), nidas::dynld::raf::SyncServer::initSensors(), StatsProcess::run(), DataPrep::run(), DataDump::run(), and DataStats::run().
|
inlinevirtual |
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 _iodev, nidas::core::IODevice::ioctl(), and len.
|
inlinevirtual |
Extract the next sample from the buffer.
Returns a null pointer if there are no samples left in the buffer.
Reimplemented in nidas::dynld::raf::A2D_Serial, and nidas::dynld::raf::UDPArincSensor.
References _scanner, and nidas::core::SampleScanner::nextSample().
Referenced by nidas::dynld::raf::UDPArincSensor::nextSample(), nidas::dynld::raf::A2D_Serial::nextSample(), readSample(), readSamples(), and nidas::dynld::raf::UHSAS_Serial::sendInitString().
|
virtual |
Open the device.
flags are a combination of O_RDONLY, O_WRONLY.
Reimplemented in nidas::dynld::raf::PIP_Serial, nidas::core::SerialSensor, nidas::dynld::raf::DSMArincSensor, nidas::core::CharacterSensor, nidas::dynld::raf::LamsSensor, nidas::dynld::isff::CSAT3_Sonic, nidas::dynld::DSC_Event, nidas::dynld::DSC_FreqCounter, nidas::dynld::raf::IRIGSensor, nidas::dynld::DSC_A2DSensor, nidas::dynld::DSC_PulseCounter, nidas::dynld::IR104_Relays, nidas::dynld::raf::A2D_Serial, nidas::dynld::raf::TwoD_USB, nidas::dynld::raf::PPT_Serial, nidas::dynld::raf::DSMMesaSensor, nidas::dynld::raf::UDPArincSensor, nidas::dynld::raf::DSMAnalogSensor, nidas::dynld::A2DSensor, nidas::dynld::raf::A2DBoardTempSensor, nidas::dynld::raf::AlicatSDI, nidas::dynld::raf::PSI9116_Sensor, nidas::dynld::raf::VCSEL_Serial, nidas::dynld::isff::CSI_IRGA_Sonic, nidas::dynld::raf::VCSEL2_Serial, nidas::dynld::raf::UHSAS_Serial, nidas::dynld::isff::MOSMote, and nidas::dynld::raf::CVI_LV_Input.
References NLOG.
Referenced by nidas::dynld::A2DSensor::open(), nidas::dynld::raf::DSMAnalogSensor::open(), nidas::dynld::DSC_PulseCounter::open(), nidas::dynld::IR104_Relays::open(), nidas::dynld::raf::TwoD_USB::open(), nidas::dynld::DSC_Event::open(), nidas::dynld::DSC_FreqCounter::open(), nidas::core::CharacterSensor::open(), nidas::dynld::raf::DSMArincSensor::open(), and nidas::core::SensorOpener::run().
|
virtual |
Reimplemented in nidas::core::SerialSensor, nidas::dynld::raf::DSMArincSensor, nidas::dynld::raf::TwoD_USB, nidas::dynld::raf::IRIGSensor, nidas::dynld::raf::A2D_Serial, nidas::dynld::raf::UDPArincSensor, nidas::dynld::DSC_Event, nidas::dynld::DSC_PulseCounter, nidas::dynld::DSC_A2DSensor, nidas::dynld::DSC_FreqCounter, nidas::dynld::raf::DSMAnalogSensor, and nidas::dynld::raf::LamsSensor.
References getBadTimeTagCount(), getCatalogName(), getClassName(), getDeviceName(), getMaxSampleLength(), getMinSampleLength(), getObservedDataRate(), getObservedSamplingRate(), and zebra.
Referenced by nidas::dynld::DSC_A2DSensor::printStatus(), nidas::dynld::DSC_FreqCounter::printStatus(), nidas::dynld::raf::DSMAnalogSensor::printStatus(), nidas::dynld::DSC_Event::printStatus(), nidas::dynld::DSC_PulseCounter::printStatus(), nidas::dynld::raf::UDPArincSensor::printStatus(), nidas::dynld::raf::TwoD_USB::printStatus(), nidas::dynld::raf::DSMArincSensor::printStatus(), nidas::core::SerialSensor::printStatus(), and nidas::core::DSMEngineStat::run().
void DSMSensor::printStatusHeader | ( | std::ostream & | ostr | ) | |
throw | ( | ||||
) |
References getDSMConfig(), getLocation(), getName(), and zebra.
Referenced by nidas::core::DSMEngineStat::run().
void DSMSensor::printStatusTrailer | ( | std::ostream & | ostr | ) | |
throw | ( | ||||
) |
Referenced by nidas::core::DSMEngineStat::run().
|
pure 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.
Implemented in nidas::core::CharacterSensor, nidas::dynld::isff::WisardMote, nidas::dynld::raf::DSMArincSensor, nidas::dynld::WxtSensor, nidas::dynld::raf::DSMAnalogSensor, nidas::dynld::raf::IRIGSensor, nidas::dynld::DSC_FreqCounter, nidas::dynld::raf::A2D_Serial, nidas::dynld::raf::UDPArincSensor, nidas::dynld::DSC_Event, nidas::dynld::DSC_PulseCounter, nidas::dynld::isff::CSAT3_Sonic, nidas::dynld::A2DSensor, nidas::dynld::raf::A2DBoardTempSensor, nidas::dynld::raf::VCSEL_Serial, nidas::dynld::raf::LamsSensor, nidas::dynld::raf::PPT_Serial, nidas::dynld::raf::SidsNetSensor, nidas::dynld::raf::CVI_LV_Input, nidas::dynld::raf::UHSAS_Serial, nidas::dynld::IEEE_Float, nidas::dynld::isff::CSI_IRGA_Sonic, nidas::dynld::raf::PSI9116_Sensor, nidas::dynld::GPS_NMEA_Serial, nidas::dynld::ParoSci_202BG_P, nidas::dynld::TSI_CPC3772, nidas::dynld::isff::MOSMote, nidas::dynld::ParoSci_202BG_T, nidas::dynld::GPS_Novatel_Serial, nidas::dynld::raf::LamsNetSensor, nidas::dynld::raf::TwoD_House, nidas::dynld::raf::PHIPS_UDP, nidas::dynld::raf::PIP_Serial, nidas::dynld::raf::BCPD_Serial, nidas::dynld::raf::CDP_Serial, nidas::dynld::raf::SPP100_Serial, nidas::dynld::raf::SPP200_Serial, nidas::dynld::raf::Watlow, nidas::dynld::raf::PIP_Image, nidas::dynld::raf::SPP300_Serial, nidas::dynld::raf::TwoD32_USB, and nidas::dynld::raf::TwoD64_USB.
|
inlinevirtual |
Read from the device (duh).
Behaves like the read(2) system call, without a file descriptor argument, and with an IOException.
References _iodev, len, and nidas::core::IODevice::read().
Referenced by main().
|
inlinevirtual |
Read from the device with a timeout.
References _iodev, len, and nidas::core::IODevice::read().
|
inline |
Read into my SampleScanner's buffer.
References _scanner, and nidas::core::SampleScanner::readBuffer().
Referenced by readSample(), readSamples(), and nidas::dynld::raf::UHSAS_Serial::sendInitString().
|
inline |
Read into my SampleScanner's buffer.
References _scanner, and nidas::core::SampleScanner::readBuffer().
|
virtual |
Return the next sample.
Buffer(s) will be read if necessary.
References nextSample(), and readBuffer().
Referenced by DmdA2dCk::run().
|
virtual |
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 _rawSource, nidas::core::SampleSourceSupport::distribute(), DLOG, getDSMConfig(), getDSMId(), nidas::core::Project::getName(), getName(), nidas::core::DSMConfig::getProject(), getSensorId(), nextSample(), and readBuffer().
Referenced by DmdA2dCk::run().
|
virtual |
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 | ( | ) |
|
inlinevirtual |
Remove a SampleClient from this SampleSource This will also remove a SampleClient if it has been added with addSampleClientForTag().
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::removeSampleClient().
Referenced by nidas::core::SamplePipeline::removeSampleClient(), and nidas::core::SamplePipeline::removeSampleClientForTag().
|
inlinevirtual |
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 _source, and nidas::core::SampleSourceSupport::removeSampleClientForTag().
Referenced by nidas::core::SamplePipeline::removeSampleClientForTag().
|
virtual |
Remove val from the list of SampleTags, and delete it.
|
privatevirtual |
DSMSensor does not provide public support for SampleSource::removeSampleTag(const SampleTag* val)
Implements nidas::core::SampleSource.
|
inlinevirtual |
Whether to reopen this sensor on an IOException.
The base method returns true. Over-ride if a reopen should not be attempted.
|
inlinevirtual |
References _applyVariableConversions.
Referenced by fromDOMElement().
|
inlinevirtual |
Set the name of the catalog entry for this sensor.
References _catalogName.
Referenced by fromDOMElement().
|
inlinevirtual |
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 _className.
Referenced by fromDOMElement().
|
inlinevirtual |
References _defaultMode.
Referenced by fromDOMElement(), nidas::core::SerialSensor::SerialSensor(), and nidas::dynld::raf::TwoD_USB::TwoD_USB().
void DSMSensor::setDepth | ( | const std::string & | val | ) |
Set sensor depth below ground via a string which is added to variable names.
val | String 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 _depthString, _height, _heightString, nidas::core::floatNAN, getSuffix(), and setFullSuffix().
Referenced by fromDOMElement().
void DSMSensor::setDepth | ( | float | val | ) |
Set sensor depth below ground.
val | depth 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 _depthString, _height, _heightString, getSuffix(), and setFullSuffix().
|
inlinevirtual |
Set the name of the system device that the sensor is connected to.
val | Name of device, e.g. "/dev/xxx0". |
References _devname.
Referenced by fromDOMElement(), and main().
|
inlinevirtual |
References _driverTimeTagUsecs.
Referenced by nidas::dynld::raf::DSMArincSensor::buildIODevice().
void DSMSensor::setDSMConfig | ( | const DSMConfig * | val | ) |
Set the DSMConfig for this sensor.
References _dsm, nidas::core::DSMConfig::getId(), and setDSMId().
Referenced by nidas::core::DSMConfig::sensorFromDOMElement(), and nidas::core::SensorHandler::~SensorHandler().
|
inline |
References _id, and SET_DSM_ID.
Referenced by setDSMConfig().
|
inline |
Set the duplicate ID attribute of this DSMSensor.
References _duplicateIdOK.
Referenced by fromDOMElement().
|
inlineprotected |
References _fullSuffix.
Referenced by setDepth(), setHeight(), and setSuffix().
void DSMSensor::setHeight | ( | const std::string & | val | ) |
Set sensor height above ground via a string which is added to variable names.
val | String 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 _depthString, _height, _heightString, nidas::core::floatNAN, getSuffix(), and setFullSuffix().
Referenced by fromDOMElement().
void DSMSensor::setHeight | ( | float | val | ) |
Set sensor height above ground.
val | height 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 _depthString, _height, _heightString, getSuffix(), and setFullSuffix().
|
inline |
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 _id, and SET_FULL_ID.
|
inline |
|
inlineprotectedvirtual |
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:
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 _lag, and USECS_PER_SEC.
Referenced by fromDOMElement().
|
inlinevirtual |
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().
val | Latency, in seconds. |
References _latency.
Referenced by nidas::dynld::A2DSensor::A2DSensor(), fromDOMElement(), and nidas::dynld::A2DSensor::validate().
|
inline |
References _location.
Referenced by fromDOMElement().
|
inline |
Set the SampleScanner for this sensor.
DSMSensor then owns the pointer and will delete it in its destructor.
References _scanner.
|
inline |
References _id, and SET_SPS_ID.
Referenced by fromDOMElement().
void DSMSensor::setStation | ( | int | val | ) |
References _sampleTags, _station, and nidas::core::SampleTag::setStation().
Referenced by fromDOMElement().
void DSMSensor::setSuffix | ( | const std::string & | val | ) |
References _depthString, _heightString, _suffix, and setFullSuffix().
Referenced by fromDOMElement().
|
inlinevirtual |
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 _timeoutMsecs.
Referenced by nidas::core::RemoteSerialConnection::close(), and fromDOMElement().
|
inlinevirtual |
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 _typeName.
Referenced by fromDOMElement().
|
virtual |
Add my content into a DOMElement.
Reimplemented from nidas::core::DOMable.
Referenced by toDOMParent().
|
virtual |
Create a DOMElement and append it to the parent.
Reimplemented from nidas::core::DOMable.
References nidas::core::DOMable::getNamespaceURI(), getSampleTagIterator(), nidas::core::SampleTagIterator::hasNext(), toDOMElement(), and nidas::core::SampleTag::toDOMParent().
Referenced by nidas::core::DSMConfig::toDOMElement().
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().
|
virtual |
validate() is called once on a DSMSensor after it has been configured, but before open() or init() are called.
Reimplemented in nidas::dynld::isff::Wind3D, nidas::dynld::isff::WisardMote, nidas::dynld::raf::SppSerial, nidas::dynld::raf::DSMAnalogSensor, nidas::core::CharacterSensor, nidas::dynld::raf::A2D_Serial, nidas::dynld::A2DSensor, nidas::dynld::DSC_FreqCounter, nidas::dynld::DSC_PulseCounter, nidas::dynld::isff::Wind2D, nidas::dynld::isff::NCAR_TRH, nidas::dynld::raf::AlicatSDI, nidas::dynld::DSC_A2DSensor, nidas::dynld::raf::PSI9116_Sensor, nidas::dynld::raf::UDPArincSensor, nidas::dynld::isff::CSI_CRX_Binary, nidas::dynld::raf::TwoD64_USB_v3, nidas::dynld::IEEE_Float, nidas::dynld::isff::CU_Coldwire, nidas::dynld::isff::Licor7500, nidas::dynld::TSI_CPC3772, nidas::dynld::GPS_NMEA_Serial, nidas::dynld::raf::PIP_Serial, nidas::dynld::GPS_Novatel_Serial, nidas::dynld::raf::SPP200_Serial, nidas::dynld::raf::BCPD_Serial, nidas::dynld::raf::CDP_Serial, nidas::dynld::raf::SPP100_Serial, and nidas::dynld::raf::SPP300_Serial.
References getDeviceName(), getDSMConfig(), getName(), and getSensorId().
Referenced by nidas::dynld::DSC_PulseCounter::validate(), nidas::dynld::DSC_FreqCounter::validate(), nidas::dynld::A2DSensor::validate(), nidas::core::CharacterSensor::validate(), and nidas::core::DSMConfig::validate().
|
inlinevirtual |
Write to the device (duh).
Behaves like write(2) system call, without a file descriptor argument, and with an IOException.
References _iodev, len, and nidas::core::IODevice::write().
Referenced by nidas::dynld::raf::UHSAS_Serial::sendInitString(), and nidas::core::CharacterSensor::sendInitString().
|
private |
Referenced by getApplyVariableConversions(), and setApplyVariableConversions().
|
private |
Referenced by addCalFile(), getCalFile(), getCalFiles(), and removeCalFiles().
|
private |
Referenced by getCatalogName(), and setCatalogName().
|
private |
Class name attribute of this sensor.
Only used here for informative messages.
Referenced by getClassName(), and setClassName().
|
private |
List of const pointers to Parameters for providing via getParameters().
Referenced by addParameter(), and getParameters().
|
private |
Referenced by getDefaultMode(), and setDefaultMode().
|
private |
Referenced by getDepthString(), setDepth(), setHeight(), and setSuffix().
|
private |
Referenced by getDeviceName(), and setDeviceName().
|
private |
Referenced by expandString(), fromDOMElement(), getDictionary(), and getTokenValue().
|
private |
Referenced by getDriverTimeTagUsecs(), and setDriverTimeTagUsecs().
|
private |
Referenced by getDSMConfig(), getDSMName(), getLocation(), getSite(), and setDSMConfig().
|
private |
Referenced by getDuplicateIdOK(), and setDuplicateIdOK().
|
private |
Concatenation of sensor suffix, and the height or depth string.
Referenced by getFullSuffix(), and setFullSuffix().
|
private |
Referenced by getDepth(), getHeight(), setDepth(), and setHeight().
|
private |
Referenced by getHeightString(), setDepth(), setHeight(), and setSuffix().
|
private |
Id of this sensor.
Raw samples from this sensor will have this id.
Referenced by getDSMId(), getId(), getSensorId(), setDSMId(), setId(), and setSensorId().
|
private |
Referenced by close(), getBytesAvailable(), getIODevice(), getReadFd(), getWriteFd(), ioctl(), read(), setIODevice(), write(), and ~DSMSensor().
|
private |
Referenced by getLagSecs(), getLagUsecs(), and setLagSecs().
|
private |
Referenced by getLatency(), and setLatency().
|
private |
Referenced by getLocation(), and setLocation().
|
staticprivate |
Referenced by deleteLooper(), and getLooper().
|
staticprivate |
Referenced by deleteLooper(), and getLooper().
|
private |
Referenced by getTimeoutCount(), and incrementTimeoutCount().
|
protected |
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 allowOpen().
|
private |
Map of parameters by name.
Referenced by addParameter(), getParameter(), and ~DSMSensor().
|
private |
Referenced by fromDOMElement(), and getRawSampleTag().
|
private |
Referenced by distributeRaw(), fromDOMElement(), getRawSampleSource(), and readSamples().
|
private |
Referenced by fromDOMElement(), getNonConstSampleTags(), getSampleTags(), setStation(), and ~DSMSensor().
|
private |
|
private |
|
private |
Referenced by getStation(), and setStation().
|
private |
Sensor suffix, which is added to variable names.
Referenced by getSuffix(), and setSuffix().
|
private |
Referenced by getTimeoutMsecs(), and setTimeoutMsecs().
|
private |
Referenced by getTypeName(), and setTypeName().
|
staticprivate |
Referenced by printStatus(), and printStatusHeader().