A device which saves telemetry. More...
#include <telemeter.hpp>
Public Types | |
typedef logger::logManager< derivedT, logFileRaw > | logManagerT |
The log manager type. More... | |
Public Member Functions | |
telemeter () | |
template<typename telT > | |
int | telem (const typename telT::messageT &msg) |
Make a telemetry recording. More... | |
template<typename telT > | |
int | telem () |
Make a telemetry recording, for an empty record. More... | |
int | setupConfig (appConfigurator &config) |
Setup an application configurator for the device section. More... | |
int | loadConfig (appConfigurator &config) |
Load the device section from an application configurator. More... | |
int | appStartup () |
Starts the telemetry log thread. More... | |
int | appLogic () |
Perform telemeter application logic. More... | |
int | appShutdown () |
Perform telemeter application shutdown. More... | |
template<class telT , class... telTs> | |
int | checkRecordTimes (const telT &tel, telTs... tels) |
Check the time of the last record for each telemetry type and make an entry if needed. More... | |
template<class telT , class... telTs> | |
int | checkRecordTimes (timespec &ts, const telT &tel, telTs... tels) |
Worker function to actually perform the record time checking logic. More... | |
int | checkRecordTimes (timespec &ts) |
Empty function called at the end of the template list. More... | |
Public Attributes | |
logManagerT | m_tel |
double | m_maxInterval {10.0} |
The maximum interval, in seconds, between telemetry records. Default is 10.0 seconds. More... | |
Private Member Functions | |
derivedT & | derived () |
Access the derived class. More... | |
A device which saves telemetry.
The derivedT
class must be a MagAOXApp, and must implement the following interface:
1) int checkRecordTimes()
This function MUST be implemented as follows:
where there is one constructor-call argument for each telemetry log type recorded by this device. The resultant objects are not used, rather the types are used for variadic template resolution.
2) Next, there must be one overload of the function
for each of the telemetry types. You MUST NOT use the pointer argument, it is for type resolution only – you should fill in the telemetry log message using internal values. Note that calls to this function should result in a telemetry log entry every time – it is called when the minimum interval has elapsed since the last entry.
Additionally, calls to this classes setupConfig, loadConfig
, appStartup
, appLogic
, and appShutdown
should be placed in the corresponding function of derivedT
, with error checking.
Definition at line 51 of file telemeter.hpp.
typedef logger::logManager<derivedT, logFileRaw> MagAOX::app::dev::telemeter< derivedT >::logManagerT |
The log manager type.
Definition at line 54 of file telemeter.hpp.
MagAOX::app::dev::telemeter< derivedT >::telemeter |
Definition at line 164 of file telemeter.hpp.
int MagAOX::app::dev::telemeter< derivedT >::appLogic |
Perform telemeter
application logic.
This calls derivedT::checkRecordTimes()
, and should be called from derivedT::appLogic
, but only when the FSM is in states where telemetry logging makes sense.
Definition at line 253 of file telemeter.hpp.
int MagAOX::app::dev::telemeter< derivedT >::appShutdown |
Perform telemeter
application shutdown.
This currently does nothing.
Definition at line 259 of file telemeter.hpp.
Referenced by MagAOX::app::andorCtrl::appShutdown(), MagAOX::app::cameraSim::appShutdown(), MagAOX::app::dmSpeckle::appShutdown(), MagAOX::app::koolanceCtrl::appShutdown(), MagAOX::app::observerCtrl::appShutdown(), MagAOX::app::ocam2KCtrl::appShutdown(), MagAOX::app::qhyCtrl::appShutdown(), MagAOX::app::siglentSDG::appShutdown(), and MagAOX::app::sysMonitor::appShutdown().
int MagAOX::app::dev::telemeter< derivedT >::appStartup |
Starts the telemetry log thread.
This should be called from derivedT::appStartup
Definition at line 226 of file telemeter.hpp.
Referenced by MagAOX::app::smc100ccCtrl::appStartup().
int MagAOX::app::dev::telemeter< derivedT >::checkRecordTimes | ( | const telT & | tel, |
telTs... | tels | ||
) |
Check the time of the last record for each telemetry type and make an entry if needed.
This must be called from derivedT::checkRecordTimes()
, with one template parameter for ach telemetry log type being recorded.
[in] | tel | [unused] object of the telemetry type to record |
[in] | tels | [unused] objects of the additional telemetry types to record |
Definition at line 266 of file telemeter.hpp.
Referenced by MagAOX::app::filterWheelCtrl::checkRecordTimes(), MagAOX::app::hsfwCtrl::checkRecordTimes(), MagAOX::app::rhusbMon::checkRecordTimes(), and MagAOX::app::usbtempMon::checkRecordTimes().
int MagAOX::app::dev::telemeter< derivedT >::checkRecordTimes | ( | timespec & | ts | ) |
Empty function called at the end of the template list.
[in] | ts | [unused] the timestamp that records are compared to |
Definition at line 290 of file telemeter.hpp.
int MagAOX::app::dev::telemeter< derivedT >::checkRecordTimes | ( | timespec & | ts, |
const telT & | tel, | ||
telTs... | tels | ||
) |
Worker function to actually perform the record time checking logic.
Recursively calls itself until the variadic template list is exhausted.
[in] | ts | [unused] the timestamp that records are compared to |
[in] | tel | [unused] objects of the telemetry type to record |
[in] | tels | [unused] objects of the additional telemetry types to record |
Definition at line 277 of file telemeter.hpp.
|
inlineprivate |
Access the derived class.
Definition at line 157 of file telemeter.hpp.
int MagAOX::app::dev::telemeter< derivedT >::loadConfig | ( | appConfigurator & | config | ) |
Load the device section from an application configurator.
[in] | config | an application configuration from which to load values |
Definition at line 208 of file telemeter.hpp.
Referenced by MagAOX::app::andorCtrl::loadConfig(), MagAOX::app::cameraSim::loadConfig(), MagAOX::app::filterWheelCtrl::loadConfig(), MagAOX::app::hsfwCtrl::loadConfig(), MagAOX::app::koolanceCtrl::loadConfig(), MagAOX::app::observerCtrl::loadConfig(), MagAOX::app::ocam2KCtrl::loadConfig(), MagAOX::app::picamCtrl::loadConfig(), MagAOX::app::qhyCtrl::loadConfig(), MagAOX::app::siglentSDG::loadConfig(), MagAOX::app::smc100ccCtrl::loadConfig(), MagAOX::app::sysMonitor::loadConfig(), MagAOX::app::zylaCtrl::loadConfig(), MagAOX::app::dmSpeckle::loadConfigImpl(), MagAOX::app::rhusbMon::loadConfigImpl(), MagAOX::app::tcsInterface::loadConfigImpl(), MagAOX::app::usbtempMon::loadConfigImpl(), and MagAOX::app::zaberCtrl::loadConfigImpl().
int MagAOX::app::dev::telemeter< derivedT >::setupConfig | ( | appConfigurator & | config | ) |
Setup an application configurator for the device section.
[in] | config | an application configuration to setup |
Definition at line 195 of file telemeter.hpp.
Referenced by MagAOX::app::andorCtrl::setupConfig(), MagAOX::app::cameraSim::setupConfig(), MagAOX::app::filterWheelCtrl::setupConfig(), MagAOX::app::hsfwCtrl::setupConfig(), MagAOX::app::koolanceCtrl::setupConfig(), MagAOX::app::observerCtrl::setupConfig(), MagAOX::app::ocam2KCtrl::setupConfig(), MagAOX::app::picamCtrl::setupConfig(), MagAOX::app::qhyCtrl::setupConfig(), MagAOX::app::rhusbMon::setupConfig(), MagAOX::app::siglentSDG::setupConfig(), MagAOX::app::smc100ccCtrl::setupConfig(), MagAOX::app::sysMonitor::setupConfig(), MagAOX::app::tcsInterface::setupConfig(), MagAOX::app::usbtempMon::setupConfig(), MagAOX::app::zaberCtrl::setupConfig(), and MagAOX::app::zylaCtrl::setupConfig().
int MagAOX::app::dev::telemeter< derivedT >::telem |
Make a telemetry recording, for an empty record.
Wrapper for logManager::log, which updates telT::lastRecord.
logT | the log entry type |
retval | the value returned by this method. |
Definition at line 183 of file telemeter.hpp.
Referenced by visxCtrl.xapp.VisX::emit_telem_stdcam(), audibleAlerts.core.AudibleAlerts::handle_reload_request(), and audibleAlerts.core.AudibleAlerts::handle_speech_request().
int MagAOX::app::dev::telemeter< derivedT >::telem | ( | const typename telT::messageT & | msg | ) |
Make a telemetry recording.
Wrapper for logManager::log, which updates telT::lastRecord.
logT | the log entry type |
retval | the value returned by this method. |
[in] | msg | the data to log |
Definition at line 170 of file telemeter.hpp.
Referenced by visxCtrl.xapp.VisX::emit_telem_stdcam(), audibleAlerts.core.AudibleAlerts::handle_reload_request(), and audibleAlerts.core.AudibleAlerts::handle_speech_request().
double MagAOX::app::dev::telemeter< derivedT >::m_maxInterval {10.0} |
The maximum interval, in seconds, between telemetry records. Default is 10.0 seconds.
Definition at line 58 of file telemeter.hpp.
logManagerT MagAOX::app::dev::telemeter< derivedT >::m_tel |
Definition at line 56 of file telemeter.hpp.