nidas  v1.2-1520
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nidas::core::SensorHandler::PolledDSMSensor Class Reference
Inheritance diagram for nidas::core::SensorHandler::PolledDSMSensor:
Inheritance graph
[legend]

Public Member Functions

 throw (nidas::util::IOException)
 
 ~PolledDSMSensor ()
 Destructor does not close(). More...
 
bool handlePollEvents (uint32_t events) throw ()
 
DSMSensorgetDSMSensor ()
 
int getFd () const
 
const std::string getName () const
 
int getTimeoutMsecs () const
 
void setupTimeouts (int checkIntervalMsecs)
 SensorHandler implements a fairly crude way to detect timeouts on data read from sensors. More...
 
bool checkTimeout ()
 The SensorHandler will call this method of each opened sensor at the interval specified previously in the call to setupTimeouts(int), or perhaps somewhat less often, due to normal overhead. More...
 
void close () throw (nidas::util::IOException)
 Remove this DSMSensor from those being polled, then call its close() method. More...
 

Private Member Functions

 PolledDSMSensor (const PolledDSMSensor &)
 
PolledDSMSensoroperator= (const PolledDSMSensor &)
 

Private Attributes

DSMSensor_sensor
 
SensorHandler_handler
 
int _nTimeoutChecks
 How many times this sensor has been checked for timeouts since the last time data was reads. More...
 
int _nTimeoutChecksMax
 How many timeout checks constitute an timeout on this sensor. More...
 
int _lastCheckInterval
 What the previous timeout check interval was. More...
 

Constructor & Destructor Documentation

nidas::core::SensorHandler::PolledDSMSensor::~PolledDSMSensor ( )
inline

Destructor does not close().

SensorHandler::PolledDSMSensor::PolledDSMSensor ( const PolledDSMSensor )
private

Member Function Documentation

bool SensorHandler::PolledDSMSensor::checkTimeout ( )

The SensorHandler will call this method of each opened sensor at the interval specified previously in the call to setupTimeouts(int), or perhaps somewhat less often, due to normal overhead.

If handlePollEvents(events) with an event mask of EPOLLEDIN has not bee called since the last call to checkTimeout, then increment _nTimeoutChecks.

Returns
: true if _nTimeoutChecks is equal to _nTimeoutChecksMax. false otherwise.

References nidas::util::Thread::getName(), MSECS_PER_SEC, and WLOG.

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

void SensorHandler::PolledDSMSensor::close ( )
throw (nidas::util::IOException
)
DSMSensor* nidas::core::SensorHandler::PolledDSMSensor::getDSMSensor ( )
inline
int nidas::core::SensorHandler::PolledDSMSensor::getFd ( ) const
inlinevirtual
const std::string nidas::core::SensorHandler::PolledDSMSensor::getName ( ) const
inline

References _sensor, and nidas::core::DSMSensor::getName().

Referenced by close().

int nidas::core::SensorHandler::PolledDSMSensor::getTimeoutMsecs ( ) const
inline
bool SensorHandler::PolledDSMSensor::handlePollEvents ( uint32_t  events)
throw (
)
virtual
PolledDSMSensor& nidas::core::SensorHandler::PolledDSMSensor::operator= ( const PolledDSMSensor )
private
void SensorHandler::PolledDSMSensor::setupTimeouts ( int  checkIntervalMsecs)

SensorHandler implements a fairly crude way to detect timeouts on data read from sensors.

It determines the minimum timeout value for the currently opened sensors. This value, but not less than 1000 milliseconds, is the parameter msecs, which is passed here to each opened sensor from time to time as the group of sensors changes.

In this simple implementation, this method sets the value of _nTimeoutChecksMax to: getTimeoutMsecs() + msecs -1)/msecs

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

nidas::core::SensorHandler::PolledDSMSensor::throw ( nidas::util::IOException  )

Member Data Documentation

SensorHandler* nidas::core::SensorHandler::PolledDSMSensor::_handler
private

Referenced by close().

int nidas::core::SensorHandler::PolledDSMSensor::_lastCheckInterval
private

What the previous timeout check interval was.

This value is used to scale _nTimeoutChecks if the check interval changes, which happens when the list of polled sensors changes.

int nidas::core::SensorHandler::PolledDSMSensor::_nTimeoutChecks
private

How many times this sensor has been checked for timeouts since the last time data was reads.

int nidas::core::SensorHandler::PolledDSMSensor::_nTimeoutChecksMax
private

How many timeout checks constitute an timeout on this sensor.

DSMSensor* nidas::core::SensorHandler::PolledDSMSensor::_sensor
private

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