DUNE: Uniform Navigational Environment  2016.03.0
Sensors::Imagenex837B::Task Struct Reference

Detailed Description

Task.

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
 
void onUpdateParameters (void)
 
void initializeSonarData (unsigned data_size)
 
void onResourceInitialization (void)
 
void onResourceRelease (void)
 
void onRequestActivation (void)
 
void onActivation (void)
 
void onDeactivation (void)
 
void checkActivationProgress (void)
 
void openLog (const Path &path)
 
void closeLog (void)
 
void consume (const IMC::EstimatedState *msg)
 
void consume (const IMC::LoggingControl *msg)
 
void consume (const IMC::SoundSpeed *msg)
 
unsigned getIndex (unsigned value, const unsigned *table, unsigned table_size)
 
void setRange (unsigned value)
 
void setStartGain (unsigned value)
 
void setSwitchDelay (unsigned value)
 
void setAbsorption (unsigned value)
 
void setDataPoints (unsigned value)
 
void setAutoMode (bool auto_mode)
 
void setNadirAngle (float angle)
 
void setAutoGainValue (unsigned value)
 
bool ping (unsigned data_point)
 
void sendExternalControl (Address addr, unsigned port)
 
bool getEcho (void)
 
void writeToFile (void)
 
void update (void)
 
void checkAltitude (void)
 
bool request (void)
 
void process (void)
 
void checkRange (void)
 
void onMain (void)
 

Public Attributes

TCPSocket * m_tcp
 
UDPSocket * m_udp
 
Frame837m_frame837
 
Frame83Pm_frame83P
 
IMC::SonarData * m_data
 
ExternalControlm_ec
 
uint8_t m_sdata [c_sdata_size]
 
uint8_t m_rdata_hdr [c_rdata_hdr_size]
 
uint8_t m_rdata_ftr [c_rdata_ftr_size]
 
IMC::EstimatedState m_estate
 
std::ofstream m_log_file
 
Path m_log_path
 
IMC::PowerChannelControl m_power_channel_control
 
Counter< double > m_countdown
 
Counter< double > m_range_counter
 
Time::Counter< float > m_wdog
 
Arguments m_args
 

Constructor & Destructor Documentation

Member Function Documentation

void Sensors::Imagenex837B::Task::checkAltitude ( void  )
inline
void Sensors::Imagenex837B::Task::checkRange ( void  )
inline
void Sensors::Imagenex837B::Task::closeLog ( void  )
inline

Close current log file.

References m_log_file, and m_log_path.

Referenced by consume(), onDeactivation(), onResourceInitialization(), and openLog().

void Sensors::Imagenex837B::Task::consume ( const IMC::EstimatedState *  msg)
inline

References m_estate.

void Sensors::Imagenex837B::Task::consume ( const IMC::LoggingControl *  msg)
inline
void Sensors::Imagenex837B::Task::consume ( const IMC::SoundSpeed *  msg)
inline
unsigned Sensors::Imagenex837B::Task::getIndex ( unsigned  value,
const unsigned *  table,
unsigned  table_size 
)
inline

Get index from table according with given value.

Parameters
[in]valuevalue to be checked in the table.
[in]tablevector with parameters.
[in]table_sizesize of the vector.
Returns
index of the vector.

Referenced by setRange().

void Sensors::Imagenex837B::Task::initializeSonarData ( unsigned  data_size)
inline

Initialize IMC sonar data holder.

References m_data.

Referenced by onUpdateParameters().

void Sensors::Imagenex837B::Task::onActivation ( void  )
inline

References m_wdog.

void Sensors::Imagenex837B::Task::onDeactivation ( void  )
inline
void Sensors::Imagenex837B::Task::onMain ( void  )
inline
void Sensors::Imagenex837B::Task::onRequestActivation ( void  )
inline
void Sensors::Imagenex837B::Task::onResourceInitialization ( void  )
inline

References closeLog().

void Sensors::Imagenex837B::Task::onResourceRelease ( void  )
inline

References m_data, m_ec, m_frame837, and m_frame83P.

void Sensors::Imagenex837B::Task::openLog ( const Path &  path)
inline

Open a log file to hold 837 or 83P files.

Parameters
[in]pathdesired log path.

References closeLog(), m_log_file, and m_log_path.

Referenced by consume().

bool Sensors::Imagenex837B::Task::ping ( unsigned  data_point)
inline

Request device to ping.

Parameters
[in]data_pointdata index.

References Sensors::Imagenex837B::Frame837::getMessageData(), m_data, m_frame837, m_rdata_ftr, m_rdata_hdr, m_sdata, m_tcp, and Sensors::Imagenex837B::SD_PACKET_NUM.

Referenced by request().

void Sensors::Imagenex837B::Task::process ( void  )
inline

Process return data.

References m_data, m_frame837, m_frame83P, m_wdog, and writeToFile().

Referenced by onMain().

bool Sensors::Imagenex837B::Task::request ( void  )
inline

Request sonar data.

Returns
true if return is successful, false otherwise.

References Sensors::Imagenex837B::Arguments::data_points, getEcho(), m_args, m_ec, and ping().

Referenced by onMain().

void Sensors::Imagenex837B::Task::sendExternalControl ( Address  addr,
unsigned  port 
)
inline
void Sensors::Imagenex837B::Task::setAbsorption ( unsigned  value)
inline

Define switch command data absorption value.

Parameters
[in]valueabsorption value.

References m_sdata, and Sensors::Imagenex837B::SD_ABSORPTION.

Referenced by onUpdateParameters().

void Sensors::Imagenex837B::Task::setAutoGainValue ( unsigned  value)
inline

Define switch command data auto gain threshold.

Parameters
[in]valueauto gain threshold.

References m_sdata, and Sensors::Imagenex837B::SD_AGC_THRESHOLD.

Referenced by onUpdateParameters().

void Sensors::Imagenex837B::Task::setAutoMode ( bool  auto_mode)
inline

Define switch command data auto mode.

References m_sdata, and Sensors::Imagenex837B::SD_RUN_MODE.

Referenced by onUpdateParameters().

void Sensors::Imagenex837B::Task::setDataPoints ( unsigned  value)
inline

Define switch command data number of data points.

Parameters
[in]valuenumber of data points.

References m_frame837, m_sdata, Sensors::Imagenex837B::SD_DATA_POINTS, and Sensors::Imagenex837B::Frame837::setExtendedDataPoints().

Referenced by onUpdateParameters().

void Sensors::Imagenex837B::Task::setNadirAngle ( float  angle)
inline
void Sensors::Imagenex837B::Task::setStartGain ( unsigned  value)
inline
void Sensors::Imagenex837B::Task::setSwitchDelay ( unsigned  value)
inline

Define switch command data switch delay.

Parameters
[in]valueswitch delay.

References m_sdata, and Sensors::Imagenex837B::SD_SWITCH_DELAY.

Referenced by onUpdateParameters().

Member Data Documentation

Arguments Sensors::Imagenex837B::Task::m_args
Counter<double> Sensors::Imagenex837B::Task::m_countdown

Activation/deactivation timer.

Referenced by checkActivationProgress(), onRequestActivation(), and onUpdateParameters().

IMC::SonarData* Sensors::Imagenex837B::Task::m_data
IMC::EstimatedState Sensors::Imagenex837B::Task::m_estate

Estimated state.

Referenced by checkAltitude(), consume(), and update().

Frame83P* Sensors::Imagenex837B::Task::m_frame83P
std::ofstream Sensors::Imagenex837B::Task::m_log_file

Log file.

Referenced by closeLog(), openLog(), and writeToFile().

Path Sensors::Imagenex837B::Task::m_log_path

Log filename.

Referenced by closeLog(), and openLog().

IMC::PowerChannelControl Sensors::Imagenex837B::Task::m_power_channel_control

Power channel control.

Referenced by onDeactivation(), onRequestActivation(), and onUpdateParameters().

Counter<double> Sensors::Imagenex837B::Task::m_range_counter

Range adaptive modifier counter.

Referenced by checkRange(), and onUpdateParameters().

uint8_t Sensors::Imagenex837B::Task::m_rdata_ftr[c_rdata_ftr_size]

Footer Return data.

Referenced by ping().

uint8_t Sensors::Imagenex837B::Task::m_rdata_hdr[c_rdata_hdr_size]

Header Return data.

Referenced by ping(), and writeToFile().

uint8_t Sensors::Imagenex837B::Task::m_sdata[c_sdata_size]
TCPSocket* Sensors::Imagenex837B::Task::m_tcp

TCP socket.

Referenced by checkActivationProgress(), onDeactivation(), onMain(), and ping().

UDPSocket* Sensors::Imagenex837B::Task::m_udp
Time::Counter<float> Sensors::Imagenex837B::Task::m_wdog

Watchdog.

Referenced by onActivation(), onMain(), onUpdateParameters(), and process().

Collaboration diagram for Sensors::Imagenex837B::Task:
Collaboration graph