DUNE: Uniform Navigational Environment
2016.09.0
|
Public Member Functions | |
Task (const std::string &name, Tasks::Context &ctx) | |
~Task (void) | |
void | onUpdateParameters (void) |
void | onEntityReservation (void) |
void | onResourceAcquisition (void) |
void | onResourceRelease (void) |
void | onResourceInitialization (void) |
void | updateEEPROM (bool version_pre24) |
void | processADCs (const uint8_t *data) |
void | processLeaks (const uint8_t *data) |
void | processPowerInfo (const uint8_t *data) |
void | processMode (const uint8_t *data) |
void | onCommand (uint8_t cmd, const uint8_t *data, int data_size) |
void | onVersion (unsigned major, unsigned minor, unsigned patch) |
bool | waitForCommand (uint8_t code, unsigned retries=10) |
void | setLeakStatus (int idx, bool leak) |
void | setPowerChannelState (unsigned channel, unsigned state) |
void | onReportEntityState (void) |
void | consume (const IMC::QueryPowerChannelState *msg) |
void | consume (const IMC::PowerChannelControl *msg) |
void | consume (const IMC::SetLedBrightness *msg) |
void | consume (const IMC::QueryLedBrightness *msg) |
void | dispatchPowerChannelStates (void) |
void | onMain (void) |
Public Attributes | |
Hardware::LUCL::Protocol | m_proto |
IMC::Message * | m_adcs [c_adcs_count] |
IMC::EntityState | m_leaks [c_leak_count] |
PowerChannels | m_channels |
IMC::PowerOperation | m_pwr_op |
IMC::LedBrightness | m_led_bright [c_led_count] |
bool | m_pwr_down |
IMC::Temperature | m_temp |
Time::Counter< double > | m_wdog |
Time::Counter< double > | m_state_timer |
Arguments | m_args |
std::map< std::string, unsigned > | m_led_map |
|
inline |
References Power::PCTLv2::Arguments::adc_elabels, Power::PCTLv2::Arguments::adc_factors, Power::PCTLv2::Arguments::adc_messages, Power::PCTLv2::Arguments::adc_ref, Power::PCTLv2::Arguments::chn_eme_state, Power::PCTLv2::Arguments::leak_elabels, Power::PCTLv2::Arguments::leak_medium, Power::PCTLv2::Arguments::leds, m_adcs, m_args, m_pwr_op, Power::PCTLv2::Arguments::pwr_main, Power::PCTLv2::Arguments::pwr_names, Power::PCTLv2::Arguments::pwr_states, Power::PCTLv2::Arguments::uart_dev, Power::PCTLv2::Arguments::vol_min, Power::PCTLv2::Arguments::vol_wup, and Power::PCTLv2::Arguments::wdog_tout.
|
inline |
References m_adcs.
|
inline |
References dispatchPowerChannelStates().
|
inline |
|
inline |
References Power::PCTLv2::CMD_LED_CTL, m_led_bright, m_led_map, m_proto, and waitForCommand().
|
inline |
References m_led_bright, and m_led_map.
|
inline |
Dispatch power channel state messages to bus.
References Power::PCTLv2::PowerChannels::begin(), Power::PCTLv2::PowerChannels::end(), and m_channels.
Referenced by consume().
|
inline |
On Command call.
[in] | cmd | command. |
[in] | data | buffer of data. |
[in] | data_size | size of data. |
References Power::PCTLv2::CMD_STATE, Power::PCTLv2::CMD_TEMP, m_temp, processADCs(), processLeaks(), processMode(), and processPowerInfo().
Referenced by waitForCommand().
|
inline |
Reserve entities.
References Power::PCTLv2::Arguments::adc_elabels, Power::PCTLv2::Arguments::leak_elabels, m_adcs, m_args, and m_leaks.
|
inline |
References Power::PCTLv2::CMD_STATE, m_proto, m_wdog, and waitForCommand().
|
inline |
Report leak entities.
References m_leaks.
|
inline |
Acquire resources.
References m_args, m_proto, m_wdog, Power::PCTLv2::Arguments::uart_dev, and Power::PCTLv2::Arguments::wdog_tout.
|
inline |
Initialize resources.
References Power::PCTLv2::PowerChannels::begin(), Power::PCTLv2::PowerChannels::end(), m_channels, m_proto, and setPowerChannelState().
|
inline |
Release resources.
References Power::PCTLv2::CMD_LED_CTL, m_args, m_proto, Power::PCTLv2::Arguments::pwr_states, setPowerChannelState(), and waitForCommand().
|
inline |
Update parameters.
References Power::PCTLv2::Arguments::adc_elabels, Power::PCTLv2::Arguments::adc_messages, Power::PCTLv2::PowerChannels::add(), Power::PCTLv2::PowerChannels::clear(), Power::PCTLv2::PowerChannel::id, Power::PCTLv2::Arguments::leds, m_adcs, m_args, m_channels, m_led_bright, m_led_map, Power::PCTLv2::Arguments::pwr_names, Power::PCTLv2::Arguments::pwr_states, and Power::PCTLv2::PowerChannel::state.
|
inline |
On version call.
[in] | major | major version number. |
[in] | minor | minor version number. |
[in] | patch | patch version number. |
References updateEEPROM().
Referenced by waitForCommand().
|
inline |
Process data from ADCs.
[in] | data | data buffer. |
References Power::PCTLv2::Arguments::adc_factors, Power::PCTLv2::Arguments::adc_ref, m_adcs, and m_args.
Referenced by onCommand().
|
inline |
Process data from leak sensors.
[in] | data | data buffer. |
References setLeakStatus().
Referenced by onCommand().
|
inline |
Process device mode.
[in] | data | data buffer. |
References m_pwr_down, m_pwr_op, Power::PCTLv2::PWR_MODE_EMERGENCY, Power::PCTLv2::PWR_MODE_EMERGENCY_IP, and Power::PCTLv2::PWR_MODE_OFF_IP.
Referenced by onCommand().
|
inline |
Process power information.
[in] | data | data buffer. |
References Power::PCTLv2::PowerChannels::begin(), Power::PCTLv2::PowerChannels::end(), and m_channels.
Referenced by onCommand().
|
inline |
Set Leak status.
[in] | idx | leak index. |
[in] | leak | leak status. |
References Power::PCTLv2::Arguments::leak_medium, m_args, and m_leaks.
Referenced by processLeaks().
|
inline |
Define power channel state.
[in] | channel | channel. |
[in] | state | state of the power channel. |
References Power::PCTLv2::CMD_PWR_CTL, m_proto, and waitForCommand().
Referenced by onResourceInitialization(), and onResourceRelease().
|
inline |
Update EEPROM data.
References Power::PCTLv2::Arguments::adc_factors, Power::PCTLv2::Arguments::adc_ref, Power::PCTLv2::Arguments::chn_eme_state, Power::PCTLv2::CMD_EEPROM, Power::PCTLv2::EEPROM_SIZE, Power::PCTLv2::EEPROM_START, m_args, m_proto, Power::PCTLv2::Arguments::vol_min, Power::PCTLv2::Arguments::vol_wup, and waitForCommand().
Referenced by onVersion().
|
inline |
Wait for command.
[in] | code | command code. |
[in] | retries | number of retries. |
References m_proto, m_wdog, onCommand(), and onVersion().
Referenced by consume(), onMain(), onResourceRelease(), setPowerChannelState(), and updateEEPROM().
IMC::Message* Power::PCTLv2::Task::m_adcs[c_adcs_count] |
ADC messages.
Referenced by onEntityReservation(), onUpdateParameters(), processADCs(), Task(), and ~Task().
Arguments Power::PCTLv2::Task::m_args |
Task arguments.
Referenced by consume(), onEntityReservation(), onResourceAcquisition(), onResourceRelease(), onUpdateParameters(), processADCs(), setLeakStatus(), Task(), and updateEEPROM().
PowerChannels Power::PCTLv2::Task::m_channels |
Power channels.
Referenced by consume(), dispatchPowerChannelStates(), onResourceInitialization(), onUpdateParameters(), and processPowerInfo().
IMC::EntityState Power::PCTLv2::Task::m_leaks[c_leak_count] |
Leak detection.
Referenced by onEntityReservation(), onReportEntityState(), and setLeakStatus().
IMC::LedBrightness Power::PCTLv2::Task::m_led_bright[c_led_count] |
LED brightness.
Referenced by consume(), and onUpdateParameters().
std::map<std::string, unsigned> Power::PCTLv2::Task::m_led_map |
LED name to id map.
Referenced by consume(), and onUpdateParameters().
Hardware::LUCL::Protocol Power::PCTLv2::Task::m_proto |
Device protocol handler.
Referenced by consume(), onMain(), onResourceAcquisition(), onResourceInitialization(), onResourceRelease(), setPowerChannelState(), updateEEPROM(), and waitForCommand().
bool Power::PCTLv2::Task::m_pwr_down |
Power down is in progress.
Referenced by processMode().
IMC::PowerOperation Power::PCTLv2::Task::m_pwr_op |
Power operation.
Referenced by processMode(), and Task().
Time::Counter<double> Power::PCTLv2::Task::m_state_timer |
State timer.
IMC::Temperature Power::PCTLv2::Task::m_temp |
Temperature.
Referenced by onCommand().
Time::Counter<double> Power::PCTLv2::Task::m_wdog |
Watchdog.
Referenced by onMain(), onResourceAcquisition(), and waitForCommand().