11#include "../../libMagAOX/libMagAOX.hpp"
12#include "../../magaox_git_version.h"
146 config.add(
"temp.warning",
"",
"temp.warning", argType::Required,
"temp",
"warning",
false,
"float",
"Temperature at which to issue a warning. Default is 40.");
147 config.add(
"temp.alert",
"",
"temp.alert", argType::Required,
"temp",
"alert",
false,
"float",
"Temperature at which to issue an alert. Default is 50.");
148 config.add(
"temp.emergency",
"",
"temp.emergency", argType::Required,
"temp",
"emergency",
false,
"float",
"Temperature at which to issue an emergency. Default is 55.");
151 config.add(
"usb.idVendor",
"",
"usb.idVendor", argType::Required,
"usb",
"idVendor",
false,
"string",
"USB vendor id, 4 digits");
152 config.add(
"usb.idProduct",
"",
"usb.idProduct", argType::Required,
"usb",
"idProduct",
false,
"string",
"USB product id, 4 digits");
183 if(config.isSetUnused(mx::app::iniFile::makeKey(
sections[
i],
"serial" )))
186 config.configUnused(
m_probes.back().m_serial, mx::app::iniFile::makeKey(
sections[
i],
"serial" ));
190 config.configUnused(
m_probes.back().m_location, mx::app::iniFile::makeKey(
sections[
i],
"location" ));
232 float temperature = -1
e37;
313 elevatedPrivileges
ep(
this);
410 std::vector<float>
temps;
412 for(
size_t n=0;
n<
temps.size(); ++
n)
The base-class for MagAO-X applications.
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI property element value if it has changed.
stateCodes::stateCodeT state()
Get the current state code.
int m_shutdown
Flag to signal it's time to shutdown. When not 0, the main loop exits.
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
int createROIndiNumber(pcf::IndiProperty &prop, const std::string &propName, const std::string &propLabel="", const std::string &propGroup="")
Create a ReadOnly INDI Number property.
int registerIndiPropertyReadOnly(pcf::IndiProperty &prop)
Register an INDI property which is read only.
pcf::IndiProperty m_indiP_temps
virtual int appStartup()
Startup function.
virtual int appShutdown()
Shutdown the app.
virtual void loadConfig()
~usbtempMon() noexcept
D'tor, declared and defined for noexcept.
std::vector< probe > m_probes
friend class usbtempMon_test
std::vector< float > m_lastTemps
int recordTelem(const telem_temps *)
virtual int appLogic()
Implementation of the FSM for usbtempMon.
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
int recordTemps(bool force=false)
virtual void setupConfig()
usbtempMon()
Default c'tor.
@ OPERATING
The device is operating, other than homing.
@ CONNECTED
The application has connected to the device or service.
@ NOTCONNECTED
The application is not connected to the device or service.
int ttyUSBDevNames(std::vector< std::string > &devNames, const std::string &vendor, const std::string &product)
Get the ttyUSB device name for a set of devices specified by their vendor and product ids.
static constexpr logPrioT LOG_CRITICAL
The process can not continue and will shut down (fatal)
static constexpr logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
static constexpr logPrioT LOG_EMERGENCY
Normal operations of the entire system should be shut down immediately.
static constexpr logPrioT LOG_ALERT
This should only be used if some action is required by operators to keep the system safe.
A device base class which saves telemetry.
int loadConfig(appConfigurator &config)
Load the device section from an application configurator.
int setupConfig(appConfigurator &config)
Setup an application configurator for the device section.
int checkRecordTimes(const telT &tel, telTs... tels)
Check the time of the last record for each telemetry type and make an entry if needed.
bool operator<(const probe &p) const
Log entry recording electronics rack temperature.
A USB device as a TTY device.
std::string m_idProduct
The product id 4-digit code.
std::string m_serial
The serial number.
std::string m_idVendor
The vendor id 4-digit code.
int DS18B20_acquire(HANDLE fd, float *temperature)
int DS18B20_measure(HANDLE fd)
HANDLE DS18B20_open(const char *serial_port)
void DS18B20_close(HANDLE fd)
int is_fd_valid(HANDLE fd)
char * DS18B20_errmsg(void)
int DS18B20_rom(HANDLE fd, unsigned char *rom)